/* ONI FILMS - module Assemblee Generale
   Palette : or #cc9744, bleu #0577ff, bleu profond #26377f */

:root {
  --gold: #cc9744;
  --gold-dark: #a87932;
  --blue: #0577ff;
  --blue-dark: #0461d1;
  --navy: #26377f;
  --navy-deep: #1b2759;
  --ink: #16213f;
  --muted: #5c6784;
  --line: #dfe4ef;
  --bg: #f5f7fb;
  --surface: #ffffff;
  --success: #137a4b;
  --success-bg: #e6f4ed;
  --danger: #b02a2a;
  --danger-bg: #fbeaea;
  --warning: #b77400;
  --warning-bg: #fdf3e2;
  --neutral: #6b7280;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(22, 33, 63, .06), 0 8px 24px rgba(22, 33, 63, .06);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 16px;
  line-height: 1.55;
  -webkit-text-size-adjust: 100%;
}

a { color: var(--blue-dark); }
a:hover { color: var(--navy); }

h1, h2, h3, h4 { color: var(--navy); line-height: 1.25; margin: 0 0 .6em; font-weight: 700; }
h1 { font-size: 1.6rem; }
h2 { font-size: 1.25rem; }
h3 { font-size: 1.05rem; }
p { margin: 0 0 1em; }
small, .small { font-size: .875rem; color: var(--muted); }
.muted { color: var(--muted); }
.tnum { font-variant-numeric: tabular-nums; }

/* --- Structure administration ------------------------------------------- */

.admin-shell { display: flex; min-height: 100vh; }

