/* Portail bulletins de paie — les couleurs de l'entité viennent de /theme.css */
:root {
  --brand: #1F4E8C; --brand-dark: #14335b; --brand-soft: #e9eef6; --accent: #E8A33D;
  --ink: #18202f; --ink-2: #4a5468; --muted: #6b7486; --line: #e3e7ee;
  --bg: #f5f7fb; --card: #ffffff;
  --ok: #1d7a4f; --ok-bg: #e7f6ee; --err: #b42318; --err-bg: #fdecea; --info-bg: #eaf1fb;
  --radius: 14px; --shadow: 0 1px 2px rgba(16,24,40,.05), 0 8px 24px rgba(16,24,40,.06);
  --font: "Segoe UI Variable", "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { font: 15px/1.55 var(--font); color: var(--ink); background: var(--bg); -webkit-font-smoothing: antialiased; }
a { color: var(--brand); text-underline-offset: 3px; }
a:hover { color: var(--brand-dark); }
h1, h2, h3 { line-height: 1.2; margin: 0 0 .4em; letter-spacing: -.01em; }
.muted { color: var(--muted); }
.small { font-size: 13.5px; }
.center { text-align: center; }
img { max-width: 100%; }

/* ---------- Boutons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 1px solid transparent;
  border-radius: 10px; padding: 10px 18px; font: 600 14.5px var(--font); cursor: pointer; text-decoration: none;
  transition: background .15s, box-shadow .15s, transform .05s, border-color .15s; white-space: nowrap; }
.btn:active { transform: translateY(1px); }
.btn:focus-visible, input:focus-visible, a:focus-visible { outline: 3px solid color-mix(in srgb, var(--brand) 35%, transparent); outline-offset: 2px; }
.btn-primary { background: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-dark); color: #fff; }
.btn-accent { background: var(--accent); color: #1b1300; }
.btn-accent:hover { filter: brightness(.95); color: #1b1300; }
.btn-outline { background: #fff; color: var(--ink-2); border-color: var(--line); }
.btn-outline:hover { border-color: var(--brand); color: var(--brand); }
.btn-ghost { background: transparent; color: var(--ink-2); }
.btn-ghost:hover { background: var(--brand-soft); color: var(--brand-dark); }
.btn-block { width: 100%; padding: 12px 18px; }
.btn-sm { padding: 8px 14px; font-size: 13.5px; }

/* ---------- Formulaires ---------- */
.form { display: grid; gap: 16px; margin: 20px 0 16px; }
.field { display: grid; gap: 6px; }
.field > span:first-child { font-weight: 600; font-size: 13.5px; color: var(--ink-2); }
input[type=email], input[type=password], input[type=text] { width: 100%; padding: 12px 14px; font: 15px var(--font);
  border: 1px solid var(--line); border-radius: 10px; background: #fff; color: var(--ink); transition: border-color .15s, box-shadow .15s; }
input:focus { border-color: var(--brand); box-shadow: 0 0 0 4px color-mix(in srgb, var(--brand) 14%, transparent); outline: none; }
.pw-wrap { position: relative; display: block; }
.pw-wrap input { padding-right: 46px; }
.pw-toggle { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); border: 0; background: none;
  color: var(--muted); padding: 8px; border-radius: 8px; cursor: pointer; display: flex; }
.pw-toggle:hover, .pw-toggle.on { color: var(--brand); background: var(--brand-soft); }
.meter { height: 5px; background: var(--line); border-radius: 99px; overflow: hidden; display: block; }
.meter-bar { display: block; height: 100%; width: 0; border-radius: 99px; transition: width .25s, background .25s; }
.meter-label { color: var(--muted); min-height: 1em; }
.rules { margin: 0; padding: 12px 14px 12px 32px; background: var(--bg); border-radius: 10px; color: var(--ink-2); font-size: 13px; }

/* ---------- Alertes ---------- */
.alert { padding: 11px 14px; border-radius: 10px; margin: 12px 0; font-size: 14px; border-left: 4px solid; }
.alert-error { background: var(--err-bg); color: var(--err); border-color: var(--err); }
.alert-success { background: var(--ok-bg); color: var(--ok); border-color: var(--ok); }
.alert-info { background: var(--info-bg); color: var(--brand-dark); border-color: var(--brand); }

/* ---------- Pages de connexion ---------- */
.auth-grid { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); }
.auth-brand { position: relative; overflow: hidden; color: #fff; padding: 56px 64px 32px; display: flex; flex-direction: column;
  justify-content: space-between; background:
    radial-gradient(1200px 500px at -10% 110%, color-mix(in srgb, var(--accent) 35%, transparent), transparent 60%),
    radial-gradient(700px 400px at 110% -10%, rgba(255,255,255,.14), transparent 60%),
    linear-gradient(150deg, var(--brand) 0%, var(--brand-dark) 100%); }
