/* Appli Maison : écran tactile de cuisine (22", paysage) et téléphones.
   États : turquoise = tout va bien, orange = bientôt, violet = manque ou dépassé. Jamais rouge ni vert. */
:root{
  --bg:#EEF2EF; --paper:#FFFFFF; --tile:#F5F7F5; --ink:#1E2A2E; --muted:#5B6B6E; --line:#D9E0DC;
  --plank:#C9B79A; --plank-dark:#A8916C;
  --fox:#E9A21A; --fox-soft:#FBEFD2;
  --turq:#14918C; --turq-soft:#D6F0EE; --on-turq:#FFFFFF;
  --violet:#7457C4; --violet-soft:#E9E3F8;
  --orange:#D9701A; --orange-soft:#FBE6D3;
  --shadow:0 10px 30px -18px rgba(20,40,40,.45);
  --display:"Bricolage Grotesque","Segoe UI",system-ui,sans-serif;
  --body:"Nunito Sans","Segoe UI",system-ui,sans-serif;
  --r:16px;
  color-scheme:light;
  font-size:clamp(15px, calc(.55vw + 9px), 20px);
}
@media (prefers-color-scheme:dark){:root:not([data-theme="light"]){
  --bg:#121918; --paper:#1C2625; --tile:#24302F; --ink:#E7EEEC; --muted:#9DB0AD; --line:#2F3D3B;
  --plank:#5A4C38; --plank-dark:#463A2A;
  --fox:#F2B33D; --fox-soft:#3A3020;
  --turq:#3CC2BC; --turq-soft:#16393A; --on-turq:#0E1716;
  --violet:#A58CF0; --violet-soft:#2C2545;
  --orange:#F0954A; --orange-soft:#3D2A1A;
  --shadow:0 10px 30px -18px rgba(0,0,0,.8);
  color-scheme:dark;}}
*{box-sizing:border-box}
html,body{height:100%}
body{margin:0;background:var(--bg);color:var(--ink);font-family:var(--body);line-height:1.4;-webkit-tap-highlight-color:transparent;overscroll-behavior:none}
button,input,select{font:inherit;color:inherit}
button{cursor:pointer;touch-action:manipulation}
button:focus-visible,input:focus-visible,select:focus-visible{outline:3px solid var(--fox);outline-offset:2px}
[hidden]{display:none!important}
h2,h3{font-family:var(--display);margin:0;line-height:1.15}

.app{height:100%;display:grid;grid-template-rows:auto 1fr auto;grid-template-columns:minmax(0,1fr);
  padding:env(safe-area-inset-top,0px) max(12px,env(safe-area-inset-right,0px)) 0 max(12px,env(safe-area-inset-left,0px))}
