/* SEB - habillage « registre de comptes contemporain »
   Chargé après style.css. Pour revenir à l'ancien aspect, retirer la ligne theme.css dans inc/layout.php. */

:root {
  --paper: #f6f3ec;
  --paper-2: #eee9dc;
  --ink: #1c2524;
  --ink-2: #4a5654;
  --muted: #6b7775;
  --line: #e2dccd;
  --gold: #c8963e;
  --gold-soft: #f7ecd4;
  --brand-deep: color-mix(in srgb, var(--brand) 68%, #000);
  --radius: 14px;
  --shadow: 0 1px 0 rgba(255,255,255,.8) inset, 0 1px 2px rgba(48,40,20,.06), 0 10px 26px -14px rgba(48,40,20,.22);
  --font-display: 'Philosopher', Georgia, 'Times New Roman', serif;
  --ease: cubic-bezier(.2,.7,.2,1);
}

html { font-size: 14px; }
@media (max-width: 960px) { html { font-size: 14.5px; } }
body {
  background-color: var(--paper);
  background-image: linear-gradient(rgba(60,50,20,.028) 1px, transparent 1px);
  background-size: 100% 30px;
  color: var(--ink);
  letter-spacing: .005em;
}
::selection { background: var(--gold-soft); color: var(--ink); }
:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; border-radius: 6px; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--ink); color: #fff; padding: 8px 14px; border-radius: 8px; z-index: 100; }
.skip:focus { left: 8px; }

