/* VTEX Wallet personnel — appareils connectés, protocole LEGDAY (docs/LEGDAY.md).
   Fond --c-bg ; tête d'affiche vert forêt (protection active) ; cet appareil en bleu profond,
   un autre appareil en brique ; déconnexion = action destructive, rouge (§5.4) ; historique en
   tint system + timeline pointillée (§3.2, §10). Inter seule (Mono : adresse IP). */
.wallet-devices{
  --wd-shadow:0 10px 28px -10px rgba(0,0,0,.55),inset 0 1px 0 rgba(255,255,255,.16);
  --wd-shadow-light:0 10px 28px -10px rgba(0,0,0,.45),inset 0 1px 0 rgba(255,255,255,.3);
  --wd-shadow-neutral:0 10px 28px -12px rgba(0,0,0,.5),inset 0 1px 0 rgba(255,255,255,.06);
  --wd-socle:inset 0 1px 0 rgba(255,255,255,.4),inset 0 -2px 4px rgba(0,0,0,.12),0 3px 8px -2px rgba(0,0,0,.28);
  --wd-platinum:linear-gradient(158deg,#E5E3DA 0%,#DCDAD0 55%,#CFCCC0 100%);
  /* minmax(0,1fr) : une mention qui ne passe pas à la ligne ne doit jamais élargir la page. */
  display:grid; grid-template-columns:minmax(0,1fr); gap:12px; width:100%; max-width:960px; margin:0 auto; padding:0 0 24px;
  color:var(--c-t1); font-family:var(--f-sans,'Inter',system-ui,sans-serif);
}
.wallet-devices *{ box-sizing:border-box; }
#view-appareils > .vx-header{ margin-bottom:20px; }
.wallet-devices .mono{ font-family:var(--f-mono,'JetBrains Mono',monospace); font-weight:600; }

/* Tête d'affiche */
.wd-hero{ position:relative; overflow:hidden; padding:24px; border-radius:32px; background:linear-gradient(158deg,#4C9D63 0%,#3E8B54 55%,#327044 100%); box-shadow:var(--wd-shadow-light); color:#fff; animation:wd-rise .5s cubic-bezier(.22,1,.36,1) both; }
.wd-hero-top{ display:flex; align-items:center; justify-content:space-between; gap:12px; min-width:0; }
.wd-hero-socle{ display:flex; align-items:center; justify-content:center; flex:0 0 56px; width:56px; height:56px; border-radius:50%; background:#97CE5E; color:#0a0d1e; box-shadow:var(--wd-socle); }
.wd-hero-socle svg{ width:28px; height:28px; fill:none; stroke:currentColor; stroke-width:2.3; stroke-linecap:round; stroke-linejoin:round; }
.wd-live{ display:inline-flex; align-items:center; gap:8px; padding:8px 12px 8px 8px; border-radius:999px; background:var(--wd-platinum); color:#0a0d1e; box-shadow:var(--wd-shadow-light); font:700 11px/1 var(--f-sans); letter-spacing:.12em; text-transform:uppercase; }
.wd-live i{ width:8px; height:8px; border-radius:50%; background:#E5903F; }
html[data-vtex-realtime="live"] .wd-live i{ background:#3E8B54; animation:wd-breathe 2.4s ease-in-out infinite; }
html[data-vtex-realtime="reconnecting"] .wd-live i{ background:#E5903F; animation:wd-blink 1s steps(2,end) infinite; }
.wd-hero-kicker{ margin:20px 0 8px; font:700 11px/1 var(--f-sans); letter-spacing:.12em; text-transform:uppercase; color:rgba(255,255,255,.78); }
.wd-hero-title{ margin:0; font:800 30px/1.02 var(--f-sans); letter-spacing:-.04em; color:#fff; }
.wd-hero-intro{ max-width:52ch; margin:12px 0 0; font:500 13px/1.5 var(--f-sans); color:rgba(255,255,255,.78); }

.wallet-devices__status{ min-height:20px; padding:0 4px; font:600 12px/1.45 var(--f-sans); color:var(--c-t2); }
.wallet-devices__status[data-kind="error"]{ color:#ef5a67; }
.wallet-devices__status:empty{ min-height:0; }

/* Titres de section : 28px Inter 800 (RULE 005). */
.wd-section-head{ display:flex; align-items:baseline; justify-content:space-between; gap:12px; margin-top:20px; }
.wd-section-title{ margin:0; font:800 28px/1.05 var(--f-sans); letter-spacing:-.035em; color:var(--c-t1); }
.wd-section-note{ flex:0 0 auto; min-width:0; font:700 11px/1 var(--f-sans); letter-spacing:.12em; text-transform:uppercase; color:var(--c-t3); white-space:nowrap; }
.wd-section-title{ min-width:0; }

/* Appareils : cet appareil en bleu profond, un autre en brique. */
.wallet-devices__list{ display:grid; gap:12px; }
.wallet-device{ position:relative; min-width:0; width:100%; max-width:100%; overflow:hidden; padding:20px; border-radius:32px; color:#fff; box-shadow:var(--wd-shadow); animation:wd-rise .5s .06s cubic-bezier(.22,1,.36,1) both; transition:opacity .2s ease; }
.wallet-device--current{ background:linear-gradient(158deg,#356E9C 0%,#2A5B84 55%,#22496A 100%); --wd-socle-bg:#5FA8D8; }
.wallet-device--other{ background:linear-gradient(158deg,#A04841 0%,#8E3B36 55%,#73302C 100%); --wd-socle-bg:#E5903F; }
.wallet-device[aria-busy="true"]{ opacity:.55; }
.wallet-device__top{ display:flex; align-items:center; gap:12px; min-width:0; }
.wallet-device__icon{ display:flex; align-items:center; justify-content:center; flex:0 0 44px; width:44px; height:44px; border-radius:50%; background:var(--wd-socle-bg); color:#0a0d1e; box-shadow:var(--wd-socle); }
.wallet-device__icon svg{ width:22px; height:22px; fill:none; stroke:currentColor; stroke-width:2.2; stroke-linecap:round; stroke-linejoin:round; }
.wallet-device__head{ flex:1; min-width:0; }
.wd-kicker{ display:block; font:700 11px/1 var(--f-sans); letter-spacing:.12em; text-transform:uppercase; color:rgba(255,255,255,.78); }
.wallet-device__name{ display:block; margin-top:4px; font:800 20px/1.05 var(--f-sans); letter-spacing:-.03em; color:#fff; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.wd-pill{ display:inline-flex; align-items:center; gap:8px; flex:0 0 auto; padding:4px 12px; border-radius:999px; font:700 12px/1.6 var(--f-sans); white-space:nowrap; }
.wd-pill--online{ padding-left:8px; background:var(--wd-platinum); color:#0a0d1e; box-shadow:var(--wd-shadow-light); }
.wd-pill--online i{ width:8px; height:8px; border-radius:50%; background:#3E8B54; animation:wd-breathe 2.4s ease-in-out infinite; }
.wd-pill--idle{ background:rgba(255,255,255,.16); color:#fff; }
.wallet-device__facts{ display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:12px 16px; margin:16px 0 0; padding-top:16px; box-shadow:inset 0 1px 0 rgba(255,255,255,.14); }
.wallet-device__facts div{ min-width:0; }
.wallet-device__facts dt{ font:500 12px/1.3 var(--f-sans); color:rgba(255,255,255,.78); }
.wallet-device__facts dd{ margin:4px 0 0; font:700 14px/1.3 var(--f-sans); color:#fff; overflow-wrap:anywhere; font-variant-numeric:tabular-nums; }
.wallet-device__facts dd.mono{ font-size:13px; }
/* Déconnecter : action destructive, toujours rouge (§5.4) — pill platinum à pastille rouge. */
.wallet-devices__action{ display:flex; align-items:center; justify-content:space-between; gap:8px; width:100%; margin-top:16px; padding:6px 6px 6px 20px; border:0; border-radius:999px; background:var(--wd-platinum); color:#0a0d1e; box-shadow:var(--wd-shadow-light); font:700 15px/1 var(--f-sans); cursor:pointer; transition:transform .18s cubic-bezier(.34,1.6,.4,1); }
.wallet-devices__action:active{ transform:scale(.97); }
.wallet-device__current-note{ margin:16px 0 0; padding-top:14px; border-top:1px solid rgba(255,255,255,.14); font:500 12px/1.45 var(--f-sans); color:rgba(255,255,255,.72); }
.wd-cta-dot{ display:flex; align-items:center; justify-content:center; flex:0 0 36px; width:36px; height:36px; border-radius:50%; background:linear-gradient(158deg,#E0564C 0%,#D0453C 55%,#B23A32 100%); color:#fff; box-shadow:var(--wd-socle); }
.wd-cta-dot svg{ width:16px; height:16px; fill:none; stroke:currentColor; stroke-width:2.6; stroke-linecap:round; }
.wallet-devices__refresh:focus-visible,.wallet-devices__action:focus-visible,.wallet-devices__logout:focus-visible{ outline:none; box-shadow:0 0 0 3px rgba(94,124,226,.45); }

/* États (chargement, erreur, vide) : surface neutre + socle. */
.wallet-devices__state,.wallet-devices__empty{ display:flex; align-items:center; gap:12px; padding:20px; border-radius:32px; background:var(--c-s1); box-shadow:var(--wd-shadow-neutral); }
.wallet-devices__state strong,.wallet-devices__empty strong{ display:block; font:700 15px/1.3 var(--f-sans); color:var(--c-t1); }
.wallet-devices__state p,.wallet-devices__empty p{ margin:4px 0 0; font:500 13px/1.45 var(--f-sans); color:var(--c-t2); }
.wd-state-ic{ display:flex; align-items:center; justify-content:center; flex:0 0 44px; width:44px; height:44px; border-radius:50%; background:#97CE5E; color:#0a0d1e; box-shadow:var(--wd-socle); }
.wallet-devices__state--error .wd-state-ic{ background:#E5903F; }
.wd-state-ic svg{ width:22px; height:22px; fill:none; stroke:currentColor; stroke-width:2.4; stroke-linecap:round; stroke-linejoin:round; }
.wallet-devices__spinner{ display:block; flex:0 0 44px; width:44px; height:44px; border-radius:50%; border:3px solid rgba(168,175,208,.18); border-top-color:#5FA8D8; animation:wd-spin .9s linear infinite; }

/* Historique : liste-timeline → tint system + pointillé (§3.2, §10). */
.wd-history{ padding:4px 20px; border-radius:32px; background:var(--c-s1); box-shadow:var(--wd-shadow-neutral); }
.wd-history-row{ position:relative; display:flex; align-items:center; gap:12px; padding:12px 0; }
.wd-history-row + .wd-history-row:before{ content:""; position:absolute; top:-12px; left:21px; height:24px; border-left:2px dotted rgba(168,175,208,.32); }
.wd-history-ic{ position:relative; z-index:1; display:flex; align-items:center; justify-content:center; flex:0 0 44px; width:44px; height:44px; border-radius:50%; background:rgba(239,90,103,.14); color:#ef5a67; }
.wd-history-ic svg{ width:20px; height:20px; fill:none; stroke:currentColor; stroke-width:2.2; stroke-linecap:round; stroke-linejoin:round; }
.wd-history-main{ flex:1; min-width:0; }
.wd-history-main b,.wd-history-main small{ display:block; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.wd-history-main b{ font:700 15px/1.3 var(--f-sans); letter-spacing:-.01em; color:var(--c-t1); }
.wd-history-main small{ margin-top:4px; font:500 12px/1.3 var(--f-sans); color:var(--c-t3); }
.wd-history-main small{ white-space:normal; }
.wd-history-status{ display:inline-flex; align-items:center; padding:2px 7px; border-radius:999px; background:rgba(239,90,103,.14); color:#ef5a67; font:700 10px/1.4 var(--f-sans); letter-spacing:.06em; text-transform:uppercase; vertical-align:middle; }
.wd-history-ip{ flex:0 0 auto; font-size:12px; color:var(--c-t3); }
.wd-history-empty{ margin:0; padding:16px 0; font:500 13px/1.45 var(--f-sans); color:var(--c-t2); }

/* Se déconnecter : destructif, rouge plein (§5.4). */
.wallet-devices__logout{ display:flex; align-items:center; justify-content:center; width:100%; min-height:52px; margin-top:20px; border:0; border-radius:999px; background:linear-gradient(158deg,#E0564C 0%,#D0453C 55%,#B23A32 100%); color:#fff; box-shadow:var(--wd-shadow); font:700 15px/1 var(--f-sans); cursor:pointer; transition:transform .18s cubic-bezier(.34,1.6,.4,1); }
.wallet-devices__logout:active{ transform:scale(.98); }
.wallet-devices__logout[aria-busy="true"]{ opacity:.62; cursor:wait; }

@keyframes wd-rise{ from{ opacity:0; transform:translateY(12px); } to{ opacity:1; transform:none; } }
@keyframes wd-breathe{ 0%,100%{ box-shadow:0 0 0 0 rgba(62,139,84,.55); } 50%{ box-shadow:0 0 0 6px rgba(62,139,84,0); } }
@keyframes wd-blink{ 50%{ opacity:.45; } }
@keyframes wd-spin{ to{ transform:rotate(360deg); } }
#view-appareils:not(.active) *{ animation-play-state:paused !important; }
/* Desktop : bento (§17) — la tête d'affiche à gauche, l'appareil connecté à droite, l'historique dessous ;
   aucune card étirée en bandeau plat. */
@media (min-width:1024px){
  .wallet-devices{ grid-template-columns:minmax(0,1fr) minmax(0,1fr); grid-template-areas:"hero now" "hero list" "status status" "hhead hhead" "history history" "logout logout"; column-gap:24px; align-items:start; }
  .wd-hero{ grid-area:hero; align-self:stretch; display:flex; flex-direction:column; }
  .wd-hero-intro{ margin-top:auto; padding-top:12px; }
  .wd-head-now{ grid-area:now; margin-top:0; }
  .wallet-devices__list{ grid-area:list; }
  .wallet-devices__status{ grid-area:status; }
  .wd-head-history{ grid-area:hhead; }
  .wd-history{ grid-area:history; }
  .wallet-devices__logout{ grid-area:logout; justify-self:start; width:auto; min-width:320px; padding:0 32px; }
}
@media (prefers-reduced-motion:reduce){
  .wallet-devices *{ animation:none !important; transition:none !important; }
}
@media (max-width:520px){
  .wd-section-head{ flex-wrap:wrap; gap:4px 10px; }
  .wd-section-title{ font-size:24px; }
  .wd-section-note{ font-size:10px; letter-spacing:.08em; }
}
@media (max-width:360px){
  /* Sur les écrans les plus étroits, la date et l'état passent l'un sous
     l'autre : la carte reste dans la colonne, sans élargir la page. */
  .wallet-device{ padding:18px; }
  .wallet-device__top{ flex-wrap:wrap; }
  .wallet-device__head{ flex:1 1 calc(100% - 56px); }
  .wallet-device__facts{ grid-template-columns:minmax(0,1fr); }
}
@media (max-width:520px){
  .wd-history-row{ flex-wrap:wrap; }
  .wd-history-ip{ flex:0 0 100%; padding-left:56px; margin-top:-4px; }
}
