/* Trax Protect · refonte du tableau de bord (chargé après style.css) */
:root { --radius: 16px; --glass: rgba(18, 11, 31, .72); --ring: rgba(139, 92, 246, .35); }
body { background: radial-gradient(1000px 520px at 82% -12%, rgba(139, 92, 246, .2), transparent 60%), radial-gradient(800px 420px at -8% 105%, rgba(217, 70, 239, .1), transparent 60%), var(--bg); background-attachment: fixed; }

/* ---------- Coquille ---------- */
.shell { grid-template-columns: 284px minmax(0, 1fr); }
.side { padding: 18px 14px 16px; gap: 12px; background: linear-gradient(180deg, rgba(16, 10, 28, .98), rgba(8, 5, 14, .98)); }
.side-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.brand { font-size: 1.1rem; }
.brand img { box-shadow: 0 0 0 2px rgba(139, 92, 246, .55), 0 6px 18px rgba(139, 92, 246, .35); }
.nav-search-wrap { position: relative; display: block; }
.nav-search-wrap .ico { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); width: 16px; height: 16px; pointer-events: none; }
.nav-search { padding: 9px 12px 9px 36px !important; font-size: .88rem; border-radius: 11px !important; background: rgba(13, 8, 22, .9) !important; }
.navs { gap: 16px; padding-bottom: 6px; }
.nav-title { padding: 6px 12px 5px; font-size: .68rem; letter-spacing: .12em; color: #7a6a9c; }
nav button { padding: 9px 12px; border-radius: 11px; font-size: .92rem; font-weight: 500; position: relative; }
nav button .ico { width: 18px; height: 18px; opacity: .75; }
nav button:hover { background: rgba(190, 163, 230, .09); }
nav button:hover .ico { opacity: 1; }
nav button[aria-current="page"] { font-weight: 650; background: linear-gradient(90deg, rgba(139, 92, 246, .32), rgba(217, 70, 239, .08)); box-shadow: inset 0 0 0 1px rgba(139, 92, 246, .35); }
nav button[aria-current="page"] .ico { opacity: 1; color: #e9d5ff; }
nav button[aria-current="page"]::before { content: ""; position: absolute; left: -14px; top: 9px; bottom: 9px; width: 3px; border-radius: 0 3px 3px 0; background: var(--grad); }
.side-add { display: flex; align-items: center; gap: 8px; padding: 9px 12px; border-radius: 11px; border: 1px dashed var(--line2); color: var(--soft); font-size: .86rem; font-weight: 600; }
.side-add:hover { text-decoration: none; border-color: var(--accent); color: #fff; background: rgba(139, 92, 246, .1); }
.side-add .ico { width: 16px; height: 16px; }
.who { padding-top: 14px; }
.who span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.who a { padding: 5px 10px; border-radius: 8px; background: rgba(190, 163, 230, .08); }
.who a:hover { text-decoration: none; color: #fff; background: rgba(248, 113, 113, .2); }
.topbar, .scrim, .side-close { display: none; }

main { max-width: 1120px; padding: 34px clamp(16px, 3.5vw, 48px) 90px; margin: 0 auto; }
.page-head { margin-bottom: 26px; padding-bottom: 18px; border-bottom: 1px solid var(--line); }
.page-head h1 { font-size: 1.9rem; font-weight: 800; letter-spacing: -.03em; }
.page-head p { margin-top: 4px; }

/* ---------- Panneaux ---------- */
.panel { padding: 24px; gap: 16px; border-radius: var(--radius); background: linear-gradient(180deg, rgba(25, 16, 43, .92), rgba(16, 10, 28, .94)); border-color: rgba(57, 36, 72, .75); box-shadow: 0 1px 0 rgba(255, 255, 255, .03) inset, 0 16px 40px rgba(0, 0, 0, .35); }
.panel > h2 { font-size: 1.08rem; font-weight: 700; letter-spacing: -.01em; }
.panel > h2 + p.muted { margin-top: -8px; max-width: 70ch; }
.stat { background: linear-gradient(180deg, rgba(23, 15, 40, .8), rgba(10, 6, 18, .7)); border-radius: 14px; padding: 16px; }
.stat b { font-size: 1.6rem; font-weight: 800; }
.item { border-radius: 13px; }
.row { padding: 14px 0; }

/* ---------- Accès rapide ---------- */
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }
.tile { position: relative; display: flex; align-items: center; gap: 14px; padding: 14px 16px; text-align: left; font: inherit; color: var(--text); cursor: pointer; background: rgba(10, 6, 18, .6); border: 1px solid var(--line); border-radius: 14px; transition: transform .15s, border-color .15s, background .15s, box-shadow .15s; }
.tile:hover { transform: translateY(-2px); border-color: var(--accent); background: rgba(26, 16, 46, .9); box-shadow: 0 12px 30px rgba(139, 92, 246, .16); }
.tile-ico { width: 40px; height: 40px; display: grid; place-items: center; border-radius: 12px; flex: none; background: var(--grad); color: #fff; box-shadow: 0 8px 18px rgba(139, 92, 246, .3); }
.tile-ico .ico { width: 20px; height: 20px; opacity: 1; }
.tile-txt { display: grid; min-width: 0; } .tile-txt b { font-size: .95rem; } .tile-txt small { color: var(--muted); font-size: .8rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tile-dot { position: absolute; top: 12px; right: 12px; width: 9px; height: 9px; border-radius: 50%; background: #5b4a78; }
.tile-dot.ok { background: var(--ok); box-shadow: 0 0 0 4px rgba(52, 211, 153, .16); }

/* ---------- Formulaires ---------- */
input[type="text"], input[type="number"], input[type="url"], input[type="search"], input[type="password"], textarea { border-radius: 11px; padding: 11px 13px; background: rgba(10, 6, 18, .85); }
.btn { border-radius: 11px; }
.icon-btn { padding: 8px 10px; } .icon-btn .ico { width: 16px; height: 16px; }
.switch { width: 48px; height: 28px; } .switch span::after { top: 3px; left: 3px; width: 22px; height: 22px; } .switch input:checked + span::after { transform: translateX(20px); }
.warn-row { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 14px; padding: 12px; border: 1px solid var(--line); border-radius: 13px; background: rgba(10, 6, 18, .55); }
.panel > .warn-row:first-of-type { border-top: 1px solid var(--line); }
.warn-n { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; } .warn-n input { width: 76px; }
.warn-act { display: flex; gap: 10px; min-width: 0; } .warn-act > * { flex: 1 1 0; min-width: 0; }
.backup { gap: 14px; } .backup-id { font: 700 .85rem ui-monospace, Menlo, monospace; color: var(--accent2); background: rgba(217, 70, 239, .1); padding: 6px 10px; border-radius: 9px; }

/* ---------- Sélecteurs personnalisés ---------- */
select.ns-native { position: absolute !important; width: 1px !important; height: 1px !important; opacity: 0 !important; pointer-events: none !important; overflow: hidden; clip-path: inset(50%); padding: 0 !important; border: 0 !important; margin: -1px !important; }
.ns { position: relative; width: 100%; min-width: 0; }
.ns-compact { width: auto; min-width: 140px; }
.ns-trigger { width: 100%; display: flex; align-items: center; justify-content: space-between; gap: 10px; min-height: 44px; padding: 8px 12px; text-align: left; font: 500 .95rem var(--font); color: var(--text); cursor: pointer; background: rgba(10, 6, 18, .85); border: 1px solid var(--line2); border-radius: 11px; transition: border-color .15s, box-shadow .15s, background .15s; }
.ns-trigger:hover { border-color: #5d3f85; background: rgba(16, 10, 27, .95); }
.ns-trigger:focus-visible, .ns.open .ns-trigger { outline: 0; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(139, 92, 246, .28); }
.ns.disabled .ns-trigger { opacity: .5; cursor: not-allowed; }
.ns-value { flex: 1; min-width: 0; display: flex; align-items: center; flex-wrap: wrap; gap: 6px; }
.ns-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; }
.ns-ph { color: #7d6d9c; font-weight: 400; }
.ns-chev { width: 16px; height: 16px; flex: none; fill: none; stroke: var(--muted); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; transition: transform .2s; }
.ns.open .ns-chev { transform: rotate(180deg); stroke: var(--accent2); }
.ns-ico { fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; width: 16px; height: 16px; }
.ns-dot { width: 10px; height: 10px; border-radius: 50%; flex: none; box-shadow: 0 0 0 2px rgba(255, 255, 255, .08); }
.ns-chip { display: inline-flex; align-items: center; gap: 6px; max-width: 100%; padding: 3px 4px 3px 10px; font-size: .84rem; font-weight: 600; color: #efe6ff; background: rgba(139, 92, 246, .22); border: 1px solid rgba(139, 92, 246, .45); border-radius: 999px; }
.ns-chip > span:not(.ns-chip-x) { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ns-chip-x { display: grid; place-items: center; width: 20px; height: 20px; border-radius: 50%; cursor: pointer; background: rgba(255, 255, 255, .1); } .ns-chip-x:hover { background: rgba(248, 113, 113, .45); } .ns-chip-x .ns-ico { width: 12px; height: 12px; }
.ns-compact .ns-trigger { min-height: 40px; }

.ns-backdrop { display: none; }
.ns-pop { position: fixed; z-index: 120; display: flex; flex-direction: column; min-width: 220px; overflow: hidden; opacity: 0; transform: translateY(-4px) scale(.98); transform-origin: top; transition: opacity .12s, transform .12s; background: #150d24; border: 1px solid var(--line2); border-radius: 14px; box-shadow: 0 24px 60px rgba(0, 0, 0, .65), 0 0 0 1px rgba(139, 92, 246, .12); }
.ns-pop.in { opacity: 1; transform: none; }
.ns-head { display: none; }
.ns-search { position: relative; padding: 10px 10px 6px; }
.ns-search .ns-ico { position: absolute; left: 22px; top: 50%; transform: translateY(-35%); color: var(--muted); }
.ns-search input { padding: 9px 12px 9px 34px !important; font-size: .9rem; border-radius: 9px !important; }
.ns-list { overflow-y: auto; padding: 6px; display: grid; gap: 2px; outline: 0; scrollbar-width: thin; overscroll-behavior: contain; }
.ns-opt { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 9px; cursor: pointer; font-size: .92rem; color: var(--soft); }
.ns-opt.active { background: rgba(139, 92, 246, .2); color: #fff; }
.ns-opt[aria-selected="true"] { color: #fff; font-weight: 600; }
.ns-opt.disabled { opacity: .4; cursor: not-allowed; }
.ns-opt-text { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ns-none-opt { color: var(--muted); font-style: italic; }
.ns-tick, .ns-box { width: 18px; height: 18px; flex: none; display: grid; place-items: center; }
.ns-tick .ns-ico { color: var(--accent2); }
.ns-box { border: 1.5px solid #5d4a80; border-radius: 6px; } .ns-opt[aria-selected="true"] .ns-box { background: var(--grad); border-color: transparent; color: #fff; } .ns-box .ns-ico { width: 12px; height: 12px; stroke-width: 3; }
.ns-none { padding: 18px; text-align: center; color: var(--muted); font-size: .9rem; }
.ns-foot { display: flex; justify-content: space-between; gap: 10px; padding: 8px 10px 10px; border-top: 1px solid var(--line); }
.ns-clear, .ns-done { font: 700 .84rem var(--font); border: 0; border-radius: 9px; padding: 8px 14px; cursor: pointer; }
.ns-clear { background: transparent; color: var(--muted); } .ns-clear:hover { color: #fff; }
.ns-done { background: var(--grad); color: #fff; }
.ns-guild .ns-trigger { background: rgba(23, 15, 40, .9); font-weight: 650; }

/* ---------- Barre d'enregistrement & notifications ---------- */
.savebar { border-radius: 16px; background: rgba(20, 12, 34, .96); box-shadow: 0 18px 50px rgba(0, 0, 0, .6), 0 0 0 1px rgba(139, 92, 246, .4); }
.toast { border-radius: 12px; font-weight: 500; }

/* ---------- Téléphone et tablette ---------- */
@media (max-width: 900px) {
  .shell { display: block; }
  .topbar { position: sticky; top: 0; z-index: 40; display: flex; align-items: center; gap: 12px; padding: calc(10px + env(safe-area-inset-top, 0px)) 14px 10px; background: rgba(10, 6, 18, .88); backdrop-filter: blur(14px); border-bottom: 1px solid var(--line); }
  .tb-btn { width: 44px; height: 44px; display: grid; place-items: center; flex: none; color: #fff; cursor: pointer; background: rgba(139, 92, 246, .14); border: 1px solid var(--line2); border-radius: 12px; }
  .tb-btn .ico { width: 22px; height: 22px; }
  .tb-title { flex: 1; min-width: 0; display: grid; line-height: 1.2; } .tb-title b { font-size: 1.02rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; } .tb-title small { color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .tb-avatar { width: 34px; height: 34px; border-radius: 50%; }
  .side-close { display: grid; }
  .scrim { display: block; position: fixed; inset: 0; z-index: 70; background: rgba(4, 2, 8, .7); backdrop-filter: blur(3px); opacity: 0; pointer-events: none; transition: opacity .2s; }
  .side { position: fixed; z-index: 80; top: 0; left: 0; bottom: 0; width: min(86vw, 330px); height: auto; padding: calc(16px + env(safe-area-inset-top, 0px)) 14px calc(16px + env(safe-area-inset-bottom, 0px)); border-right: 1px solid var(--line2); transform: translateX(-102%); transition: transform .26s cubic-bezier(.2, .8, .2, 1); box-shadow: 20px 0 60px rgba(0, 0, 0, .6); }
  .shell.nav-open .side { transform: none; } .shell.nav-open .scrim { opacity: 1; pointer-events: auto; }
  body:has(.shell.nav-open) { overflow: hidden; }
  .navs { display: grid; overflow: visible; gap: 16px; } .nav-group { display: grid; } .nav-group nav { display: grid; } .nav-title { display: block; }
  nav button { width: 100%; min-height: 46px; background: transparent; font-size: 1rem; white-space: normal; }
  nav button[aria-current="page"]::before { left: -14px; }
  .who { margin-top: auto; }
  main { padding: 18px 14px calc(96px + env(safe-area-inset-bottom, 0px)); }
  .page-head { margin-bottom: 18px; padding-bottom: 14px; } .page-head h1 { font-size: 1.5rem; }
  .page-head { display: none; } /* le titre est déjà dans la barre du haut */
  .panel { padding: 18px 16px; border-radius: 16px; }
  .grid2 { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  body { font-size: 16px; }
  input[type="text"], input[type="number"], input[type="url"], input[type="search"], input[type="password"], textarea { font-size: 16px; min-height: 46px; }
  .ns-trigger { min-height: 48px; font-size: 16px; }
  .btn { min-height: 46px; padding: 11px 18px; } .btn.sm { min-height: 40px; }
  .actions { gap: 10px; } .actions > .btn { flex: 1 1 100%; }
  .fields { grid-template-columns: 1fr; }
  .row { flex-wrap: wrap; align-items: flex-start; gap: 10px; } .row > .switch { margin-left: auto; }
  .warn-row { grid-template-columns: 1fr auto; } .warn-act { grid-column: 1 / -1; flex-direction: column; grid-row: 2; }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .tiles { grid-template-columns: 1fr 1fr; gap: 10px; } .tile { padding: 12px; gap: 10px; flex-direction: column; align-items: flex-start; } .tile-txt small { white-space: normal; }
  .item { flex-wrap: wrap; } .tier-top { align-items: stretch; flex-direction: column; } .inline-form input { flex-basis: 100%; }
  .seg { display: flex; width: 100%; overflow-x: auto; } .seg button { flex: 1; min-height: 40px; white-space: nowrap; }
  .chip { padding: 9px 14px; font-size: .88rem; }
  .pgrid { grid-template-columns: 1fr; }
  .savebar { left: 10px; right: 10px; bottom: calc(10px + env(safe-area-inset-bottom, 0px)); padding: 10px 12px; gap: 8px; } .savebar span { flex: 1; font-size: .82rem; line-height: 1.25; }
  #toasts { left: 12px; right: 12px; bottom: auto; top: calc(66px + env(safe-area-inset-top, 0px)); } .toast { max-width: none; }

  /* Menu des sélecteurs : panneau qui monte du bas de l'écran */
  .ns-backdrop { display: block; position: fixed; inset: 0; z-index: 110; background: rgba(4, 2, 8, .62); opacity: 0; transition: opacity .18s; } .ns-backdrop.in { opacity: 1; }
  body.ns-sheet-open { overflow: hidden; }
  .ns-pop { left: 0 !important; right: 0; top: auto !important; bottom: 0 !important; width: 100% !important; max-height: 78vh !important; border-radius: 22px 22px 0 0; border-bottom: 0; transform: translateY(100%); transform-origin: bottom; padding-bottom: env(safe-area-inset-bottom, 0px); transition: transform .24s cubic-bezier(.2, .8, .2, 1), opacity .12s; }
  .ns-pop.in { transform: none; }
  .ns-pop::before { content: ""; width: 42px; height: 4px; border-radius: 4px; background: #4a3866; margin: 8px auto 0; }
  .ns-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 16px 4px; }
  .ns-title { font-weight: 700; font-size: 1.02rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .ns-close { width: 36px; height: 36px; display: grid; place-items: center; border: 0; border-radius: 10px; background: rgba(190, 163, 230, .1); color: #fff; cursor: pointer; }
  .ns-opt { padding: 14px 12px; font-size: 1rem; } .ns-list { padding: 6px 10px 10px; }
  .ns-search input { min-height: 46px; }
}