/* ---------- Menu latéral ---------- */
.sidebar {
  position: sticky;
  background:
    radial-gradient(900px 380px at -20% -8%, color-mix(in srgb, var(--brand) 55%, #fff) 0%, transparent 60%),
    linear-gradient(180deg, var(--brand) 0%, var(--brand-deep) 100%);
  box-shadow: 4px 0 24px -12px rgba(0,0,0,.5);
  width: 272px;
}
.sidebar::before {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background-image: radial-gradient(rgba(255,255,255,.075) 1px, transparent 1.3px);
  background-size: 15px 15px;
}
.sidebar > * { position: relative; }
.brand { font-family: var(--font-display); font-size: 1.45rem; letter-spacing: .03em; padding: 24px 22px 18px; }
.brand-mark { background: var(--gold); color: #2a2108; border-radius: 50%; font-size: 1.35rem; font-weight: 700; box-shadow: 0 0 0 4px rgba(255,255,255,.12); }
.nav-group { font-size: .68rem; letter-spacing: .16em; text-transform: uppercase; color: rgba(255,255,255,.5); padding: 16px 14px 5px; font-weight: 700; }
.sidebar nav a { padding: 10px 14px; border-radius: 10px; font-size: .98rem; transition: background .18s, transform .18s; }
.sidebar nav a:hover { background: rgba(255,255,255,.1); transform: translateX(2px); }
.sidebar nav a.active { background: rgba(255,255,255,.14); color: #fff; font-weight: 600; box-shadow: inset 3px 0 0 var(--gold); }
.side-user { background: rgba(0,0,0,.14); }
.logout { border-radius: 10px; transition: background .18s; }

/* ---------- En-tête de page ---------- */
.topbar { padding: 24px 32px 4px; align-items: flex-end; flex-wrap: wrap; }
.topbar h1 { font-family: var(--font-display); font-size: 1.6rem; font-weight: 700; letter-spacing: .01em; color: var(--ink); position: relative; }
.topbar h1::after { content: ""; display: block; width: 46px; height: 3px; background: var(--gold); border-radius: 3px; margin-top: 4px; }
.ex-sel { border: 1px solid var(--line); box-shadow: var(--shadow); border-radius: 99px; padding: 5px 14px; }
.ex-sel select { border: 0; background: transparent; padding: 3px 4px; font-weight: 700; color: var(--brand); }
.page { padding: 20px 32px 60px; max-width: 1220px; }
.burger { border: 1px solid var(--line); }

/* ---------- Cartes ---------- */
.card { border: 1px solid var(--line); box-shadow: var(--shadow); border-radius: var(--radius); }
.card > h2:first-child, .card h2 { font-family: var(--font-display); font-size: 1.2rem; letter-spacing: .01em; }
h2, h3 { font-family: var(--font-display); letter-spacing: .01em; }
.muted { color: var(--muted); }

/* Bandeau d'accueil */
.hello { display: flex; justify-content: space-between; align-items: center; gap: 18px; flex-wrap: wrap; margin-bottom: 22px; padding: 22px 26px; border-radius: 18px; color: #fff; position: relative; overflow: hidden;
  background: radial-gradient(600px 220px at 100% 0%, rgba(200,150,62,.38), transparent 70%), linear-gradient(120deg, var(--brand), var(--brand-deep)); box-shadow: 0 18px 36px -22px var(--brand); }
.hello::after { content: ""; position: absolute; inset: 0; background-image: radial-gradient(rgba(255,255,255,.09) 1px, transparent 1.3px); background-size: 14px 14px; pointer-events: none; }
.hello > * { position: relative; z-index: 1; }
.hello .k { font-size: .95rem; letter-spacing: .08em; text-transform: uppercase; opacity: .8; }
.hello h2 { font-family: var(--font-display); font-size: 1.7rem; color: #fff; margin: 2px 0 4px; }
.hello p { margin: 0; opacity: .85; }
.hello .btn { background: var(--gold); color: #2a2108; box-shadow: 0 8px 18px -8px rgba(0,0,0,.5); }
.hello .btn:hover { background: #d8a64d; }

/* ---------- Indicateurs ---------- */
.stat { border: 1px solid var(--line); border-left: 1px solid var(--line); border-top: 4px solid var(--brand); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px 20px 16px; position: relative; overflow: hidden; transition: transform .25s var(--ease), box-shadow .25s; }
.stat::after { content: ""; position: absolute; right: -26px; top: -26px; width: 90px; height: 90px; border-radius: 50%; background: radial-gradient(circle, color-mix(in srgb, var(--brand) 12%, transparent), transparent 70%); }
.stat:hover { transform: translateY(-3px); box-shadow: 0 18px 30px -18px rgba(48,40,20,.35); }
.stat.good { border-top-color: var(--ok); } .stat.bad { border-top-color: var(--bad); } .stat.warn { border-top-color: var(--gold); }
.stat .label { font-size: .86rem; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); font-weight: 600; }
.stat .value { font-family: var(--font-display); font-size: 1.55rem; font-weight: 700; margin-top: 6px; line-height: 1.1; }

/* ---------- Tuiles d'action ---------- */
.tiles { gap: 16px; }
.tile { border: 1px solid var(--line); box-shadow: var(--shadow); border-radius: 16px; padding: 16px 18px; position: relative; overflow: hidden; transition: transform .25s var(--ease), box-shadow .25s, border-color .25s; }
.tile::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--brand); opacity: 0; transition: opacity .25s; }
.tile:hover { transform: translateY(-3px); border-color: var(--gold); box-shadow: 0 18px 30px -18px rgba(48,40,20,.4); }
.tile:hover::before { opacity: 1; background: var(--gold); }
.tile .emo { border-radius: 16px; width: 56px; height: 56px; box-shadow: inset 0 0 0 1px rgba(0,0,0,.04); }
.tile small { font-weight: 400; color: var(--muted); }
.tile.in::before { background: var(--ok); } .tile.out::before { background: var(--bad); }

/* ---------- Boutons ---------- */
.btn { border-radius: 12px; letter-spacing: .01em; transition: transform .18s var(--ease), box-shadow .18s, background .18s; box-shadow: 0 1px 0 rgba(255,255,255,.22) inset, 0 6px 14px -8px color-mix(in srgb, var(--brand) 80%, #000); }
.btn:hover { transform: translateY(-1px); box-shadow: 0 1px 0 rgba(255,255,255,.22) inset, 0 12px 20px -10px color-mix(in srgb, var(--brand) 80%, #000); }
.btn:active { transform: translateY(0); }
.btn.secondary { background: #fffdf8; border-color: color-mix(in srgb, var(--brand) 55%, #fff); box-shadow: none; }
.btn.secondary:hover { background: var(--brand-soft); }
.btn.ghost { box-shadow: none; }
.btn.danger { box-shadow: 0 6px 14px -8px var(--bad); }

/* ---------- Formulaires ---------- */
label { color: var(--ink-2); font-size: .95rem; }
input[type=text], input[type=password], input[type=email], input[type=number], input[type=date], select, textarea {
  border: 1.5px solid #d6cfbe; background: #fffdf8; border-radius: 12px; transition: border-color .15s, box-shadow .15s, background .15s; }
input:hover, select:hover, textarea:hover { border-color: #bdb399; }
input:focus, select:focus, textarea:focus { outline: 0; border-color: var(--brand); box-shadow: 0 0 0 4px color-mix(in srgb, var(--brand) 18%, transparent); background: #fff; }
.amount-input { font-family: var(--font-display); font-size: 1.4rem !important; letter-spacing: .02em; }
.choice label { border-radius: 12px; border-color: #d6cfbe; background: #fffdf8; transition: border-color .15s, background .15s, transform .15s; }
.choice label:hover { transform: translateY(-1px); border-color: var(--brand); }
.field .hint { color: var(--muted); }

/* ---------- Tableaux « registre » ---------- */
table.t th { background: transparent; color: var(--ink-2); border-bottom: 2px solid var(--ink); font-size: .74rem; letter-spacing: .12em; }
table.t td { border-bottom: 1px dotted #cdc5b0; }
table.t tbody tr { transition: background .15s; }
table.t tr:hover td { background: #fbf6e9; }
table.t tfoot td { background: var(--paper-2); border-top: 2px solid var(--ink); }
td.in { color: #0f7a55; } td.out { color: #b0261b; }
.table-wrap { border-radius: 10px; }

/* ---------- Étiquettes et messages ---------- */
.badge { letter-spacing: .02em; }
.badge.brand { background: color-mix(in srgb, var(--brand) 12%, #fff); }
.alert { border-radius: 14px; border-width: 1px; box-shadow: 0 6px 16px -12px rgba(0,0,0,.4); animation: rise .45s var(--ease) both; }
.alert-info { background: var(--gold-soft); border-color: #ecd9ad; color: #5d4513; }
.steps span { border-radius: 99px; }
.filters { background: var(--paper); border: 1px dashed #d6cfbe; border-radius: 14px; padding: 14px 16px; }
.pager a, .pager span { border-radius: 10px; }

/* ---------- Barre de navigation mobile ---------- */
.bottomnav { display: none; }
@media (max-width: 960px) {
  .bottomnav { display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 40; background: rgba(255,253,248,.94); backdrop-filter: blur(10px); border-top: 1px solid var(--line); padding: 6px 6px calc(6px + env(safe-area-inset-bottom)); box-shadow: 0 -10px 24px -16px rgba(0,0,0,.35); }
  .bottomnav a { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; text-decoration: none; color: var(--ink-2); font-size: .7rem; padding: 6px 2px; border-radius: 12px; font-weight: 600; }
  .bottomnav a .ico { font-size: 1.35rem; line-height: 1.2; }
  .bottomnav a.active { color: var(--brand); background: color-mix(in srgb, var(--brand) 10%, transparent); }
  .bottomnav a.plus { color: #2a2108; }
  .bottomnav a.plus .ico { background: var(--gold); border-radius: 50%; width: 46px; height: 46px; display: grid; place-items: center; margin-top: -22px; box-shadow: 0 8px 16px -6px rgba(0,0,0,.45); font-size: 1.4rem; }
  .page { padding-bottom: 110px; }
  .topbar { padding: 16px 16px 2px; }
  .topbar h1 { font-size: 1.55rem; }
  .sidebar { width: 280px; }
  .hello { padding: 18px; } .hello h2 { font-size: 1.6rem; }
}

/* ---------- Connexion en deux volets ---------- */
body.bare { background: var(--paper); }
.bare-main:has(.auth) { display: block; padding: 0; }
body.bare .bare-main { width: 100%; }
.auth { width: 100%; display: grid; grid-template-columns: 1.1fr 1fr; min-height: 100vh; }
.auth-brand { position: relative; color: #fff; padding: 56px 60px; display: flex; flex-direction: column; justify-content: space-between; overflow: hidden;
  background: radial-gradient(700px 420px at 105% 0%, rgba(200,150,62,.45), transparent 65%), linear-gradient(160deg, var(--brand), var(--brand-deep)); }
.auth-brand::before { content: ""; position: absolute; inset: 0; background-image: radial-gradient(rgba(255,255,255,.09) 1px, transparent 1.4px); background-size: 16px 16px; }
.auth-brand > * { position: relative; }
.auth-brand .mark { width: 58px; height: 58px; border-radius: 50%; background: var(--gold); color: #2a2108; display: grid; place-items: center; font-family: var(--font-display); font-size: 1.9rem; font-weight: 700; box-shadow: 0 0 0 6px rgba(255,255,255,.12); }
.auth-brand h2 { font-family: var(--font-display); font-size: 2.7rem; line-height: 1.12; margin: 26px 0 10px; color: #fff; max-width: 14ch; }
.auth-brand p { opacity: .85; max-width: 38ch; margin: 0; }
.auth-brand ul { list-style: none; padding: 0; margin: 28px 0 0; display: grid; gap: 12px; }
.auth-brand li { display: flex; align-items: center; gap: 12px; font-size: 1.02rem; }
.auth-brand li span { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 10px; background: rgba(255,255,255,.14); }
.auth-brand small { color: rgba(255,255,255,.65); }
.auth-form { display: grid; place-items: center; padding: 30px; }
.login-box { box-shadow: var(--shadow); border: 1px solid var(--line); background: #fffdf8; max-width: 410px; animation: rise .6s var(--ease) both; }
.login-box h1 { font-family: var(--font-display); font-size: 1.9rem; }
@media (max-width: 860px) { .auth { grid-template-columns: 1fr; } .auth-brand { padding: 30px 26px; min-height: 0; } .auth-brand h2 { font-size: 1.9rem; margin-top: 16px; } .auth-brand ul { display: none; } }

/* ---------- Apparitions progressives ---------- */
@keyframes rise { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
.page > .card, .page > .hello, .page > .grid, .page > .tiles, .page > h2, .page > .filters, .page > .btn-row, .page > .steps, .page > form > .card, .page > p { animation: rise .55s var(--ease) both; }
.page > :nth-child(2) { animation-delay: .05s; } .page > :nth-child(3) { animation-delay: .1s; } .page > :nth-child(4) { animation-delay: .15s; } .page > :nth-child(5) { animation-delay: .2s; }
.grid > .stat { animation: rise .55s var(--ease) both; }
.grid > .stat:nth-child(2) { animation-delay: .06s; } .grid > .stat:nth-child(3) { animation-delay: .12s; } .grid > .stat:nth-child(4) { animation-delay: .18s; }
.tiles > .tile { animation: rise .5s var(--ease) both; }
.tiles > .tile:nth-child(2) { animation-delay: .04s; } .tiles > .tile:nth-child(3) { animation-delay: .08s; } .tiles > .tile:nth-child(4) { animation-delay: .12s; }
.tiles > .tile:nth-child(5) { animation-delay: .16s; } .tiles > .tile:nth-child(6) { animation-delay: .2s; } .tiles > .tile:nth-child(n+7) { animation-delay: .24s; }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }

/* ---------- Impression : on ne garde que le contenu ---------- */
@media print {
  body { background: #fff !important; background-image: none !important; }
  .bottomnav, .skip, .hello::after { display: none !important; }
  .page > *, .grid > .stat, .tiles > .tile { animation: none !important; }
}

/* ---------- Tous appareils (téléphone Android, tablette, ordinateur) ---------- */
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body { overflow-x: hidden; -webkit-tap-highlight-color: rgba(15,76,92,.15); }
a, button, label, select, summary { touch-action: manipulation; }
img { max-width: 100%; height: auto; }
.table-wrap { -webkit-overflow-scrolling: touch; }
.split { display: grid; grid-template-columns: 2fr 1fr; gap: 16px; align-items: start; }
.split > * { min-width: 0; }
@media screen { .print-sheet, .pg { overflow-x: auto; } }

@media (max-width: 960px) {
  .split { grid-template-columns: 1fr; }
  .topbar { gap: 10px; }
  .ex-sel { margin-left: auto; }
  .sidebar { overflow-y: auto; -webkit-overflow-scrolling: touch; height: 100dvh; }
  .sidebar nav a { padding: 13px 14px; }
}
@media (max-width: 620px) {
  /* champs lisibles sans zoom automatique et zones tactiles de 44 px minimum */
  input[type=text], input[type=password], input[type=email], input[type=number], input[type=date], input[type=search], select, textarea { font-size: 16px; min-height: 46px; }
  .btn { min-height: 46px; }
  .btn.small { min-height: 40px; padding: 8px 14px; }
  .btn-row { flex-direction: column; align-items: stretch; }
  .btn-row .btn, .btn-row form, .btn-row form .btn { width: 100%; }
  .filters { flex-direction: column; align-items: stretch; }
  .filters > * { width: 100%; }
  .filters .field, .filters select, .filters input { width: 100%; }
  .choice label { flex: 1 1 100%; padding: 12px 14px; }
  .tiles { grid-template-columns: 1fr !important; }
  .stat .value { font-size: 1.35rem; }
  .amount-input { font-size: 1.3rem !important; }
  .page { padding-left: 12px; padding-right: 12px; }
  .card { padding: 14px; border-radius: 12px; }
  table.t { font-size: .9rem; }
  table.t th, table.t td { padding: 9px 8px; }
  .pager { flex-wrap: wrap; }
  .login-box { margin: 0 auto; }
  .hello .btn { width: 100%; }
  .pg { padding: 6mm 4mm !important; }
  .print-sheet { padding: 10px; }
  .sig-grid > div { flex-basis: 100%; }
}
/* Téléphone en mode paysage : barre du bas plus basse */
@media (max-height: 460px) and (orientation: landscape) { .bottomnav a { flex-direction: row; justify-content: center; gap: 6px; } .bottomnav a.plus .ico { margin-top: 0; width: 34px; height: 34px; } }

/* Menu coulissant sur téléphone et tablette (remplace le menu fixe du bureau) */
@media (max-width: 960px) {
  .sidebar { position: fixed; left: -300px; top: 0; bottom: 0; z-index: 60; width: 280px; transition: left .22s var(--ease); }
  .sidebar.open { left: 0; box-shadow: 0 0 0 100vmax rgba(0,0,0,.45); }
  .content { width: 100%; min-width: 0; margin-left: 0; }
  .layout { display: block; }
}

/* ---------- Menu Exporter (Excel, Word, PDF) ---------- */
.exp { position: relative; }
.exp-menu { position: absolute; right: 0; top: calc(100% + 6px); z-index: 70; min-width: 210px; background: #fffdf8; border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 18px 36px -14px rgba(0,0,0,.35); padding: 6px; }
.exp-menu[hidden] { display: none; }
.exp-menu button { display: block; width: 100%; text-align: left; border: 0; background: transparent; padding: 11px 12px; border-radius: 8px; font: inherit; color: var(--ink); cursor: pointer; }
.exp-menu button:hover { background: var(--brand-soft); }
.topbar { gap: 10px; }
.topbar .exp { margin-left: auto; }
.topbar .exp + .ex-sel { margin-left: 0; }

/* ---------- Menu masquable sur ordinateur ---------- */
.burger { align-items: center; justify-content: center; }
@media (min-width: 961px) {
  .burger { display: inline-flex; margin-right: 6px; }
  html.nav-off .sidebar { display: none; }
  html.nav-off .page { max-width: 1480px; }
}