/* Eat Around : feuille de style unique, pensée d'abord pour le téléphone. */
:root {
  --bg: #FBF7F2;
  --card: #FFFFFF;
  --ink: #1F1B16;
  --muted: #6F665C;
  --line: #ECE4DA;
  --accent: #E4572E;
  --accent-ink: #FFFFFF;
  --accent-soft: #FCE9E2;
  --green: #2E7D4F;
  --green-soft: #E3F2E8;
  --blue-soft: #E4EEF8;
  --warn: #9A5B00;
  --warn-soft: #FFF2D6;
  --danger: #B3261E;
  --radius: 16px;
  --shadow: 0 1px 2px rgba(31, 27, 22, .06), 0 4px 14px rgba(31, 27, 22, .06);
  color-scheme: light;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 16px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
a { color: inherit; }
h1, h2, h3 { line-height: 1.15; margin: 0; letter-spacing: -.01em; }
h1 { font-size: 1.65rem; font-weight: 800; }
h2 { font-size: 1.2rem; font-weight: 750; }
h3 { font-size: 1rem; font-weight: 700; }
p { margin: .4rem 0; }
small, .muted { color: var(--muted); }

.top {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: calc(12px + env(safe-area-inset-top)) 16px 12px; max-width: 720px; margin: 0 auto;
}
.brand { display: inline-flex; align-items: center; gap: 8px; font-weight: 800; font-size: 1.1rem; text-decoration: none; }
.logo {
  display: inline-grid; place-items: center; width: 30px; height: 30px; border-radius: 9px;
  background: var(--accent); color: var(--accent-ink); font-size: .85rem; font-weight: 800; letter-spacing: -.03em;
}
.city { font-size: .85rem; color: var(--muted); background: var(--card); border: 1px solid var(--line); padding: 4px 10px; border-radius: 99px; }
.wrap { max-width: 720px; margin: 0 auto; padding: 4px 16px 40px; }
.foot { max-width: 720px; margin: 0 auto; padding: 8px 16px calc(28px + env(safe-area-inset-bottom)); font-size: .8rem; color: var(--muted); }

.hero { margin: 8px 0 18px; }
.hero .kicker { color: var(--accent); font-weight: 700; font-size: .9rem; }
.stack > * + * { margin-top: 12px; }

.card {
  display: block; background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 16px; text-decoration: none; border: 1px solid transparent;
}
a.card:active { transform: scale(.995); }
a.card:hover { border-color: var(--line); }
.card-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.card .meta { color: var(--muted); font-size: .88rem; margin: 2px 0 8px; }
.apercu { font-size: .98rem; }
.price { font-weight: 750; white-space: nowrap; color: var(--accent); }

.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.chip { font-size: .75rem; font-weight: 650; padding: 2px 9px; border-radius: 99px; background: var(--line); color: var(--ink); }
.chip.vege { background: var(--green-soft); color: var(--green); }
.chip.poisson { background: var(--blue-soft); color: #1F4E79; }
.chip.porc { background: #F6E6EE; color: #7A2E52; }
.chip.ok { background: var(--green-soft); color: var(--green); }
.chip.warn { background: var(--warn-soft); color: var(--warn); }
.chip.bad { background: #FBE3E1; color: var(--danger); }

.empty { text-align: center; padding: 28px 16px; }
.empty .big { font-size: 2.2rem; }

/* Menu du jour */
.menu .rubrique + .rubrique { margin-top: 16px; padding-top: 14px; border-top: 1px dashed var(--line); }
.rubrique-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; margin-bottom: 6px; }
.rubrique-head h3 { text-transform: uppercase; font-size: .8rem; letter-spacing: .08em; color: var(--accent); }
.plats { list-style: none; margin: 0; padding: 0; }
.plats li { display: flex; justify-content: space-between; gap: 12px; padding: 5px 0; }
.plats .libelle { flex: 1; }
.plats .chip { font-size: .68rem; padding: 1px 7px; margin-left: 4px; vertical-align: 1px; }
.plats .incertain .libelle { background: var(--warn-soft); border-radius: 4px; padding: 0 3px; }

/* Boutons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 11px 16px; border-radius: 12px; border: 1px solid var(--line); background: var(--card);
  color: var(--ink); font: inherit; font-weight: 650; text-decoration: none; cursor: pointer;
}
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.danger { color: var(--danger); }
.btn.small { padding: 7px 11px; font-size: .88rem; border-radius: 10px; }
.btn[disabled] { opacity: .5; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.actions.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); }

/* Espace restaurateur */
.shoot { display: grid; gap: 10px; }
.shoot .big-btn {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
  min-height: 132px; border-radius: 20px; background: var(--accent); color: var(--accent-ink);
  font-weight: 800; font-size: 1.2rem; text-align: center; cursor: pointer; box-shadow: var(--shadow);
}
.shoot .big-btn .ico { font-size: 2.2rem; line-height: 1; }
.shoot .alt { text-align: center; font-size: .92rem; }
.shoot .alt label { text-decoration: underline; cursor: pointer; color: var(--muted); }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.progress { background: var(--card); border-radius: var(--radius); padding: 14px 16px; box-shadow: var(--shadow); }
.progress .track { height: 8px; background: var(--line); border-radius: 99px; overflow: hidden; margin-top: 8px; }
.progress .fill { height: 100%; width: 0; background: var(--accent); transition: width .2s; }

.status { border-left: 5px solid var(--line); }
.status.publie { border-left-color: var(--green); }
.status.en_cours { border-left-color: var(--accent); }
.status.illisible, .status.erreur { border-left-color: var(--danger); }
.status.retire { border-left-color: var(--muted); }
.status-title { display: flex; align-items: center; gap: 8px; font-weight: 750; }
.spinner { width: 18px; height: 18px; border-radius: 50%; border: 3px solid var(--accent-soft); border-top-color: var(--accent); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.verifier { background: var(--warn-soft); border-radius: 12px; padding: 10px 12px; margin-top: 12px; font-size: .9rem; }
.verifier ul { margin: 4px 0 0; padding-left: 18px; }
.banner { background: var(--green-soft); color: var(--green); border-radius: 12px; padding: 10px 14px; font-weight: 650; margin-bottom: 12px; }
.banner.warn { background: var(--warn-soft); color: var(--warn); }

.tiles { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin-top: 10px; }
@media (min-width: 560px) { .tiles { grid-template-columns: repeat(4, 1fr); } }
.tile { background: var(--bg); border-radius: 12px; padding: 10px 12px; }
.tile b { display: block; font-size: 1.6rem; line-height: 1.1; }
.tile span { font-size: .82rem; color: var(--muted); }
.trend { font-style: normal; font-weight: 700; }
.trend.up { color: var(--green); }
.trend.down { color: var(--danger); }
.bars { display: grid; grid-template-columns: repeat(7, 1fr); gap: 8px; align-items: end; height: 120px; margin-top: 14px; }
.bar-col { display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; gap: 3px; font-size: .72rem; color: var(--muted); }
.bar-col .bar { width: 100%; max-width: 34px; min-height: 3px; background: var(--accent-soft); border-radius: 6px 6px 2px 2px; }
.bar-col.today .bar { background: var(--accent); }
.bar-col small { color: var(--ink); font-weight: 650; }

.links { list-style: none; padding: 0; margin: 0; }
.links li + li { border-top: 1px solid var(--line); }
.links a { display: flex; justify-content: space-between; padding: 13px 2px; text-decoration: none; font-weight: 600; }
.links a::after { content: "›"; color: var(--muted); font-size: 1.2rem; line-height: 1; }

/* Formulaires */
label.field { display: block; margin-bottom: 14px; }
label.field > span { display: block; font-weight: 650; font-size: .92rem; margin-bottom: 4px; }
label.field small { display: block; margin-top: 3px; }
input[type=text], input[type=url], input[type=tel], input[type=email], input[type=search], input[type=password], textarea {
  width: 100%; font: inherit; color: inherit; background: var(--card); border: 1px solid var(--line);
  border-radius: 10px; padding: 10px 12px;
}
textarea { min-height: 120px; resize: vertical; }
input:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.check { display: flex; gap: 10px; align-items: center; margin-bottom: 14px; font-weight: 600; }
.check input { width: 20px; height: 20px; accent-color: var(--accent); }
.section-edit { display: grid; grid-template-columns: 1fr 90px; gap: 8px; }
.section-edit textarea { grid-column: 1 / -1; }
.danger-zone { border: 1px solid #F2C9C5; }

/* Fiche publique */
.fiche-head { margin: 6px 0 14px; }
.fiche-head .meta { color: var(--muted); }
.infos dt { font-weight: 650; font-size: .85rem; color: var(--muted); margin-top: 10px; }
.infos dd { margin: 2px 0 0; }
.photo-link img { width: 100%; border-radius: 12px; display: block; }

/* Historique */
.hist-day { font-weight: 750; margin: 18px 0 8px; }
.hist-item { display: flex; justify-content: space-between; gap: 12px; }

/* Carte des restaurants (Google Maps) */
.map-wrap { position: relative; margin: 0 0 10px; border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); background: #E8E4DC; }
.map { position: relative; z-index: 0; height: min(46vh, 420px); min-height: 260px; }
.map.off { display: grid; place-items: center; color: var(--muted); font-size: .9rem; }
.pin { position: absolute; transform: translate(-50%, -50%); width: 13px; height: 13px; padding: 0; border-radius: 50%; border: 2px solid #fff; background: #9C9186; box-shadow: 0 1px 3px rgba(0, 0, 0, .35); cursor: pointer; }
.pin.on { width: auto; height: auto; transform: translate(-50%, calc(-100% - 6px)); padding: 6px 9px; border-radius: 99px; background: var(--accent); color: var(--accent-ink); font: 750 13px/1 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; white-space: nowrap; z-index: 2; }
.pin.on::after { content: ""; position: absolute; left: 50%; bottom: -6px; margin-left: -6px; border: 6px solid transparent; border-top-color: var(--accent); border-bottom: 0; }
.pin.sel { outline: 3px solid var(--ink); outline-offset: 1px; z-index: 3; }
.pin.me { width: 16px; height: 16px; background: #1A73E8; border-width: 3px; cursor: default; }
.map-me { position: absolute; z-index: 5; top: 10px; left: 10px; box-shadow: var(--shadow); }
/* bottom: 34px laisse visibles le logo Google et les mentions, obligatoires sur la carte */
.map-card { position: absolute; z-index: 5; left: 10px; right: 10px; bottom: 34px; background: var(--card); border-radius: 14px; padding: 12px 14px; box-shadow: var(--shadow); }
.map-card .meta { color: var(--muted); font-size: .85rem; margin: 2px 0 6px; }
.map-card .btn { margin-top: 8px; }
.map-card p:not(.meta) { font-size: .9rem; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.map-legend { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: .8rem; color: var(--muted); margin: 0 0 16px; }
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; background: #9C9186; margin-right: 6px; vertical-align: -1px; }
.dot.on { background: var(--accent); }

/* Import des menus du jour par l'administrateur : la photo, puis le restaurant */
.crumb { margin: 4px 0 0; font-size: .9rem; }
.crumb a { color: var(--muted); text-decoration: none; }
.import-cta { width: 100%; padding: 15px 18px; font-size: 1.05rem; border-radius: 14px; margin-top: 2px; }
.cta-hint { font-size: .85rem; margin: 6px 0 16px; text-align: center; }
.step { display: flex; align-items: center; gap: 10px; font-size: 1.05rem; margin-bottom: 12px; }
.step span { display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; background: var(--accent); color: var(--accent-ink); font-size: .85rem; }
.import-grid > * + * { margin-top: 14px; }
.preview { margin: 0; text-align: center; }
.preview img { display: block; max-width: 100%; max-height: 300px; margin: 0 auto 10px; border-radius: 12px; box-shadow: var(--shadow); }
.pick-list { max-height: min(48vh, 440px); overflow-y: auto; margin-top: 10px; border: 1px solid var(--line); border-radius: 12px; -webkit-overflow-scrolling: touch; }
.pick { display: flex; align-items: center; gap: 10px; padding: 10px 12px; cursor: pointer; }
.pick + .pick { border-top: 1px solid var(--line); }
.pick input { flex: none; width: 20px; height: 20px; margin: 0; accent-color: var(--accent); }
.pick-text { flex: 1; min-width: 0; }
.pick-text b { display: block; font-weight: 650; }
.pick-text small { display: block; color: var(--muted); font-size: .82rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pick:has(input:checked) { background: var(--accent-soft); }
.import-send { position: sticky; bottom: 0; z-index: 6; padding: 12px 0 calc(12px + env(safe-area-inset-bottom)); background: linear-gradient(to top, var(--bg) 75%, rgba(251, 247, 242, 0)); }
.import-send .btn { width: 100%; padding: 14px 16px; font-size: 1.02rem; }
.send-hint { text-align: center; font-size: .88rem; margin: 8px 0 0; min-height: 1.2em; }
.import-send .progress { margin-top: 10px; }
.resto-admin-grid > * + * { margin-top: 16px; }
.admin-photo { display: none; margin: 6px 0 0; padding: 10px; }
.admin-photo figcaption { font-size: .82rem; margin-top: 6px; text-align: center; }

/* Fiche : sur téléphone, les blocs se suivent */
.fiche-menu, .fiche-infos { margin-top: 16px; }
.pin.hl { outline: 3px solid var(--ink); outline-offset: 1px; z-index: 4; }

/* Grand écran (ordinateur, tablette en paysage) : pages plus larges, carte à côté des menus du jour */
@media (min-width: 720px) {
  .card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 12px; }
  .card-grid > * + * { margin-top: 0; }
  .search { max-width: 520px; }
}
@media (min-width: 960px) {
  body.wide .top, body.wide .wrap, body.wide .foot { max-width: 1240px; padding-left: 32px; padding-right: 32px; }
  body.wide h1 { font-size: 2rem; }
  body.wide .hero { margin: 14px 0 22px; }
  .home-grid.with-map {
    display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.25fr); grid-template-areas: "list map";
    gap: 28px; align-items: start;
  }
  .home-map { grid-area: map; position: sticky; top: 16px; }
  .home-list { grid-area: list; }
  .home-map .map { height: calc(100vh - 200px); min-height: 460px; max-height: 860px; }
  .home-map .map-legend { margin-bottom: 0; }
  .map-card { right: auto; width: 360px; }
  .home-grid:not(.with-map) .home-list .stack { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
  .home-grid:not(.with-map) .home-list .stack > * + * { margin-top: 0; }
  .fiche-grid {
    display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); grid-template-areas: "menu actions" "menu infos";
    grid-template-rows: auto 1fr; gap: 16px 28px; align-items: start;
  }
  .fiche-actions { grid-area: actions; margin-top: 0; }
  .fiche-menu { grid-area: menu; margin-top: 0; }
  .fiche-infos { grid-area: infos; margin-top: 0; }
  .import-cta { width: auto; }
  .cta-hint { text-align: left; }
  .import-grid {
    display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.3fr); grid-template-areas: "photo resto" "send resto";
    grid-template-rows: auto 1fr; gap: 18px 28px; align-items: start;
  }
  .import-grid > * + * { margin-top: 0; }
  .import-photo { grid-area: photo; }
  .import-resto { grid-area: resto; }
  .import-send { grid-area: send; position: static; background: none; padding: 0; }
  .pick-list { max-height: calc(100vh - 330px); min-height: 320px; }
  .resto-admin-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.7fr); gap: 28px; align-items: start; }
  .resto-admin-grid > * + * { margin-top: 0; }
  .admin-photo { display: block; }
}

/* Administration */
.admin table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.admin th, .admin td { text-align: left; padding: 8px 6px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.admin th { font-size: .78rem; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.admin .scroll { overflow-x: auto; }
.admin form.inline { display: inline; }
.kpis { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }

/* Kit QR imprimable */
.kit { text-align: center; max-width: 420px; margin: 0 auto; }
.kit .qr svg { width: 100%; max-width: 280px; height: auto; display: block; margin: 10px auto; }
.kit .steps { text-align: left; margin: 14px auto; padding-left: 22px; max-width: 320px; }
.kit .steps li { margin: 4px 0; }
.kit .cle { font-size: .85rem; border-top: 1px dashed var(--line); padding-top: 10px; margin-top: 12px; }
.kit .url { font-family: ui-monospace, Menlo, monospace; font-size: .75rem; word-break: break-all; color: var(--muted); }
@media print {
  body { background: #fff; }
  .top, .foot, .no-print { display: none !important; }
  .card { box-shadow: none; border: 1px solid #ccc; }
  .wrap { padding: 0; }
}