.auth-brand::after { content: ""; position: absolute; inset: 0; pointer-events: none; opacity: .09;
  background-image: linear-gradient(rgba(255,255,255,.9) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.9) 1px, transparent 1px);
  background-size: 44px 44px; mask-image: linear-gradient(160deg, #000 10%, transparent 70%); }
.auth-brand-inner { position: relative; z-index: 1; max-width: 520px; margin: auto 0; }
.brand-logo { display: inline-flex; background: #fff; border-radius: 18px; padding: 16px 22px; box-shadow: 0 12px 30px rgba(0,0,0,.18); margin-bottom: 36px; }
.brand-logo img { height: 56px; width: auto; display: block; }
.auth-brand h1 { font-size: clamp(28px, 3.2vw, 40px); font-weight: 700; }
.auth-brand .lead { font-size: 17px; opacity: .9; max-width: 440px; margin: 0 0 36px; }
.trust { list-style: none; padding: 0; margin: 0; display: grid; gap: 14px; }
.trust li { display: flex; gap: 14px; align-items: center; background: rgba(255,255,255,.09); border: 1px solid rgba(255,255,255,.15);
  border-radius: 12px; padding: 12px 16px; backdrop-filter: blur(4px); }
.trust svg { width: 26px; height: 26px; fill: var(--accent); flex: none; }
.trust b { display: block; font-size: 14.5px; }
.trust span { font-size: 13.5px; opacity: .92; }
.auth-foot { position: relative; z-index: 1; font-size: 12.5px; opacity: .7; margin: 32px 0 0; }
.auth-panel { display: flex; align-items: center; justify-content: center; padding: 40px 24px; background: var(--bg); }
.auth-card { width: 100%; max-width: 420px; background: var(--card); border-radius: 20px; padding: 40px 36px; box-shadow: var(--shadow); border: 1px solid var(--line); }
.auth-card h2 { font-size: 26px; }
.mobile-logo { display: none; }

/* ---------- Application ---------- */
.container { width: 100%; max-width: 1120px; margin: 0 auto; padding: 0 24px; }
.topbar { background: #fff; border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 10; }
.topbar::before { content: ""; display: block; height: 4px; background: linear-gradient(90deg, var(--brand), var(--accent)); }
.topbar-inner { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 68px; }
.topbar-brand { display: flex; align-items: center; gap: 12px; text-decoration: none; color: var(--ink); min-width: 0; }
.topbar-brand img { height: 38px; width: auto; }
.topbar-sep { width: 1px; height: 28px; background: var(--line); }
.topbar-title { font-weight: 600; color: var(--ink-2); font-size: 15px; white-space: nowrap; }
.topbar-nav { display: flex; align-items: center; gap: 8px; }
.topbar-nav form { margin: 0; }
.who { display: flex; align-items: center; gap: 8px; margin-right: 6px; color: var(--ink-2); font-size: 13.5px; min-width: 0; }
.who-mail { max-width: 230px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.avatar { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; background: var(--brand-soft); color: var(--brand-dark); font-weight: 700; flex: none; }
.page { padding-top: 36px; padding-bottom: 40px; min-height: calc(100vh - 160px); }
.footer { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; color: var(--muted); font-size: 12.5px; padding-bottom: 28px; }
.footer .lock { display: inline-flex; gap: 6px; align-items: center; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.pad { padding: 32px; }
.narrow { max-width: 520px; margin: 0 auto; }
.h2 { font-size: 24px; }

.hero { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin-bottom: 26px; flex-wrap: wrap; }
.hero h1 { font-size: clamp(26px, 3vw, 34px); }
.hero p { margin: 0; }
.eyebrow { text-transform: uppercase; letter-spacing: .12em; font-size: 12px; font-weight: 700; color: var(--brand); margin: 0 0 6px !important; }

.years { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 22px; }
.year { padding: 8px 18px; border-radius: 99px; background: #fff; border: 1px solid var(--line); color: var(--ink-2); text-decoration: none; font-weight: 600; font-size: 14px; }
.year:hover { border-color: var(--brand); color: var(--brand); }
.year.active { background: var(--brand); border-color: var(--brand); color: #fff; box-shadow: 0 6px 14px color-mix(in srgb, var(--brand) 30%, transparent); }

.grid { list-style: none; padding: 0; margin: 0; display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); }
.doc { display: flex; flex-direction: column; gap: 16px; padding: 18px; transition: transform .15s, box-shadow .15s, border-color .15s; }
.doc:hover { transform: translateY(-2px); border-color: color-mix(in srgb, var(--brand) 35%, var(--line)); box-shadow: 0 14px 30px rgba(16,24,40,.10); }
.doc-head { display: flex; align-items: center; gap: 14px; }
.doc .btn { width: 100%; }
.doc-badge { flex: none; width: 60px; height: 64px; border-radius: 12px; display: flex; flex-direction: column; align-items: center; justify-content: center;
  background: var(--brand-soft); color: var(--brand-dark); position: relative; }
.doc-badge::after { content: ""; position: absolute; top: 0; right: 0; border-width: 0 14px 14px 0; border-style: solid;
  border-color: var(--bg) var(--bg) color-mix(in srgb, var(--brand) 25%, var(--brand-soft)) color-mix(in srgb, var(--brand) 25%, var(--brand-soft)); border-radius: 0 12px 0 4px; }
.doc-month { font-weight: 800; font-size: 15px; text-transform: uppercase; letter-spacing: .03em; }
.doc-year { font-size: 11.5px; opacity: .8; }
.doc-body { min-width: 0; flex: 1; }
.doc-body h3 { font-size: 16px; margin: 0 0 2px; }
.doc-file { margin: 0; color: var(--ink-2); font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.doc-meta { margin: 2px 0 0; color: var(--muted); font-size: 12px; }

.empty { text-align: center; padding: 56px 24px; color: var(--muted); }
.empty svg { color: var(--brand); opacity: .5; margin-bottom: 8px; }
.empty h3 { color: var(--ink); }
.error-code { font-size: 56px; font-weight: 800; color: var(--brand); margin: 0; line-height: 1; }

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
  .auth-grid { grid-template-columns: 1fr; }
  .auth-brand { display: none; }
  .mobile-logo { display: flex; justify-content: center; margin-bottom: 20px; }
  .mobile-logo img { height: 52px; }
  .auth-panel { min-height: 100vh; background: linear-gradient(180deg, var(--brand) 0 190px, var(--bg) 190px); align-items: flex-start; padding-top: 60px; }
}
@media (max-width: 640px) {
  .who, .topbar-title, .topbar-sep { display: none; }
  .topbar-nav .btn { padding: 8px 12px; font-size: 13.5px; }
  .topbar-nav { gap: 4px; }
  .grid { grid-template-columns: 1fr; }
  .auth-card { padding: 30px 22px; }
  .pad { padding: 24px; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

/* Mention « Une solution Paradisia » */
.paradisia-badge { display: inline-flex; align-items: center; gap: 8px; font-size: 12px; color: var(--muted); }
.paradisia-badge img { height: 24px; width: auto; background: #fff; border-radius: 6px; padding: 3px 6px; border: 1px solid var(--line); }
.auth-card-foot { margin: 26px 0 0; padding-top: 16px; border-top: 1px solid var(--line); text-align: center; }

/* Sélection des bulletins à télécharger en ZIP */
.selection-bar { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.check { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; font-weight: 600; color: var(--ink-2); }
.check input, .doc-check input { width: 18px; height: 18px; margin: 0; accent-color: var(--brand); cursor: pointer; }
.doc-check { flex: none; display: flex; align-items: center; padding: 4px; cursor: pointer; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.year-group { margin-bottom: 30px; scroll-margin-top: 90px; }
.year-title { display: flex; align-items: baseline; gap: 12px; font-size: 22px; margin: 0 0 14px; }
.year-title small { font-size: 13px; font-weight: 400; }
.fold { margin-left: auto; align-self: center; display: flex; padding: 6px; border: 1px solid var(--line); border-radius: 8px; background: #fff; color: var(--ink-2); cursor: pointer; }
.fold:hover { border-color: var(--brand); color: var(--brand); }
.fold svg { transition: transform .15s; }
.fold[aria-expanded="false"] svg { transform: rotate(-90deg); }
.grid[hidden] { display: none; }

/* Administration */
.h3 { font-size: 18px; }
.btn-danger { background: var(--err); color: #fff; }
.btn-danger:hover { filter: brightness(.92); color: #fff; }
.admin-cards { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); margin-bottom: 32px; align-items: start; }
.admin-cards .form { margin: 12px 0 0; }
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th, .table td { padding: 12px 16px; text-align: left; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table th { font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.table tr:last-child td { border-bottom: 0; }
.table .num { text-align: right; }
.tag { display: inline-block; padding: 1px 8px; border-radius: 99px; background: var(--brand-soft); color: var(--brand-dark); font-size: 11.5px; font-weight: 700; vertical-align: middle; }
.state { display: inline-block; padding: 2px 10px; border-radius: 99px; font-size: 12.5px; font-weight: 600; background: var(--bg); color: var(--ink-2); }
.state-actif { background: var(--ok-bg); color: var(--ok); }
.state-bloqué, .state-verrouillé { background: var(--err-bg); color: var(--err); }
.table th a { color: inherit; text-decoration: none; }
.table th a:hover { color: var(--brand); }
.mono { font-family: ui-monospace, Consolas, monospace; font-size: 13px; }
.nowrap { white-space: nowrap; }
.pager { display: flex; gap: 12px; align-items: center; justify-content: center; margin-top: 20px; }
