/* Gestion Commerciale — design repris de l'ancien Link Store (fond clair, tuiles colorées, connexion bleu nuit) */
:root {
  --bg: #f5f7fb;
  --navy: #0f2840;
  --sidebar: #1f2a40;
  --text: #212529;
  --muted: #6c757d;
  --border: #e3e7ef;
  --primary: #1773ea;
  --danger: #dc3545;
  --success: #33cc33;
  --info: #0dcaf0;
  --mauve: #874e68;
  --radius: 10px;
  --shadow: 0 6px 18px rgba(31, 42, 64, .08);
  font-family: "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { color: var(--text); font-size: 16px; }
a { color: inherit; text-decoration: none; }
button { font: inherit; cursor: pointer; }
.ico { flex-shrink: 0; }

/* ---------- Connexion ---------- */
.auth-body { background: var(--navy); min-height: 100vh; }
.auth-wrap { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 24px 16px; gap: 16px; }
.id-company { color: #fff; font-size: 20px; display: flex; align-items: center; gap: 8px; }
.id-card { width: 100%; max-width: 400px; background: #cccccc; border-radius: var(--radius); padding: 16px; }
.id-head { background: var(--mauve); color: #fff; font-weight: 700; font-size: 17px; padding: 12px 12px; border-radius: 8px 8px 0 0; margin: 0 0 12px; }
.id-form label { display: block; color: var(--text); margin-bottom: 8px; }
.id-input { width: 100%; height: 46px; border: 1px solid #e3e3e3; border-radius: 8px; padding: 0 14px; font-size: 18px; background: #fff; outline: none; }
.id-input:focus { border-color: var(--mauve); box-shadow: 0 0 0 3px rgba(135, 78, 104, .2); }
.id-pin { letter-spacing: 8px; text-align: center; font-size: 22px; }
.id-error { color: #a61b29; background: #f8d7da; border-radius: 6px; padding: 8px 10px; margin: 10px 0 0; font-size: 14px; }

.keypad { display: grid; grid-template-columns: repeat(3, 1fr) 1.45fr; grid-auto-rows: 58px; gap: 10px; margin: 18px 0; }
.keypad button { border: none; border-radius: 6px; background: #f8f9fa; font-size: 24px; color: var(--text); transition: transform .08s, filter .15s; }
.keypad button:hover { filter: brightness(.95); }
.keypad button:active { transform: scale(.96); }
.keypad .k-clear { grid-column: 4; grid-row: span 2; background: #6c757d; color: #ffb066; }
.keypad .k-del { grid-column: 4; grid-row: span 2; background: var(--danger); color: #fff; font-size: 17px; }
.keypad .k-zero { grid-column: 1 / span 3; }

.id-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.btn-cancel, .btn-ok { height: 44px; border: none; border-radius: 6px; font-size: 17px; display: inline-flex; align-items: center; justify-content: center; gap: 6px; }
.btn-cancel { background: var(--danger); color: #fff; }
.btn-ok { background: var(--info); color: #0b3d4a; }
.btn-ok:hover, .btn-cancel:hover { filter: brightness(.94); }
.id-full { grid-column: 1 / -1; margin-top: 16px; }
.id-switch button { background: none; border: none; color: #9fb3c8; font-size: 14px; text-decoration: underline; }
.id-switch button:hover { color: #fff; }
.id-error-card { text-align: center; }

/* ---------- Application ---------- */
.app-body { background: var(--bg); min-height: 100vh; }
.topbar { background: #fff; height: 70px; display: flex; align-items: center; justify-content: space-between; padding: 0 24px; border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 10; }
.brand { display: flex; align-items: center; gap: 10px; font-size: 22px; font-weight: 600; color: var(--sidebar); min-width: 0; }
.brand span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar-user { display: flex; align-items: center; gap: 12px; }
.avatar { width: 40px; height: 40px; border-radius: 50%; background: var(--sidebar); color: #fff; display: grid; place-items: center; font-weight: 600; }
.hello { display: flex; flex-direction: column; line-height: 1.2; color: var(--muted); font-size: 15px; }
.hello strong { color: var(--text); }
.hello small { font-size: 12px; }
.btn-icon { border: 1px solid var(--border); background: #fff; border-radius: 8px; width: 40px; height: 40px; display: grid; place-items: center; color: var(--muted); }
.btn-icon:hover { color: var(--danger); border-color: var(--danger); }

.page { padding: 32px 24px; max-width: 1440px; margin: 0 auto; }
/* Page affichée dans une fenêtre (ex. fiche article ouverte depuis un bon d'achat) */
.in-frame .page { padding: 16px 18px; }
.in-frame .page-head { margin-bottom: 14px; }
.in-frame .page-head .btn-back { display: none; }
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 22px 40px; }
.tile { background: var(--tile); color: #fff; border-radius: var(--radius); height: 180px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 18px; font-size: 21px; box-shadow: var(--shadow); transition: transform .15s, box-shadow .15s, filter .15s; text-align: center; padding: 0 12px; }
.tile:hover { transform: translateY(-3px); box-shadow: 0 10px 24px rgba(31, 42, 64, .16); filter: brightness(1.04); }
.tile[href$="/aujourdhui"] { color: #212529; }
.tiles-sm { grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 20px; }
.tiles-sm .tile { height: 150px; font-size: 19px; gap: 14px; }

.page-head { display: flex; align-items: center; gap: 18px; margin-bottom: 26px; flex-wrap: wrap; }
.page-head h1 { margin: 0; font-size: 24px; font-weight: 600; display: flex; align-items: center; gap: 10px; color: var(--sidebar); }
.btn-back { display: inline-flex; align-items: center; gap: 6px; background: #fff; border: 1px solid var(--border); border-radius: 8px; padding: 8px 14px; color: var(--text); font-size: 15px; }
.btn-back:hover { border-color: var(--primary); color: var(--primary); }

.panel { background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); padding: 24px; }
.empty { text-align: center; padding: 56px 24px; }
.empty h2 { margin: 16px 0 6px; font-size: 21px; font-weight: 600; }
.empty p { color: var(--muted); margin: 0 0 18px; }
.empty-ico { width: 84px; height: 84px; border-radius: 50%; display: inline-grid; place-items: center; background: var(--tile); color: #fff; }
.err-code { font-size: 64px; font-weight: 700; color: var(--primary); line-height: 1; }

/* ---------- Messages ---------- */
.toasts { position: fixed; top: 16px; right: 16px; display: flex; flex-direction: column; gap: 8px; z-index: 100; max-width: calc(100% - 32px); }
.toast { background: #fff; border-left: 4px solid var(--primary); border-radius: 6px; box-shadow: var(--shadow); padding: 12px 16px; display: flex; flex-direction: column; gap: 2px; min-width: 240px; transition: opacity .4s; }
.toast-error { border-left-color: var(--danger); }
.toast-success { border-left-color: var(--success); }
.toast span { color: var(--muted); font-size: 14px; }

@media (max-width: 640px) {
  .topbar { padding: 0 16px; }
  .hello { display: none; }
  .page { padding: 20px 16px; }
  .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
  .tile { height: 130px; font-size: 16px; gap: 10px; }
  .tile .ico { width: 38px; height: 38px; }
}

/* Accès support depuis le panel Manager */
.support-bar { background: #fff3cd; color: #664d03; border-bottom: 1px solid #ffe69c; padding: 8px 24px; font-size: 14px; display: flex; align-items: center; gap: 8px; }
/* Grand message des alertes : familles cliquables ; rubrique Alertes : famille choisie */
.al-pop-fam { display: flex; justify-content: space-between; align-items: center; width: 100%; gap: 10px; padding: 0; border: 0; background: none; color: inherit; font: inherit; text-align: left; cursor: pointer; }
.al-pop-fam:hover span, .al-pop-fam:focus-visible span { color: var(--primary); text-decoration: underline; }
.al-chip.on { outline: 2px solid var(--primary); background: #e7f1ff; }
/* Logo de la société (Paramètres → Société) : barre du haut et page PIN */
.brand-logo { height: 38px; max-width: 120px; object-fit: contain; }
.id-logo { display: block; max-width: 180px; max-height: 90px; margin: 0 auto 10px; padding: 8px 12px; border-radius: 12px; background: #fff; object-fit: contain; }
/* Page PIN : code de sécurité (captcha en chiffres, tapé au pavé) */
.id-cap-label { margin-top: 12px; }
.id-captcha { display: grid; grid-template-columns: auto 46px 1fr; gap: 8px; align-items: center; margin-bottom: 12px; }
.id-captcha img { height: 54px !important; }
.id-captcha .id-cap-new, .id-input.id-cap { height: 54px; }
.id-captcha img { display: block; height: 46px; width: auto; border-radius: 8px; }
.id-cap-new { height: 46px; border: 1px solid #e3e3e3; border-radius: 8px; background: #fff; color: var(--text); display: grid; place-items: center; }
.id-input.id-cap { height: 46px; letter-spacing: 4px; text-align: center; font-weight: 700; }
.id-input.id-active { box-shadow: 0 0 0 3px rgba(23, 115, 234, .35); }
@media (max-width: 380px) { .id-captcha { grid-template-columns: 1fr 46px; } .id-captcha .id-cap { grid-column: 1 / -1; } }
.id-input.id-cap::placeholder { text-transform: none; letter-spacing: 0; font-weight: 400; }
