/* Échalote — une interface douce, lisible et facile à utiliser d'une main. */

:root{
  --paper:      #FFFEFB;
  --surface:    #F7F5EF;
  --ink:        #233329;
  --muted:      #66736B;
  --line:       #E5E8DD;
  --green:      #245B44;
  --green-soft: #E6F0E7;
  --amber:      #906638;

  --bs-body-bg: var(--surface);
  --bs-body-color: var(--ink);
  --bs-primary: var(--green);
  --bs-border-color: var(--line);
  --bs-link-color: var(--green);
}

body{
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: var(--surface);
  color: var(--ink);
  -webkit-text-size-adjust: 100%;
  min-height: 100vh;
}

h1, h2{ font-family: Georgia, "Times New Roman", serif; color: #173D32; }
h1{ font-size: clamp(1.95rem, 4vw, 2.6rem); font-weight: 700; letter-spacing: -.035em; line-height: 1.12; }
h2{ font-size: 1.35rem; font-weight: 700; letter-spacing: -.02em; }

/* ---------- Barre de navigation ---------- */
.topbar{
  background: var(--paper);
  border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 30;
  box-shadow: 0 2px 18px rgba(20,48,33,.035);
}
.topbar .inner{
  display: flex; align-items: center; justify-content: space-between;
  padding: .75rem 0;
}
.topbar .brand{
  display: flex; align-items: center; gap: .65rem;
  font-family: Georgia, "Times New Roman", serif;
  font-weight: 700; letter-spacing: -.025em; color: #173D32;
  text-decoration: none; font-size: 1.3rem;
}
.topbar .brand img{ display: block; }
.topbar .brand small{ display: block; font: 500 .67rem/1.2 -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; letter-spacing: .04em; color: var(--muted); margin-top: .1rem; }

.topbar-actions{ display: flex; align-items: center; gap: .35rem; }
.topbar-actions form{ display: flex; margin: 0; }
.icon-btn{
  display: inline-flex; align-items: center; justify-content: center;
  width: 2.5rem; height: 2.5rem; border-radius: .8rem;
  color: var(--muted); background: none; border: none; padding: 0;
  text-decoration: none; cursor: pointer;
}
.icon-btn:hover{ background: var(--surface); color: var(--ink); }
.icon-btn svg{ width: 1.15rem; height: 1.15rem; }

/* Navigation principale : 4 pavés tactiles */
.tabbar{
  display: grid; grid-template-columns: repeat(4, 1fr);
  gap: .55rem; margin: 1.25rem 0 2rem;
}
.tabbar a{
  display: flex; align-items: center; justify-content: center;
  gap: .55rem; padding: .8rem .35rem;
  background: var(--paper); border: 1px solid var(--line); border-radius: .85rem;
  color: var(--muted); text-decoration: none;
  font-size: .91rem; font-weight: 650; line-height: 1.15; text-align: center;
  min-height: 56px;
  transition: background .15s, border-color .15s, transform .15s;
}
.tabbar a:hover{ background: #F0F4EC; border-color: #C8D9CC; color: var(--green); transform: translateY(-1px); }
.tabbar a .glyph{ font-size: 1.2rem; line-height: 1; }
.tabbar a.active{
  border-color: #B9D2BF; background: var(--green-soft); color: var(--green);
  box-shadow: inset 0 0 0 1px #B9D2BF;
}

/* ---------- Blocs ---------- */
.panel{
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 1.1rem;
  margin-bottom: 1.15rem;
  overflow: hidden;
  box-shadow: 0 6px 28px rgba(38,54,39,.035);
}
.panel-head{
  padding: .85rem 1.15rem;
  border-bottom: 1px solid var(--line);
  font-weight: 750; font-size: .83rem;
  text-transform: uppercase; letter-spacing: .075em;
  color: #42604B; background: #FAFBF7;
  display: flex; justify-content: space-between; align-items: center;
}
.panel-body{ padding: 1.2rem; }

/* ---------- Liste de courses : le cœur de l'appli ---------- */
/* Rangées hautes, toute la ligne est tactile. */
.shop-row{
  display: flex; align-items: flex-start; gap: .85rem;
  padding: 1rem 1.15rem;
  border-bottom: 1px solid #EDEFF1;
  cursor: pointer;
  user-select: none;
}
.shop-row:last-child{ border-bottom: none; }
.shop-row input[type=checkbox]{
  width: 1.45rem; height: 1.45rem; margin-top: .1rem; flex: none;
  accent-color: var(--green);
}
.shop-row .body{ flex: 1; min-width: 0; }
.shop-row .name{
  font-size: 1.02rem; font-weight: 500; line-height: 1.3;
}
.shop-row .qty{
  color: var(--muted); font-variant-numeric: tabular-nums;
  font-size: .95rem; white-space: nowrap; padding-left: .5rem;
}
.shop-row .note{
  display: block; font-size: .76rem; color: var(--amber); margin-top: .18rem;
}
.shop-row.done .name,
.shop-row.done .qty{
  text-decoration: line-through;
  color: #A6ADB4;
}
.shop-row.done .note{ opacity: .5; }
.shop-row:hover{ background: #FBFCF8; }
.shop-row:has(input:focus-visible){ outline: 2px solid var(--green); outline-offset: -2px; }

.leaf{
  display: inline-block; margin-left: .35rem;
  font-size: .7rem; color: var(--green);
  background: var(--green-soft); border-radius: .8rem;
  padding: .05rem .4rem; vertical-align: middle;
  font-weight: 600; letter-spacing: .02em;
}

/* ---------- Repas à cuisiner ---------- */
.meal{
  padding: 1.25rem;
  border-bottom: 1px solid #EDEFF1;
}
.meal:last-child{ border-bottom: none; }
.meal .slot{
  font-size: .72rem; font-weight: 650; letter-spacing: .08em;
  text-transform: uppercase; color: var(--muted);
}
.meal .title{
  font-size: 1.32rem; font-weight: 650; letter-spacing: -.015em;
  margin: .2rem 0 .35rem;
}
.meal .meta{
  font-size: .8rem; color: var(--muted);
  display: flex; gap: .8rem; flex-wrap: wrap; margin-bottom: .5rem;
}
.meal .instructions{
  font-size: .92rem; line-height: 1.5; color: #3A424A;
}

.tag-tm{
  font-size: .68rem; font-weight: 650; letter-spacing: .04em;
  color: var(--green); border: 1px solid var(--green);
  border-radius: .8rem; padding: .05rem .45rem;
}

/* ---------- Formulaires ---------- */
.form-label{ font-size: .82rem; font-weight: 600; color: var(--muted); }
.form-control, .form-select{
  border-color: var(--line);
  font-size: 1rem;
  padding: .68rem .8rem;
  border-radius: .7rem;
}
.form-control:focus, .form-select:focus{
  border-color: var(--green);
  box-shadow: 0 0 0 .18rem rgba(31,111,74,.14);
}
.btn{ font-weight: 650; padding: .67rem 1.1rem; border-radius: .72rem; }
.btn-primary{ background: var(--green); border-color: var(--green); }
.btn-primary:hover, .btn-primary:focus{ background: #17573A; border-color: #17573A; }
.btn-lg{ padding: .9rem 1.3rem; font-size: 1.02rem; }

/* Sélecteur de nombre : gros boutons tactiles */
.stepper{ display: flex; align-items: stretch; gap: 0; max-width: 190px; }
.stepper button{
  width: 3rem; font-size: 1.35rem; line-height: 1;
  border: 1px solid var(--line); background: var(--paper);
  color: var(--ink);
}
.stepper button:first-child{ border-radius: .4rem 0 0 .4rem; }
.stepper button:last-child{ border-radius: 0 .4rem .4rem 0; }
.stepper input{
  width: 4rem; text-align: center; border: 1px solid var(--line);
  border-left: 0; border-right: 0; font-size: 1.1rem; font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.slot-toggle{ display: flex; gap: .5rem; }
.slot-toggle label{
  flex: 1; text-align: center; padding: .7rem;
  border: 1px solid var(--line); border-radius: .45rem;
  background: var(--paper); cursor: pointer; font-weight: 550;
}
.slot-toggle input{ position: absolute; opacity: 0; pointer-events: none; }
.slot-toggle input:checked + span{ color: var(--green); }
.slot-toggle label:has(input:checked){
  border-color: var(--green); background: var(--green-soft);
}

/* ---------- Divers ---------- */
.wake-indicator{
  font-size: .74rem; color: var(--muted);
  display: inline-flex; align-items: center; gap: .35rem;
}
.wake-indicator.on{ color: var(--green); }

/* Bannière : un article a bougé sur un autre téléphone du foyer */
.change-banner{
  position: fixed; left: .75rem; right: .75rem; bottom: .75rem; z-index: 50;
  background: var(--ink); color: #fff;
  border-radius: .5rem; padding: .75rem .9rem;
  display: flex; align-items: center; justify-content: space-between; gap: .75rem;
  font-size: .88rem;
  box-shadow: 0 6px 24px rgba(0,0,0,.22);
}
.change-banner button{
  background: #fff; color: var(--ink); border: 0;
  border-radius: .35rem; padding: .4rem .8rem;
  font-size: .85rem; font-weight: 600; white-space: nowrap;
}

.progress-line{
  height: 3px; background: var(--line); border-radius: 2px; overflow: hidden;
}
.progress-line > div{ height: 100%; background: var(--green); transition: width .2s; }

.muted{ color: var(--muted); }
.small-note{ font-size: .82rem; color: var(--muted); line-height: 1.5; }

.page-heading{ display: flex; align-items: flex-end; justify-content: space-between; gap: 1rem; margin: .25rem 0 1.55rem; }
.page-heading h1{ margin: 0 0 .35rem; }
.eyebrow{ color: #B56843; text-transform: uppercase; letter-spacing: .15em; font-weight: 800; font-size: .69rem; margin: 0 0 .4rem; }
.meal-actions{ display: flex; gap: .55rem; flex-wrap: wrap; }
.meal-actions form{ margin: 0; }
.recipe-details summary{ color: var(--green); font-weight: 650; cursor: pointer; font-size: .88rem; }
.recipe-details{ padding: .15rem 0; }
.provider-choice{ display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: .65rem; }
.provider-choice label{ cursor: pointer; position: relative; }
.provider-choice input{ position: absolute; opacity: 0; }
.provider-choice label span{ display: flex; flex-direction: column; padding: .85rem 1rem; border: 1px solid var(--line); border-radius: .85rem; background: #fff; }
.provider-choice label small{ color: var(--muted); margin-top: .1rem; }
.provider-choice input:checked + span{ background: var(--green-soft); border-color: var(--green); color: var(--green); box-shadow: inset 0 0 0 1px var(--green); }
.provider-choice input:focus-visible + span{ outline: 3px solid #97BDA2; outline-offset: 2px; }

@media (max-width: 700px){
  body{ padding-bottom: calc(5.4rem + env(safe-area-inset-bottom)); }
  .topbar{ position: relative; }
  .tabbar{ position: fixed; bottom: 0; left: 0; right: 0; z-index: 40; margin: 0; padding: .55rem .6rem calc(.55rem + env(safe-area-inset-bottom)); gap: .2rem; background: rgba(255,254,251,.97); border-top: 1px solid var(--line); box-shadow: 0 -6px 24px rgba(29,51,32,.08); backdrop-filter: blur(15px); }
  .tabbar a{ flex-direction: column; gap: .25rem; min-height: 3.7rem; padding: .4rem .15rem; border: 0; background: transparent; font-size: .73rem; border-radius: .65rem; }
  .tabbar a.active{ border: 0; box-shadow: none; }
  .tabbar a .glyph{ font-size: 1.28rem; }
  .page-heading{ align-items: flex-start; flex-direction: column; }
  .page-heading .btn{ width: 100%; }
  .change-banner{ bottom: calc(5.6rem + env(safe-area-inset-bottom)); }
}

@media (max-width: 400px){
  .tabbar a{ font-size: .69rem; }
}

@media print{
  .topbar, .tabbar, .no-print{ display: none !important; }
  body{ background: #fff; }
}