.sidebar {
  width: 248px;
  flex: 0 0 248px;
  background: var(--navy-deep);
  color: #dce3f5;
  padding: 20px 0 40px;
}
.sidebar .brand {
  display: flex; align-items: center; gap: 10px;
  padding: 0 18px 18px;
  border-bottom: 1px solid rgba(255,255,255,.12);
  margin-bottom: 14px;
}
.sidebar .brand img { width: 38px; height: 38px; border-radius: 50%; }
.sidebar .brand span { font-weight: 700; color: #fff; font-size: .95rem; line-height: 1.2; }
.sidebar nav a {
  display: block; padding: 9px 18px; color: #c6d0ea; text-decoration: none; font-size: .93rem;
  border-left: 3px solid transparent;
}
.sidebar nav a:hover { background: rgba(255,255,255,.07); color: #fff; }
.sidebar nav a.active { background: rgba(5,119,255,.18); border-left-color: var(--gold); color: #fff; font-weight: 600; }
.sidebar .nav-group { padding: 16px 18px 6px; font-size: .72rem; letter-spacing: .09em; text-transform: uppercase; color: #8494bd; }

.main { flex: 1; min-width: 0; }
.topbar {
  background: var(--surface); border-bottom: 1px solid var(--line);
  padding: 12px 24px; display: flex; align-items: center; justify-content: space-between; gap: 16px;
}
.topbar .who { font-size: .88rem; color: var(--muted); }
.content { padding: 24px; max-width: 1180px; }

/* --- Structure espace membre --------------------------------------------- */

.member-shell { max-width: 620px; margin: 0 auto; padding: 0 16px 64px; }
.member-header {
  background: var(--navy); color: #fff; margin: 0 -16px 20px; padding: 16px;
  display: flex; align-items: center; gap: 12px;
}
.member-header img { width: 42px; height: 42px; border-radius: 50%; }
.member-header .t { font-weight: 700; font-size: 1rem; }
.member-header .s { font-size: .82rem; color: #b9c5e8; }
.member-nav { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 18px; }
.member-nav a {
  flex: 1 1 auto; text-align: center; padding: 10px 8px; background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--radius); text-decoration: none;
  color: var(--navy); font-size: .88rem; font-weight: 600; min-width: 92px;
}
.member-nav a.active { background: var(--navy); color: #fff; border-color: var(--navy); }

/* --- Cartes et blocs ------------------------------------------------------ */

.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 18px; margin-bottom: 16px; box-shadow: var(--shadow);
}
.card.tight { padding: 14px; }
.card h2:first-child, .card h3:first-child { margin-top: 0; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }

.grid { display: grid; gap: 16px; }
.grid.cols-2 { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.grid.cols-3 { grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); }
.grid.cols-4 { grid-template-columns: repeat(auto-fit, minmax(165px, 1fr)); }

.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; }
.stat .n { font-size: 1.9rem; font-weight: 700; color: var(--navy); font-variant-numeric: tabular-nums; line-height: 1.1; }
.stat .l { font-size: .82rem; color: var(--muted); }

/* --- Etiquettes ----------------------------------------------------------- */

.tag {
  display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: .76rem;
  font-weight: 600; border: 1px solid transparent; white-space: nowrap;
}
.tag-success { background: var(--success-bg); color: var(--success); border-color: #bfe0ce; }
.tag-danger  { background: var(--danger-bg);  color: var(--danger);  border-color: #f0c9c9; }
.tag-warning { background: var(--warning-bg); color: var(--warning); border-color: #f2ddb4; }
.tag-neutral { background: #eef1f6; color: var(--neutral); border-color: #dde2ec; }
.tag-info    { background: #e7f1ff; color: var(--blue-dark); border-color: #c4dcff; }
.tag-gold    { background: #fbf2e3; color: var(--gold-dark); border-color: #eeddc0; }

/* --- Messages ------------------------------------------------------------- */

.flash { padding: 12px 14px; border-radius: var(--radius); margin-bottom: 14px; border: 1px solid; font-size: .93rem; }
.flash-success { background: var(--success-bg); border-color: #bfe0ce; color: #0e5c39; }
.flash-error   { background: var(--danger-bg);  border-color: #f0c9c9; color: #8a2020; }
.flash-warning { background: var(--warning-bg); border-color: #f2ddb4; color: #8a5800; }

.notice { border-left: 3px solid var(--gold); background: #fbf8f2; padding: 12px 14px; border-radius: 0 6px 6px 0; margin-bottom: 14px; font-size: .92rem; }
.notice.alert { border-left-color: var(--danger); background: var(--danger-bg); }
.notice.info  { border-left-color: var(--blue); background: #f0f6ff; }

/* --- Formulaires ---------------------------------------------------------- */

.field { margin-bottom: 14px; }
.field label { display: block; font-size: .86rem; font-weight: 600; color: var(--navy); margin-bottom: 5px; }
.field .hint { font-size: .8rem; color: var(--muted); margin-top: 4px; }
input[type=text], input[type=email], input[type=password], input[type=number],
input[type=date], input[type=datetime-local], input[type=search], input[type=url], input[type=file], select, textarea {
  width: 100%; padding: 9px 11px; border: 1px solid var(--line); border-radius: 8px;
  font-size: .95rem; font-family: inherit; background: #fff; color: var(--ink);
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--blue); outline-offset: 1px; border-color: var(--blue); }
textarea { min-height: 110px; resize: vertical; }
/* Ligne mise en evidence dans un tableau : un adherent a jour de cotisation.
   Le fond seul ne suffit pas, une etiquette porte toujours l'information. */
tr.row-ok > td { background: rgba(31, 138, 76, .07); }
tr.row-ok > td:first-child { box-shadow: inset 3px 0 0 rgba(31, 138, 76, .55); }
/* Colonne de cases a cocher d'un tableau : etroite, cases confortables au doigt. */
th.check, td.check { width: 34px; text-align: center; padding-left: 8px; padding-right: 0; }
th.check input, td.check input { width: 18px; height: 18px; cursor: pointer; }
/* Saisie directe dans un tableau : le champ ne doit pas elargir la colonne. */
td .cell-input { width: 100%; max-width: 160px; padding: 5px 7px; font-size: .9rem; }
.checkline { display: flex; align-items: flex-start; gap: 9px; margin-bottom: 10px; font-size: .92rem; }
.checkline input { margin-top: 3px; width: 18px; height: 18px; flex: 0 0 18px; }
.form-row { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); }

.btn {
  display: inline-block; padding: 9px 16px; border-radius: 8px; border: 1px solid transparent;
  font-size: .92rem; font-weight: 600; cursor: pointer; text-decoration: none; font-family: inherit;
  background: var(--blue); color: #fff; transition: background .12s ease;
}
.btn:hover { background: var(--blue-dark); color: #fff; }
.btn-navy { background: var(--navy); } .btn-navy:hover { background: var(--navy-deep); }
.btn-gold { background: var(--gold); color: #24170a; } .btn-gold:hover { background: var(--gold-dark); color: #fff; }
.btn-ghost { background: #fff; color: var(--navy); border-color: var(--line); }
.btn-ghost:hover { background: #eef2f9; color: var(--navy); }
.btn-danger { background: var(--danger); } .btn-danger:hover { background: #8a2020; }
.btn-sm { padding: 5px 10px; font-size: .82rem; }
.btn-block { display: block; width: 100%; text-align: center; }
.btn-lg { padding: 16px 20px; font-size: 1.05rem; }
.btn:disabled, .btn[aria-disabled=true] { opacity: .5; cursor: not-allowed; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* --- Tableaux ------------------------------------------------------------- */

.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); background: #fff; }
table { width: 100%; border-collapse: collapse; font-size: .9rem; }
th, td { padding: 9px 12px; text-align: left; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { background: #f0f3f9; font-size: .78rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 700; white-space: nowrap; }
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: #f8fafd; }
td.num { text-align: right; font-variant-numeric: tabular-nums; }

/* --- Jauge de quorum ------------------------------------------------------ */

.gauge { height: 12px; background: #e6eaf3; border-radius: 999px; overflow: hidden; margin: 8px 0; }
.gauge span { display: block; height: 100%; width: 0; background: var(--blue); border-radius: 999px; transition: width .4s ease; }
.gauge.reached span { background: var(--success); }

/* --- Vote (espace membre) ------------------------------------------------- */

.vote-option { display: block; margin-bottom: 10px; }
.vote-option input { position: absolute; opacity: 0; width: 0; height: 0; }
.vote-option .box {
  display: flex; align-items: center; gap: 12px; padding: 16px;
  border: 2px solid var(--line); border-radius: var(--radius); background: #fff;
  font-size: 1.02rem; font-weight: 600; color: var(--ink); min-height: 56px;
}
.vote-option input:focus-visible + .box { outline: 2px solid var(--blue); outline-offset: 2px; }
.vote-option input:checked + .box { border-color: var(--blue); background: #f0f6ff; color: var(--navy); }
.vote-option .box .mark {
  width: 22px; height: 22px; flex: 0 0 22px; border: 2px solid var(--line); border-radius: 50%; background: #fff;
}
.vote-option input:checked + .box .mark { border-color: var(--blue); background: var(--blue); box-shadow: inset 0 0 0 4px #fff; }
.vote-option.for input:checked + .box { border-color: var(--success); background: var(--success-bg); color: #0e5c39; }
.vote-option.for input:checked + .box .mark { border-color: var(--success); background: var(--success); }
.vote-option.against input:checked + .box { border-color: var(--danger); background: var(--danger-bg); color: #8a2020; }
.vote-option.against input:checked + .box .mark { border-color: var(--danger); background: var(--danger); }
.vote-option.abstain input:checked + .box { border-color: var(--neutral); background: #eef1f6; color: #414a5c; }
.vote-option.abstain input:checked + .box .mark { border-color: var(--neutral); background: var(--neutral); }

.resolution-body { background: #f7f9fd; border-left: 3px solid var(--navy); padding: 12px 14px; border-radius: 0 6px 6px 0; margin-bottom: 16px; white-space: pre-wrap; }

/* --- Signature ------------------------------------------------------------ */

.sigpad { border: 2px dashed var(--line); border-radius: var(--radius); background: #fff; touch-action: none; width: 100%; height: 190px; display: block; }
.sigpad.filled { border-style: solid; border-color: var(--blue); }

/* --- Recherche de mandataire --------------------------------------------- */

.search-results { list-style: none; margin: 10px 0 0; padding: 0; }
.search-results li { border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; margin-bottom: 8px; display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.search-results li.selected { border-color: var(--blue); background: #f0f6ff; }

/* --- Divers --------------------------------------------------------------- */

.code-display {
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: 1.5rem; letter-spacing: .18em; font-weight: 700; color: var(--navy);
  background: #f3f6fc; border: 1px solid var(--line); border-radius: 8px; padding: 10px 14px;
  display: inline-block; word-break: break-all;
}
.copybox { background: #f3f6fc; border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; font-family: ui-monospace, Menlo, Consolas, monospace; font-size: .82rem; word-break: break-all; }
textarea.copybox { width: 100%; resize: vertical; line-height: 1.5; word-break: normal; white-space: pre; overflow: auto; }
.breadcrumb { font-size: .85rem; color: var(--muted); margin-bottom: 10px; }
.breadcrumb a { color: var(--muted); }
hr { border: none; border-top: 1px solid var(--line); margin: 18px 0; }
.hidden { display: none !important; }
.center { text-align: center; }
.mt0 { margin-top: 0; } .mb0 { margin-bottom: 0; } .mb8 { margin-bottom: 8px; } .mb16 { margin-bottom: 16px; }

/* --- Connexion ------------------------------------------------------------ */

.auth-page { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px 16px;
  background: linear-gradient(160deg, var(--navy) 0%, var(--navy-deep) 55%, #121a3d 100%); }
.auth-card { width: 100%; max-width: 420px; background: #fff; border-radius: 14px; padding: 28px 24px; box-shadow: 0 20px 60px rgba(0,0,0,.28); }
.auth-card .logo { display: block; width: 92px; height: 92px; margin: 0 auto 14px; border-radius: 50%; }
.auth-card h1 { text-align: center; font-size: 1.3rem; margin-bottom: 4px; }
.auth-card .sub { text-align: center; color: var(--muted); font-size: .9rem; margin-bottom: 20px; }
.auth-card input { text-align: center; }
.auth-card input[name=code] { text-transform: uppercase; letter-spacing: .25em; font-size: 1.3rem; font-weight: 700; font-family: ui-monospace, Menlo, Consolas, monospace; }

@media (max-width: 820px) {
  .admin-shell { display: block; }
  .sidebar { width: 100%; flex: none; padding-bottom: 12px; }
  .sidebar nav { display: flex; flex-wrap: wrap; gap: 2px; padding: 0 10px; }
  .sidebar nav a { border-left: none; border-bottom: 3px solid transparent; border-radius: 6px; padding: 8px 12px; }
  .sidebar nav a.active { border-left: none; border-bottom-color: var(--gold); }
  .sidebar .nav-group { display: none; }
  .content { padding: 16px; }
}

.narrow { max-width: 560px; }
.wide { max-width: 100%; }
.stack > * + * { margin-top: 12px; }
.inline-form { display: inline; }
.sig-thumb { height: 34px; border: 1px solid var(--line); border-radius: 4px; background: #fff; }
.row-actions { display: flex; gap: 5px; flex-wrap: wrap; }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 4px 16px; font-size: .92rem; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; font-weight: 600; }

/* --- Annuaire : vignettes et fiches --------------------------------------- */
.avatar { width: 38px; height: 38px; border-radius: 50%; object-fit: cover; display: block; background: #eef1f6; }
.avatar-empty { display: flex; align-items: center; justify-content: center; font-size: .78rem; font-weight: 700; color: var(--muted); }
.avatar-lg { width: 120px; height: 120px; font-size: 2rem; }
.profile-head { display: flex; gap: 20px; align-items: flex-start; flex-wrap: wrap; }
.chip-list { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 999px;
  background: #eef2fb; border: 1px solid var(--line); font-size: .82rem; color: var(--navy); }
.skill-picker { max-height: 260px; overflow-y: auto; border: 1px solid var(--line); border-radius: 8px; padding: 10px; background: #fff; }
.skill-group + .skill-group { margin-top: 12px; }
.skill-group h4 { margin: 0 0 6px; font-size: .78rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.skill-group label { display: inline-flex; align-items: center; gap: 6px; margin: 0 10px 6px 0; font-size: .88rem; }
.mini-bar { height: 8px; background: #e6eaf3; border-radius: 999px; overflow: hidden; }
.mini-bar span { display: block; height: 100%; background: var(--gold); border-radius: 999px; }
.preview-box { background: #f7f9fd; border: 1px solid var(--line); border-radius: 8px; padding: 12px 14px; white-space: pre-wrap; font-size: .92rem; }
.profile-main { flex: 1; min-width: 260px; }
