/* Fort d'Ivar · V6.19 : finition visuelle non destructive.
   Surcharge uniquement les styles ; aucun modele de donnees ni comportement metier modifie. */
:root{
  --ivar19-bg:#121b20;
  --ivar19-surface:#1c292f;
  --ivar19-surface-hi:#25353a;
  --ivar19-stroke:#45575b;
  --ivar19-gold:#ddbc82;
  --ivar19-text:#f2ede3;
  --ivar19-muted:#b2c0c0;
  --ivar19-shadow:0 12px 35px rgba(0,0,0,.18);
  color-scheme:dark;
}
html{scroll-behavior:smooth}
body{
  color:var(--ivar19-text);
  background:
    radial-gradient(ellipse 82% 45% at 90% -10%,rgba(114,96,64,.11),transparent 78%),
    radial-gradient(ellipse 70% 60% at -20% 72%,rgba(64,104,103,.10),transparent 80%),
    var(--ivar19-bg);
  line-height:1.46;
}
::selection{background:#bfa47775;color:#fffaf1}
:focus-visible{outline:2px solid #e4c38d!important;outline-offset:3px}
button,input,select,textarea{accent-color:#d4b27b}
a{color:#e6c58f}
button{transition:background-color .16s ease,border-color .16s ease,box-shadow .16s ease,transform .16s ease}
button:not(:disabled):active{transform:translateY(1px)}
button:disabled{filter:saturate(.63)}

/* Navigation : aucun onglet supprimé ni renommé. */
.side{
  background:linear-gradient(160deg,#1b292e 0%,#162126 72%,#152025 100%);
  border-right-color:#3d5053;
  box-shadow:inset -1px 0 #16272a;
  padding-top:30px;
  scrollbar-color:#536464 transparent;
}
.brand{color:#edd09a;font-size:23px;letter-spacing:.025em;text-shadow:0 2px 18px #d5a86a16}
.brand::before{content:'✥';font-size:17px;color:#c5a36c;margin-right:8px;vertical-align:2px}
.sub{color:#a7b7b5;font-size:11px;margin-bottom:28px;line-height:1.55}
.nav{padding:4px 0}
.nav .highlight{
  background:linear-gradient(90deg,rgba(202,167,108,.17),rgba(93,109,100,.15));
  border:1px solid #ae93613d;
  border-left:3px solid #e9c88f;
  box-shadow:inset 0 1px 0 #ffffff0a;
}
.nav button{font-size:13px;border-radius:8px;letter-spacing:.005em;gap:11px}
.nav button:hover{color:#f0e3cb;background:#ffffff0a}
.nav button.active{color:#f5d6a0;font-weight:650}
.nav button:focus-visible{outline-offset:-3px!important}
.nav button>span:first-child{font-size:16px;min-width:18px;text-align:center}

/* Entete, panneaux et rythmes : conserve toutes les actions disponibles. */
.main{max-width:1800px;margin:0 auto;padding-top:27px}
.main>header{
  position:relative;
  padding:18px 22px;
  background:linear-gradient(110deg,rgba(41,56,58,.85),rgba(28,42,47,.68));
  border:1px solid #465653;
  border-radius:17px;
  box-shadow:0 12px 34px #0002,inset 0 1px #ffffff0b;
}
.main>header::before{content:'';position:absolute;left:20px;top:0;width:96px;height:2px;background:linear-gradient(90deg,#e1bc7d,transparent)}
header h1{font-size:clamp(25px,2.7vw,34px);line-height:1.2;letter-spacing:-.015em}
header .muted{color:#b7c5c4;font-size:13px}
#saveIndicator{
  border:1px solid #658272;
  color:#dcf4df;
  background:linear-gradient(120deg,#2a4b3d,#253b35);
  padding:7px 12px;
  font-weight:600;
  box-shadow:inset 0 1px #ffffff0b;
}
#content{padding-top:6px;min-height:35vh}
h2{letter-spacing:-.012em}
h3{line-height:1.3}
.muted{color:var(--ivar19-muted)}
.small{line-height:1.5}
.toolbar{gap:10px;margin:19px 0 20px;align-items:stretch}
.toolbar .field,.toolbar button{min-height:44px}
.row{gap:10px}
.panel{
  background:linear-gradient(145deg,rgba(34,49,54,.96),rgba(26,39,45,.96));
  border-color:#48585c;
  border-radius:16px;
  box-shadow:var(--ivar19-shadow),inset 0 1px 0 #ffffff09;
  line-height:1.48;
}
.panel h2{color:#f5e9d5}
.panel .entry:last-child{border-bottom:0}
.entry{border-bottom-color:#ffffff19}
.line{border-top-color:#ffffff1d}

/* Boutons et formulaires : signification des variantes preservee. */
.primary,.secondary,.danger{border-radius:10px;min-height:42px;line-height:1.25}
.primary{
  color:#182224;
  border-color:#debd84;
  background:linear-gradient(180deg,#e7c893 0%,#c5a371 100%);
  box-shadow:0 3px 12px #0002,inset 0 1px #fff7;
}
.primary:hover:not(:disabled){background:linear-gradient(180deg,#f3d9a9,#d8b581);border-color:#f2d5a0;box-shadow:0 4px 17px #bf9b5b36}
.secondary{
  color:#e9e8e2;
  background:linear-gradient(180deg,#34464b,#29383e);
  border-color:#596b6d;
}
.secondary:hover:not(:disabled){background:#3e5256;border-color:#a6b0a3}
.danger{background:#533436;border-color:#9e6261;color:#ffe3dc}
.danger:hover:not(:disabled){background:#704043;border-color:#d38b83}
.field{
  background:#202e35;
  border-color:#536568;
  color:#f5eee2;
  border-radius:10px;
  min-height:42px;
  box-shadow:inset 0 1px 2px #0002;
}
.field:hover:not(:disabled){border-color:#84928e}
.field:focus{outline:2px solid #e2be7e;outline-offset:1px;border-color:#d4b47c}
.field::placeholder{color:#a0b0af;opacity:1}
textarea.field{line-height:1.55;resize:vertical}
select.field{cursor:pointer}
select.field option{background:#202e35;color:#f5eee2}
label{line-height:1.5}

/* Inventaire et catalogue : cartes propres, sans changer leurs dimensions logiques. */
.cards{gap:16px}
.item{
  background:linear-gradient(148deg,#27373c,#1d2b31);
  border-color:#4a5e61;
  border-radius:15px;
  box-shadow:0 7px 19px #00000020,inset 0 1px #ffffff09;
}
.item:hover:not(:disabled){border-color:#d8b67e;box-shadow:0 14px 29px #0004;transform:translateY(-2px)}
.item:focus-visible{border-color:#e6c792}
.pic{background:radial-gradient(ellipse at 40% 24%,#485b59,#29383d 75%);border:1px solid #ffffff12}
.pic img,.mini img{object-fit:contain}
.qty{color:#edd0a0;font-weight:650}
.mini{border:1px solid #566666}
.ivar65-note-preview{color:#c9d2c3}

/* Statistiques, progression, fiches et messages. */
.stats{gap:13px}
.stat{background:linear-gradient(145deg,#314146,#25353b);border:1px solid #50605e;box-shadow:inset 0 1px #ffffff0e;border-radius:13px}
.stat b{font-size:clamp(22px,2vw,27px);color:#f0cd90;font-variant-numeric:tabular-nums}
.progress{background:#3a4b4c;height:9px;border:1px solid #ffffff13}
.progress>div{background:linear-gradient(90deg,#b99561,#e3c388);border-radius:10px}
.badge{border:1px solid #ffffff1b}
.pill{border-color:#687575;color:#ecebe4}
.toast{bottom:64px;right:15px;border-color:#8ab59c;box-shadow:0 15px 34px #0007;max-width:min(390px,calc(100vw - 30px));line-height:1.45}
#ivarSync{box-shadow:0 8px 22px #0005;max-width:min(350px,calc(100vw - 30px))}

/* Dialogues : meme contenu, meilleure lisibilite et navigation clavier. */
.modal-bg{background:rgba(3,8,11,.84);backdrop-filter:blur(5px)}
.modal{
  background:linear-gradient(160deg,#26383d,#1b2b31);
  border-color:#82765e;
  box-shadow:0 27px 85px #000b;
  border-radius:18px;
  padding:clamp(17px,2.1vw,28px);
  scrollbar-color:#7d8a82 transparent;
}
.modal.wide{width:min(880px,100%)}
.modal h2{line-height:1.27}
.modal label{color:#e0ddce;font-weight:550}
.modal .field{margin:6px 0 13px}
.modal .row.between>h2{max-width:calc(100% - 62px);overflow-wrap:anywhere}
.modal .grid2{align-items:start}
.picker{scrollbar-color:#627877 transparent}

/* Arbre genealogique : aucune retouche du moteur ni des coordonnees SVG. */
.ivtree-tools{gap:9px}
.ivtree-stage{border-color:#63716a;box-shadow:0 14px 44px #0003,inset 0 1px #ffffff12;background:radial-gradient(ellipse at 35% -10%,#304245,#1b292e 70%)}
.ivtree-legend{background:#1d2b30c9;border:1px solid #4d5b58;border-radius:12px;padding:10px 14px;gap:11px 17px}
.ivtree-node{border-color:#84908b;box-shadow:0 11px 23px #0005,inset 0 1px #ffffff12;background:linear-gradient(140deg,#35474a,#26353d)}
.ivtree-node:hover{border-color:#f1d19a}
.ivtree-node.ivtree-selected{background:linear-gradient(140deg,#535744,#344449)}
.ivtree-person-btn{background:linear-gradient(145deg,#2b3c40,#233238);border-color:#526666}
.ivtree-person-btn:hover{border-color:#e0bf89;background:#324449}
.ivtree-pickbar{box-shadow:0 6px 20px #0002}
.ivtree-note{line-height:1.65}

/* Accessibilite et petits ecrans : aucun menu masque au clavier. */
@media (max-width:1100px){
  .main{padding-left:24px;padding-right:24px}
  .toolbar{gap:8px}
}
@media (max-width:700px){
  .side{width:68px;min-width:68px;padding:17px 7px}
  .brand{font-size:0;text-align:center;padding:0}
  .brand::before{display:block;font-size:26px;margin:0}
  .nav button{justify-content:center}
  .nav button>span:first-child{font-size:18px}
  .nav .highlight{border-radius:9px}
  .main{padding:16px 11px 60px}
  .main>header{padding:16px 14px;border-radius:13px;gap:9px}
  .main>header::before{left:13px}
  header h1{font-size:25px}
  #saveIndicator{font-size:11px;white-space:normal}
  .toolbar{margin-top:16px}
  .toolbar .search{flex-basis:100%}
  .cards{grid-template-columns:repeat(2,minmax(0,1fr));gap:10px}
  .panel{border-radius:13px;padding:13px}
  .modal{border-radius:15px}
  .modal .grid2{grid-template-columns:1fr}
  .ivtree-legend{padding:9px;gap:8px 12px}
  .ivtree-stage{border-radius:12px}
  .stats{grid-template-columns:repeat(auto-fit,minmax(135px,1fr))}
  .ivtree-people-list{grid-template-columns:repeat(auto-fit,minmax(170px,1fr))}
}
@media(max-width:400px){
  .cards{grid-template-columns:1fr}
  .main{padding-left:9px;padding-right:9px}
  .toolbar>button{flex:1 1 auto}
  header h1{font-size:22px}
  .stat{padding:11px}
}
@media(prefers-reduced-motion:reduce){
  html{scroll-behavior:auto}
  *,*::before,*::after{animation-duration:.01ms!important;animation-iteration-count:1!important;transition-duration:.01ms!important}
}