.top{display:flex;align-items:center;gap:16px;padding:10px 4px}
.brand{font-family:var(--display);font-weight:800;font-size:1.35rem;display:flex;align-items:center;gap:8px}
.brand.big{font-size:2rem}
.brand-dot{width:.7em;height:.7em;border-radius:50%;background:var(--fox)}
.now{font-weight:700;color:var(--muted);font-variant-numeric:tabular-nums}
.top-actions{margin-left:auto;display:flex;gap:10px;align-items:center}
.sync{font-size:.8rem;color:var(--muted)}
.sync.bad{color:var(--violet);font-weight:800}
.ghost{border:2px solid var(--line);background:var(--paper);border-radius:12px;padding:8px 14px;font-weight:800}
.ghost[aria-pressed="true"]{background:var(--fox);border-color:var(--fox);color:#1E2A2E}
.primary{border:0;background:var(--turq);color:var(--on-turq);border-radius:14px;padding:14px 20px;font-weight:800;font-size:1.05rem}
.primary:disabled{opacity:.45;cursor:default}
.secondary{border:0;background:var(--tile);border-radius:14px;padding:14px 20px;font-weight:800}
.soft-violet{border:0;background:var(--violet-soft);color:var(--ink);border-radius:14px;padding:14px 20px;font-weight:800}

.main{min-height:0;display:grid;grid-template-columns:minmax(0,1fr);gap:14px;padding-bottom:12px}
.view-armoires,.view-courses{min-height:0;min-width:0;display:flex;flex-direction:column;gap:10px}
.places{display:flex;gap:8px;overflow-x:auto;scrollbar-width:none;flex-shrink:0}
.places::-webkit-scrollbar{display:none}
.places button{border:0;border-radius:14px;padding:12px 18px;background:var(--paper);font-weight:800;font-size:1.02rem;display:flex;gap:8px;align-items:center;white-space:nowrap;box-shadow:var(--shadow)}
.places button[aria-selected="true"]{background:var(--turq);color:var(--on-turq)}
.places .n{font-size:.75rem;background:var(--orange-soft);color:var(--ink);border-radius:999px;padding:1px 8px}
.places button[aria-selected="true"] .n{background:rgba(255,255,255,.25);color:inherit}

/* Le meuble */
.cupboard{flex:1;min-height:0;overflow:auto;background:var(--paper);border-radius:var(--r);box-shadow:var(--shadow);
  border:10px solid var(--plank);padding:6px 14px 14px;display:flex;flex-direction:column;gap:6px}
.shelf{display:flex;flex-direction:column;gap:8px;padding-top:8px}
.shelf-head{display:flex;align-items:center;gap:8px;min-height:2rem}
.shelf-name{font-size:.78rem;font-weight:800;letter-spacing:.08em;text-transform:uppercase;color:var(--muted)}
.shelf-tools{margin-left:auto;display:flex;gap:6px}
.shelf-tools button{border:0;background:var(--tile);border-radius:10px;padding:6px 10px;font-weight:800;font-size:.85rem}
.shelf-row{display:grid;grid-template-columns:repeat(auto-fill,minmax(12.5rem,1fr));gap:10px;padding-bottom:10px;
  border-bottom:8px solid var(--plank);box-shadow:0 3px 0 var(--plank-dark)}
.shelf:last-child .shelf-row{border-bottom:0;box-shadow:none}

.item{background:var(--tile);border:3px solid transparent;border-radius:14px;display:flex;flex-direction:column;min-width:0;overflow:hidden}
.item .body{border:0;background:none;padding:10px 10px 6px;display:grid;grid-template-columns:auto 1fr auto;grid-template-rows:auto auto;gap:0 8px;align-items:center;text-align:left;min-width:0}
.item .pic{grid-row:1/3;font-size:2.1rem;line-height:1}
.item .nm{font-weight:800;font-size:.92rem;line-height:1.2;overflow:hidden;display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;min-width:0;overflow-wrap:anywhere}
.item .qty{grid-row:1/3;grid-column:3;font-family:var(--display);font-weight:800;font-size:1.7rem;font-variant-numeric:tabular-nums}
.item .st{font-size:.72rem;font-weight:800;color:var(--muted);white-space:nowrap;overflow:hidden;text-overflow:ellipsis;min-height:1.1em}
.item .bar{height:6px;margin:0 10px 6px;border-radius:3px;background:var(--line);overflow:hidden}
.item .bar i{display:block;height:100%;background:var(--turq)}
.item.soon .bar i{background:var(--orange)}
.item.late .bar i{background:var(--violet)}
.item.low{border-color:var(--orange)} .item.low .st{color:var(--orange)}
.item.out{border-color:var(--violet)} .item.out .st{color:var(--violet)}
.item.soon .st{color:var(--orange)} .item.late .st{color:var(--violet)}
.item.uncounted .qty{color:var(--muted)}
.item.untracked .st{color:var(--muted)}
.pm{display:grid;grid-template-columns:1fr 1fr;gap:6px;padding:0 8px 8px}
.pm button{border:0;border-radius:11px;padding:.5rem 0;font-size:1.45rem;font-weight:800;line-height:1;background:var(--paper)}
.pm .plus{background:var(--turq);color:var(--on-turq)}
.pm button:active{transform:scale(.96)}
.add-tile{border:3px dashed var(--line);background:none;border-radius:14px;font-weight:800;color:var(--muted);min-height:7rem}
.add-shelf{align-self:flex-start;border:3px dashed var(--line);background:none;border-radius:14px;padding:12px 18px;font-weight:800;color:var(--muted);margin-top:6px}

/* Courses */
.shop{flex:1;min-height:0;background:var(--paper);border-radius:var(--r);box-shadow:var(--shadow);display:flex;flex-direction:column;overflow:hidden}
.shop-head{padding:14px 16px 8px;display:flex;align-items:center;gap:10px}
.shop-head h2{font-size:1.35rem}
.shop-head .sub{font-size:.85rem;color:var(--muted)}
.shop-head .primary{margin-left:auto;padding:10px 14px;font-size:.95rem}
.stores{display:flex;flex-wrap:wrap;gap:6px;padding:0 16px 10px}
.stores button{border:2px solid var(--line);background:var(--paper);border-radius:999px;padding:6px 12px;font-weight:800;font-size:.85rem}
.stores button[aria-pressed="true"]{background:var(--turq);border-color:var(--turq);color:var(--on-turq)}
.stores .order{border-style:dashed;color:var(--muted)}
.ords{display:flex;flex-direction:column;gap:6px}
.ord{display:grid;grid-template-columns:1fr auto auto;gap:8px;align-items:center;background:var(--tile);border-radius:12px;padding:6px 8px 6px 14px;font-weight:700}
.ord button{border:0;background:var(--paper);border-radius:10px;width:2.6rem;height:2.6rem;font-weight:800}
.ord button:disabled{opacity:.3;cursor:default}
.shop-list{flex:1;overflow:auto;padding:0 12px 12px;display:flex;flex-direction:column;gap:12px}
.rayon{display:flex;flex-direction:column;gap:6px}
.rayon h3{font-family:var(--body);font-size:.75rem;font-weight:800;letter-spacing:.08em;text-transform:uppercase;color:var(--muted);padding-left:4px}
.row{display:grid;grid-template-columns:auto auto 1fr auto;align-items:center;gap:10px;background:var(--tile);border-radius:12px;padding:6px 8px}
.row .ck{width:2.6rem;height:2.6rem;border-radius:50%;border:3px solid var(--line);background:var(--paper);font-size:1.2rem;font-weight:800}
.row.on{opacity:.75}
.row.on .ck{background:var(--turq);border-color:var(--turq);color:var(--on-turq)}
.row.on .rn b{text-decoration:line-through}
.row .rp{font-size:1.6rem}
.row .rn{min-width:0;display:flex;flex-direction:column}
.row .rn b{white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.row .rn small{color:var(--muted);font-size:.75rem}
.row .rq{display:flex;align-items:center;gap:6px;font-weight:800;font-variant-numeric:tabular-nums}
.row .rq button{border:0;background:var(--paper);border-radius:9px;width:2.2rem;height:2.2rem;font-size:1.1rem;font-weight:800}
.row .rx{border:0;background:none;color:var(--muted);font-size:1.1rem;width:2rem;height:2rem}
.empty{padding:24px 16px;color:var(--muted);text-align:center}
.shop-foot{padding:10px 12px 12px;border-top:1px solid var(--line);display:flex}
.shop-foot .primary{flex:1;background:var(--fox);color:#1E2A2E}

/* Navigation du bas (téléphone) */
.bottom{display:grid;grid-template-columns:1fr 1fr;gap:8px;padding:8px 0 calc(8px + env(safe-area-inset-bottom,0px))}
.bottom button{border:0;background:var(--paper);border-radius:14px;padding:10px;font-weight:800;display:flex;gap:8px;align-items:center;justify-content:center}
.bottom button span{font-size:1.3rem}
.bottom button[aria-pressed="true"]{background:var(--turq);color:var(--on-turq)}
.count{background:var(--fox);color:#1E2A2E;border-radius:999px;padding:0 8px;font-size:.8rem}
.count:empty{display:none}

/* Grand écran : armoires + courses côte à côte */
@media (min-width:1100px){
  .main{grid-template-columns:minmax(0,1fr) 24rem}
  .bottom{display:none}
  .view-courses{display:flex!important}
}
@media (max-width:1099px){
  .app[data-view="armoires"] .view-courses{display:none}
  .app[data-view="courses"] .view-armoires{display:none}
  .shelf-row{grid-template-columns:repeat(auto-fill,minmax(9.5rem,1fr))}
  .now{display:none}
}
@media (max-width:520px){
  .top .ghost{padding:6px 10px;font-size:.85rem}
  .shelf-row{grid-template-columns:1fr 1fr;gap:8px}
  .cupboard{border-width:7px;padding:4px 8px 8px}
  .item .pic{font-size:1.7rem}
  .item .qty{font-size:1.45rem}
}

/* Fenêtre (fiche produit, ajout) */
.sheet-bg{position:fixed;inset:0;background:rgba(10,20,20,.45);display:flex;align-items:center;justify-content:center;padding:16px;z-index:20}
.sheet{background:var(--paper);border-radius:20px;width:min(40rem,100%);max-height:100%;overflow:auto;padding:20px;display:flex;flex-direction:column;gap:16px;box-shadow:0 30px 60px -20px rgba(0,0,0,.5)}
.sheet h2{font-size:1.5rem}
.sheet .head{display:flex;align-items:center;gap:12px}
.sheet .head .big-pic{font-size:2.6rem;border:0;background:var(--tile);border-radius:14px;width:4rem;height:4rem}
.sheet .head input{flex:1;min-width:0;font-size:1.3rem;font-weight:800;border:2px solid var(--line);border-radius:12px;padding:10px 12px;background:var(--paper)}
.field{display:flex;flex-direction:column;gap:6px}
.field>label,.field>.lab{font-size:.8rem;font-weight:800;letter-spacing:.05em;text-transform:uppercase;color:var(--muted)}
.field select,.field input[type="text"],.field input[type="search"],.field input[type="date"]{border:2px solid var(--line);border-radius:12px;padding:10px 12px;background:var(--paper);font-size:1rem;min-width:0}
.hint{font-size:.85rem;color:var(--muted)}
.stepper{display:flex;align-items:center;gap:10px}
.stepper button{border:0;background:var(--tile);border-radius:12px;width:3rem;height:3rem;font-size:1.4rem;font-weight:800}
.stepper output{font-family:var(--display);font-size:1.6rem;font-weight:800;min-width:2.5ch;text-align:center;font-variant-numeric:tabular-nums}
.two{display:grid;grid-template-columns:1fr 1fr;gap:14px}
@media (max-width:520px){.two{grid-template-columns:1fr}}
.switch{display:flex;align-items:center;gap:12px;border:0;background:var(--tile);border-radius:12px;padding:12px 14px;font-weight:700;text-align:left}
.switch i{width:2.8rem;height:1.6rem;border-radius:999px;background:var(--line);position:relative;flex-shrink:0;transition:background .15s}
.switch i::after{content:"";position:absolute;top:3px;left:3px;width:calc(1.6rem - 6px);height:calc(1.6rem - 6px);border-radius:50%;background:var(--paper);transition:left .15s}
.switch[aria-checked="true"] i{background:var(--turq)}
.switch[aria-checked="true"] i::after{left:calc(100% - 1.6rem + 3px)}
.pics{display:grid;grid-template-columns:repeat(auto-fill,minmax(3rem,1fr));gap:6px;max-height:14rem;overflow:auto;padding:4px;background:var(--tile);border-radius:12px}
.pics button{border:0;background:var(--paper);border-radius:10px;font-size:1.6rem;height:3rem}
.pics button[aria-pressed="true"]{outline:3px solid var(--turq)}
.lots{display:flex;flex-direction:column;gap:8px}
.lot{display:grid;grid-template-columns:auto 1fr;gap:10px;align-items:center;background:var(--tile);border-radius:12px;padding:8px 10px}
.lot .stepper button{width:2.4rem;height:2.4rem;font-size:1.1rem}
.lot .stepper output{font-size:1.25rem}
.lot input[type="date"]{border:2px solid var(--line);border-radius:10px;padding:6px 8px;background:var(--paper);min-width:0}
.lot small{display:block;color:var(--muted);font-weight:700}
.lot small.soon{color:var(--orange)} .lot small.late{color:var(--violet)}
.actions{display:flex;flex-wrap:wrap;gap:10px}
.actions .grow{flex:1}
.confirm{background:var(--violet-soft);border-radius:14px;padding:14px;display:flex;flex-direction:column;gap:10px}
.picker{display:grid;grid-template-columns:repeat(auto-fill,minmax(8.5rem,1fr));gap:8px;max-height:22rem;overflow:auto}
.picker button{border:0;background:var(--tile);border-radius:12px;padding:10px;display:flex;align-items:center;gap:8px;text-align:left;font-weight:700;min-width:0}
.picker button span{font-size:1.5rem}
.picker button b{font-weight:700;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.picker button.in{outline:3px solid var(--turq)}

.toast{position:fixed;left:50%;bottom:calc(84px + env(safe-area-inset-bottom,0px));transform:translateX(-50%);background:var(--ink);color:var(--paper);border-radius:14px;padding:10px 12px 10px 18px;display:flex;align-items:center;gap:14px;font-weight:700;z-index:30;max-width:calc(100% - 32px);box-shadow:var(--shadow)}
.toast span{white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.toast button{border:0;background:var(--fox);color:#1E2A2E;border-radius:10px;padding:8px 14px;font-weight:800}
@media (min-width:1100px){.toast{bottom:24px}}

.lock{position:fixed;inset:0;display:flex;align-items:center;justify-content:center;padding:16px;background:var(--bg)}
.lock-card{background:var(--paper);border-radius:20px;padding:28px;width:min(26rem,100%);display:flex;flex-direction:column;gap:14px;box-shadow:var(--shadow)}
.lock-card input{border:2px solid var(--line);border-radius:12px;padding:14px;font-size:1.2rem;background:var(--paper)}
.lock-err{color:var(--violet);font-weight:800;min-height:1.2em;margin:0}
@media (prefers-reduced-motion:reduce){*{transition:none!important}}

/* Téléphone en paysage (écran bas) : on gagne de la hauteur pour la liste */
@media (max-height:500px){
  .top{padding:4px}
  .brand{font-size:1.1rem}
  .shop-head{padding:8px 12px 4px}
  .shop-head h2{font-size:1.1rem}
  .stores{flex-wrap:nowrap;overflow-x:auto;padding:0 12px 6px;scrollbar-width:none}
  .stores button{white-space:nowrap}
  .shop-foot{padding:6px 10px 8px}
  .shop-foot .primary,.bottom button{padding:8px}
  .bottom{padding-top:6px}
}

/* ---------- Menus de la semaine ---------- */
.switch-main{display:none;gap:6px;margin-left:10px}
.switch-main button{border:0;background:var(--paper);border-radius:12px;padding:8px 16px;font-weight:800;box-shadow:var(--shadow)}
.switch-main button[aria-pressed="true"]{background:var(--turq);color:var(--on-turq)}
.view-menus{display:none}
.app[data-view="menus"] .view-menus{display:flex}
.app[data-view="menus"] .view-armoires{display:none}
.week{flex:1;min-height:0;display:flex;flex-direction:column;gap:10px}
.week-head{display:flex;align-items:center;gap:8px;flex-wrap:wrap}
.week-head h2{font-size:1.35rem}
.week-head .ghost{padding:8px 14px;font-size:1rem}
.week-head .recipes-btn{margin-left:auto}
.days{flex:1;min-height:0;display:grid;grid-template-columns:repeat(7,minmax(0,1fr));gap:10px;overflow:auto}
.day{background:var(--paper);border-radius:var(--r);box-shadow:var(--shadow);padding:10px;display:flex;flex-direction:column;gap:8px;min-width:0}
.day.today{outline:3px solid var(--fox)}
.day.past{opacity:.6}
.dname{font-family:var(--display);font-weight:800;font-size:1.05rem}
.meal{flex:1;border:0;border-radius:14px;background:var(--tile);padding:10px;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:4px;text-align:center;min-height:7rem;min-width:0}
.meal .sl{align-self:flex-start;font-size:.72rem;font-weight:800;letter-spacing:.08em;text-transform:uppercase;color:var(--muted)}
.meal .mp{font-size:2.4rem;line-height:1}
.meal .mn{font-weight:800;line-height:1.2;overflow-wrap:anywhere}
.meal.empty{border:3px dashed var(--line);background:none}
.meal .plus-sign{font-size:2rem;font-weight:800;color:var(--muted);line-height:1}
.meal.cooked{opacity:.75}
.tag{font-size:.72rem;font-weight:800;border-radius:999px;padding:2px 8px;background:var(--line);color:var(--ink)}
.tag.ok,.tag.done{background:var(--turq-soft)}
.tag.lack{background:var(--orange-soft)}
.rgrid{display:grid;grid-template-columns:repeat(auto-fill,minmax(12rem,1fr));gap:8px}
.rcard{border:0;background:var(--tile);border-radius:12px;padding:10px;display:flex;align-items:center;gap:10px;text-align:left;min-width:0}
.rcard .rp{font-size:1.8rem}
.rcard .rt{display:flex;flex-direction:column;min-width:0}
.rcard b{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.rcard small,.ing small{font-weight:700;color:var(--muted);font-size:.78rem}
small.ok,small.done{color:var(--turq)} small.lack,small.soon{color:var(--orange)}
.quick{display:flex;flex-wrap:wrap;gap:8px}
.quick button{border:0;background:var(--tile);border-radius:999px;padding:10px 14px;font-weight:800}
.free{display:flex;gap:8px;margin-top:4px}
.free input{flex:1;min-width:0;border:2px solid var(--line);border-radius:12px;padding:10px 12px;background:var(--paper)}
.ings{display:flex;flex-direction:column;gap:6px}
.ing{display:grid;grid-template-columns:auto 1fr auto auto;gap:10px;align-items:center;background:var(--tile);border-radius:12px;padding:6px 10px}
.ing .rp{font-size:1.5rem}
.ing>span:nth-child(2){display:flex;flex-direction:column;min-width:0}
.ing .rx{border:0;background:none;color:var(--muted);font-size:1.1rem;width:2rem;height:2rem}
.stepper.mini button{width:2.2rem;height:2.2rem;font-size:1.1rem}
.stepper.mini output{font-size:1.15rem;min-width:2ch}
.sheet .head .big-pic{display:flex;align-items:center;justify-content:center;flex-shrink:0}
#rc-q{border:2px solid var(--line);border-radius:12px;padding:10px 12px;background:var(--paper);margin-top:6px}
.rlist{display:flex;flex-direction:column;gap:6px}
.rrow{display:grid;grid-template-columns:auto 1fr;gap:8px}
.rrow .star{border:0;background:var(--tile);border-radius:12px;width:3rem;font-size:1.3rem}
.rrow .rname{border:0;background:var(--tile);border-radius:12px;padding:8px 12px;display:grid;grid-template-columns:auto 1fr auto;gap:10px;align-items:center;text-align:left}
.rrow .rname .rp{font-size:1.5rem}
.rrow .rname small{color:var(--muted);font-weight:700}

@media (min-width:1100px){
  .switch-main{display:flex}
  .view-armoires,.view-menus{grid-column:1;grid-row:1}
  .view-courses{grid-column:2;grid-row:1}
}
@media (max-width:1099px){
  .bottom{grid-template-columns:1fr 1fr 1fr}
  .app[data-view="menus"] .view-courses,.app[data-view="courses"] .view-menus{display:none}
  .days{grid-template-columns:1fr;align-content:start}
  .day{display:grid;grid-template-columns:1fr 1fr;gap:8px}
  .dname{grid-column:1/-1}
  .meal{min-height:5.5rem;flex-direction:row;flex-wrap:wrap;justify-content:flex-start;text-align:left}
  .meal .sl{flex-basis:100%}
  .meal .mp{font-size:1.8rem}
  .meal.empty{justify-content:center}
}
@media (max-width:520px){
  .week-head h2{font-size:1.05rem;flex-basis:100%;order:-1}
  .week-head .recipes-btn{margin-left:auto}
  .meal .mn{font-size:.9rem}
}

/* Corrections menus */
.view-menus{min-height:0;min-width:0;flex-direction:column}
.bottom{background:var(--bg)}
.meal{position:relative;padding-top:1.9rem}
.meal .sl{position:absolute;top:8px;left:10px}
.dname .today-word{color:var(--fox)}
@media (min-width:1100px){ .dname .today-word{display:none} .day.today .dname{color:var(--fox)} }
@media (max-width:1099px){ .meal .sl{position:static;flex-basis:100%} .meal{padding-top:10px} }

/* Logo Yellow Fox */
.brand-logo{width:1.7em;height:1.7em;flex-shrink:0}
.brand{gap:10px;white-space:nowrap}
.brand.big{flex-direction:column;gap:12px;text-align:center}
.brand.big .brand-logo{width:5rem;height:5rem}
@media (max-width:520px){ .brand-yf{display:none} }

/* ---------- Accueil ---------- */
:root{--slate:#4A6A8F;--slate-soft:#DFE7F1}
@media (prefers-color-scheme:dark){:root:not([data-theme="light"]){--slate:#8FB0D6;--slate-soft:#243244}}
:root[data-theme="dark"]{--slate:#8FB0D6;--slate-soft:#243244}
.view-accueil{display:none;min-height:0;min-width:0}
.app[data-view="accueil"] .view-accueil{display:flex}
.app[data-view="accueil"] .view-armoires,.app[data-view="accueil"] .view-courses,.app[data-view="accueil"] .view-menus{display:none!important}
.app[data-view="accueil"] .main{grid-template-columns:minmax(0,1fr)!important}
.home{flex:1;min-height:0;display:grid;grid-template-columns:1fr 1.45fr 1.1fr;grid-template-rows:1fr auto;gap:14px}
.home .card{background:var(--paper);border-radius:var(--r);box-shadow:var(--shadow);padding:16px 18px;display:flex;flex-direction:column;gap:10px;min-width:0;min-height:0}
.home-col{min-height:0;min-width:0}
.home-left{display:flex;flex-direction:column;gap:14px}
.home-left .card:last-child{flex:1}
.home .lab{font-size:.78rem;font-weight:800;letter-spacing:.08em;text-transform:uppercase;color:var(--muted)}
.home h2{font-size:1.35rem}
.clock-card{align-items:flex-start}
.clock{font-family:var(--display);font-weight:800;font-size:clamp(3rem,6vw,5.5rem);line-height:1;font-variant-numeric:tabular-nums}
.clock-date{font-weight:800;font-size:1.15rem}
.note-card{border:0;text-align:left;background:var(--fox-soft)!important;cursor:pointer}
.note-text{font-weight:800;font-size:1.15rem;line-height:1.3;white-space:pre-line}
.hm{border:0;background:var(--tile);border-radius:12px;padding:10px 12px;display:flex;align-items:center;gap:10px;text-align:left;font-weight:700}
.hm span{font-size:1.6rem}
.home .ghost{align-self:flex-start;margin-top:auto}
.home .ghost.small{padding:4px 12px;margin:0}
.home-h{display:flex;align-items:center;justify-content:space-between}
.home-agenda{overflow:auto}
.agenda-today{display:flex;flex-direction:column;gap:8px}
.ev{display:grid;grid-template-columns:4.2rem 1fr;gap:10px;align-items:center;padding:8px 10px;border-radius:12px;background:var(--tile);border-left:6px solid var(--cc,var(--turq))}
.ev .et{font-weight:800;font-variant-numeric:tabular-nums;font-size:.95rem}
.ev .en{font-weight:700;min-width:0;overflow-wrap:anywhere}
.ev .en small{display:block;color:var(--muted);font-weight:700;font-size:.75rem}
.ev.past{opacity:.5}
.ev.bday{background:var(--fox-soft)}
.c-turq{--cc:var(--turq)} .c-violet{--cc:var(--violet)} .c-orange{--cc:var(--orange)} .c-fox{--cc:var(--fox)} .c-slate{--cc:var(--slate)}
.agenda-week{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:8px;margin-top:6px}
.aw-day{background:var(--tile);border-radius:12px;padding:8px;display:flex;flex-direction:column;gap:5px;min-width:0}
.aw-day>b{font-size:.85rem;text-transform:capitalize}
.aw-day .ev{grid-template-columns:auto 1fr;padding:4px 6px;gap:6px;border-left-width:4px;background:var(--paper);font-size:.8rem}
.aw-day .ev .et{font-size:.75rem}
.aw-day small.none,.aw-day small.more{color:var(--muted);font-weight:700}
.cal-err{color:var(--violet);font-weight:700;font-size:.85rem;margin:0}
.home-empty{display:flex;flex-direction:column;gap:12px;align-items:flex-start;padding:10px 0}
.home-empty p{margin:0;max-width:40ch}
.home-alerts{overflow:auto}
.alert{border:0;display:grid;grid-template-columns:2.4rem 1fr;gap:10px;align-items:center;text-align:left;padding:10px 12px;border-radius:12px;background:var(--tile)}
.alert .ic{font-size:1.6rem;text-align:center}
.alert b{display:block}
.alert small{color:var(--muted);font-weight:700}
.a-orange{background:var(--orange-soft)} .a-violet{background:var(--violet-soft)} .a-turq{background:var(--turq-soft)} .a-fox{background:var(--fox-soft)}
.dock{grid-column:1/-1;display:grid;grid-template-columns:repeat(4,1fr);gap:12px}
.dock button{border:0;background:var(--paper);border-radius:var(--r);box-shadow:var(--shadow);padding:12px;display:flex;align-items:center;justify-content:center;gap:10px;font-weight:800;font-size:1.1rem}
.dock button span{font-size:1.8rem}
.dock .count{font-style:normal}
.cal-list{display:flex;flex-direction:column;gap:8px}
.cal-row{display:grid;grid-template-columns:auto 1fr auto auto;gap:10px;align-items:center;background:var(--tile);border-radius:12px;padding:8px 10px}
.cal-row span{display:flex;flex-direction:column;min-width:0}
.cal-row small{color:var(--muted);font-weight:700}
.cal-row .secondary,.cal-row .soft-violet{padding:8px 12px;font-size:.85rem;background:var(--paper)}
.dotc{width:14px;height:14px;border-radius:50%;background:var(--cc)}
.cal-form{display:flex;flex-direction:column;gap:12px;background:var(--tile);border-radius:14px;padding:14px;margin:8px 0}
.colors{display:flex;gap:10px}
.colors button{width:2.6rem;height:2.6rem;border-radius:50%;border:3px solid var(--paper);background:var(--cc);box-shadow:0 0 0 2px var(--line)}
.colors button[aria-pressed="true"]{box-shadow:0 0 0 3px var(--ink)}
.howto{background:var(--tile);border-radius:12px;padding:10px 14px}
.howto summary{font-weight:800;cursor:pointer}
.howto ol{padding-left:1.3em;display:flex;flex-direction:column;gap:4px}
textarea{border:2px solid var(--line);border-radius:12px;padding:10px 12px;background:var(--paper);font-size:1.1rem;resize:vertical}
@media (max-width:1099px){
  .bottom{grid-template-columns:repeat(4,1fr)}
  .bottom button{flex-direction:column;gap:2px;padding:6px 4px;font-size:.8rem}
  .home{grid-template-columns:1fr;grid-template-rows:none;overflow:auto;align-content:start}
  .home .dock{display:none}
  .clock{font-size:3rem}
  .home-left .card:last-child{flex:none}
}
@media (max-height:500px){ .bottom button{flex-direction:row} }
@media (max-width:1099px){
  .home{display:flex;flex-direction:column;overflow:auto}
  .home>*,.home-left>*{flex:none!important}
  .home-col{min-height:auto}
  .home-agenda,.home-alerts{overflow:visible}
  .agenda-week{grid-template-columns:repeat(2,minmax(0,1fr))}
}
@media (max-width:1099px){
  .home-left{display:contents}
  .clock-card{display:none!important}
  .note-card{order:1} .home-alerts{order:2} .home-agenda{order:3} .home-left>.card:last-child{order:4}
}
/* Logo Yellow Fox Home (toit + cheminée) : un peu plus grand pour garder le renard lisible */
.brand-logo{width:2.1em;height:2.1em;margin:-4px 0}
.brand.big .brand-logo{width:6.5rem;height:6.5rem}

/* ---------- Tâches ---------- */
.view-taches{display:none;min-height:0;min-width:0;flex-direction:column}
.app[data-view="taches"] .view-taches{display:flex}
.app[data-view="taches"] .view-armoires,.app[data-view="taches"] .view-courses,.app[data-view="taches"] .view-menus,.app[data-view="taches"] .view-accueil{display:none!important}
.app[data-view="taches"] .main{grid-template-columns:minmax(0,1fr)!important}
.tasks{flex:1;min-height:0;display:flex;flex-direction:column;gap:10px}
.task-body{flex:1;min-height:0;overflow:auto;background:var(--paper);border-radius:var(--r);box-shadow:var(--shadow);padding:16px;display:flex;flex-direction:column;gap:14px}
.task-cols{display:grid;grid-template-columns:minmax(0,1.6fr) minmax(0,1fr);gap:16px;align-items:start}
.task-side{display:flex;flex-direction:column;gap:14px}
.task-list{display:grid;grid-template-columns:repeat(auto-fill,minmax(22rem,1fr));gap:10px}
.task-cols .task-list{grid-template-columns:1fr}
.tab-intro{margin:0}
.sub-h{font-size:.8rem;letter-spacing:.08em;text-transform:uppercase;color:var(--muted);margin-top:6px}
.all-done{font-family:var(--display);font-weight:800;font-size:1.3rem;color:var(--turq);margin:8px 0}
.chore{display:grid;grid-template-columns:minmax(0,1fr) auto;align-items:center;gap:10px;background:var(--tile);border-radius:14px;padding:8px 10px;border-left:6px solid var(--line)}
.chore.s-late{border-left-color:var(--violet);background:var(--violet-soft)}
.chore.s-today{border-left-color:var(--orange);background:var(--orange-soft)}
.chore.s-soon{border-left-color:var(--fox)}
.chore.s-done{opacity:.7;border-left-color:var(--turq)}
.ch-main{border:0;background:none;display:flex;align-items:center;gap:12px;text-align:left;min-width:0;padding:2px}
.ch-pic{font-size:2rem;line-height:1}
.ch-txt{display:flex;flex-direction:column;min-width:0}
.ch-txt b{font-size:1.02rem}
.ch-st{font-weight:800;font-size:.8rem;color:var(--muted)}
.s-late .ch-st{color:var(--violet)} .s-today .ch-st{color:var(--orange)} .s-done .ch-st{color:var(--turq)}
.ch-meta{color:var(--muted);font-size:.75rem;font-weight:700}
.done-btn{border:0;background:var(--turq);color:var(--on-turq);border-radius:12px;padding:12px 16px;font-weight:800;font-size:1rem;white-space:nowrap}
.undo-btn{border:0;background:var(--paper);border-radius:12px;padding:10px 12px;font-weight:800;color:var(--muted)}
.who-pick{display:flex;flex-wrap:wrap;gap:6px;align-items:center;justify-content:flex-end}
.who-pick span{font-weight:800;font-size:.85rem}
.who-pick button{border:0;background:var(--turq);color:var(--on-turq);border-radius:10px;padding:10px 12px;font-weight:800}
.who-pick button:last-child{background:var(--paper);color:var(--ink)}
.machines{display:grid;grid-template-columns:repeat(auto-fit,minmax(18rem,1fr));gap:12px}
.machine,.feed{background:var(--tile);border-radius:14px;padding:12px 14px;display:flex;flex-direction:column;gap:8px}
.machine.run{background:var(--turq-soft)} .machine.end{background:var(--orange-soft)}
.machine h3,.feed h3{font-size:1.05rem}
.machine p{margin:0}
.progs{display:flex;flex-wrap:wrap;gap:6px}
.progs button{border:0;background:var(--paper);border-radius:10px;padding:8px 12px;font-weight:800;display:flex;flex-direction:column;align-items:flex-start}
.progs small{color:var(--muted);font-weight:700}
.m-bar{height:8px;border-radius:4px;background:var(--paper);overflow:hidden}
.m-bar i{display:block;height:100%;background:var(--turq)}
.machine .primary,.machine .secondary{align-self:flex-start;padding:10px 16px}
.feed-row{display:grid;grid-template-columns:1fr 1fr;gap:8px}
.feed-btn{border:3px dashed var(--line);background:var(--paper);border-radius:12px;padding:12px;display:flex;flex-direction:column;align-items:flex-start;text-align:left}
.feed-btn small{color:var(--muted);font-weight:700}
.feed-btn.on{border:3px solid var(--turq);background:var(--turq-soft)}
.cats{display:grid;grid-template-columns:repeat(auto-fill,minmax(16rem,1fr));gap:10px}
.cat-card{border:0;background:var(--tile);border-radius:14px;padding:12px;display:flex;gap:12px;align-items:center;text-align:left}
.cat-card span:last-child{display:flex;flex-direction:column;min-width:0}
.cat-card small{color:var(--muted);font-weight:700}
.cats .add-tile{min-height:4rem}
.seg{display:flex;gap:6px;flex-wrap:wrap}
.seg button,.wd button,.quick button[aria-pressed]{border:2px solid var(--line);background:var(--paper);border-radius:999px;padding:8px 14px;font-weight:800}
.seg button[aria-pressed="true"],.wd button[aria-pressed="true"],.quick button[aria-pressed="true"]{background:var(--turq);border-color:var(--turq);color:var(--on-turq)}
.wd{display:flex;flex-wrap:wrap;gap:6px}
.people{display:flex;flex-wrap:wrap;gap:8px}
.person{display:inline-flex;align-items:center;gap:6px;background:var(--turq-soft);border-radius:999px;padding:6px 6px 6px 14px;font-weight:800}
.person button{border:0;background:var(--paper);border-radius:50%;width:1.8rem;height:1.8rem}
.dock{grid-template-columns:repeat(5,1fr)}
@media (max-width:1099px){
  .bottom{grid-template-columns:repeat(5,1fr)}
  .task-cols{grid-template-columns:1fr}
  .task-list{grid-template-columns:1fr}
  .task-body{padding:10px}
  .chore{grid-template-columns:1fr}
  .done-btn,.undo-btn{justify-self:stretch}
  .who-pick{justify-content:flex-start}
}
@media (max-width:1099px){
  .chore{grid-template-columns:minmax(0,1fr) auto}
  .done-btn{padding:10px 12px;font-size:.95rem}
  .done-btn,.undo-btn{justify-self:end}
  .chore:has(.who-pick){grid-template-columns:1fr}
}

/* ---------- Maison connectée (Home Assistant) ---------- */
.view-maison{display:none;min-height:0;min-width:0;flex-direction:column}
.app[data-view="maison"] .view-maison{display:flex}
.app[data-view="maison"] .view-armoires,.app[data-view="maison"] .view-courses,.app[data-view="maison"] .view-menus,.app[data-view="maison"] .view-accueil,.app[data-view="maison"] .view-taches{display:none!important}
.app[data-view="maison"] .main{grid-template-columns:minmax(0,1fr)!important}
.ha{flex:1;min-height:0;display:flex;flex-direction:column}
.ha .card{background:var(--paper);border-radius:var(--r);box-shadow:var(--shadow);padding:16px 18px;display:flex;flex-direction:column;gap:12px;min-width:0;min-height:0}
.ha h2{font-size:1.35rem}
.ha-wrap{flex:1;min-height:0;display:grid;grid-template-columns:minmax(0,1fr) minmax(0,1.5fr);gap:14px}
.ha-wrap:has(> .ha-devs:only-child){grid-template-columns:minmax(0,1fr)}
.ha-cam img{width:100%;border-radius:12px;background:var(--tile);aspect-ratio:4/3;object-fit:cover}
.ha-devs{overflow:auto}
.ha-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(11rem,1fr));gap:10px}
.ha-tile{border:3px solid transparent;background:var(--tile);border-radius:16px;padding:14px;display:flex;flex-direction:column;align-items:flex-start;gap:4px;text-align:left;min-height:7.5rem}
.ha-tile .ha-ic{font-size:2.2rem;line-height:1}
.ha-tile b{font-size:1.05rem}
.ha-tile small{color:var(--muted);font-weight:800}
.ha-tile.on{background:var(--fox-soft);border-color:var(--fox)}
.ha-tile.act{background:var(--violet-soft)}
.ha-tile.off{opacity:.5}
.ha-empty{background:var(--paper);border-radius:var(--r);box-shadow:var(--shadow);padding:24px}
.ha-mini{border:0;text-align:left;cursor:pointer}
.ha-mini b{font-size:1.05rem}
.ha-pick{display:grid;grid-template-columns:repeat(auto-fill,minmax(14rem,1fr));gap:6px}
.ha-opt{display:flex;gap:10px;align-items:center;background:var(--tile);border-radius:10px;padding:8px 10px;cursor:pointer}
.ha-opt input{width:1.3rem;height:1.3rem;accent-color:var(--turq)}
.ha-opt span{display:flex;flex-direction:column;min-width:0;font-weight:700}
.ha-opt small{color:var(--muted);font-size:.72rem;overflow-wrap:anywhere}
a.secondary{display:flex;align-items:center;justify-content:center;text-decoration:none;color:var(--ink)}
.dock{grid-template-columns:none;grid-auto-flow:column;grid-auto-columns:1fr}
.ring{position:fixed;inset:0;z-index:40;background:rgba(10,20,20,.7);display:flex;align-items:center;justify-content:center;padding:16px}
.ring-card{background:var(--paper);border-radius:22px;padding:20px;width:min(56rem,100%);max-height:100%;overflow:auto;display:flex;flex-direction:column;gap:14px;border:6px solid var(--fox)}
.ring-h{display:flex;align-items:baseline;justify-content:space-between;gap:10px}
.ring-h h2{font-size:clamp(1.5rem,3vw,2.2rem)}
.ring-h span{font-weight:800;color:var(--muted);font-variant-numeric:tabular-nums}
.ring-card img{width:100%;border-radius:14px;aspect-ratio:4/3;object-fit:cover;background:var(--tile)}
.ring-card .primary{padding:16px 28px;font-size:1.2rem}
@media (max-width:1099px){
  .ha-wrap{grid-template-columns:1fr;overflow:auto;align-content:start}
  .ha-devs{overflow:visible}
  .ha-grid{grid-template-columns:repeat(2,minmax(0,1fr))}
}
@media (max-width:1099px){ .ha-mini{order:3} .home-agenda{order:4} .home-left>.card:last-child{order:5} }
@media (max-width:1099px){ .ha .card{min-height:auto;flex:none} .ha-devs{order:-1} }
