/* ShopPilot AI – style.css */
:root {
  --ink: #12263a;
  --muted: #5d6f80;
  --bg: #f2f5f7;
  --card: #ffffff;
  --line: #dbe3e9;
  --deep: #0b3c49;
  --accent: #0e7c86;
  --accent-dark: #0a5f67;
  --sand: #f2a33a;
  --danger: #b83227;
  --ok: #1f7a4d;
  --radius: 10px;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 16px/1.5 "Segoe UI", Roboto, system-ui, sans-serif;
}
h1, h2, h3 { line-height: 1.2; margin: 0 0 .6rem; }
h1 { font-size: 1.9rem; }
h2 { font-size: 1.4rem; }
h3 { font-size: 1.05rem; }
p { margin: 0 0 .8rem; }
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid var(--sand); outline-offset: 2px; }

/* Navigation */
.sidebar {
  position: fixed; inset: 0 auto 0 0; width: 260px; background: var(--deep); color: #fff;
  padding: 1.2rem 1rem; transform: translateX(-100%); transition: transform .2s; z-index: 30;
  display: flex; flex-direction: column;
}
.brand { font-size: 1.35rem; font-weight: 700; margin-bottom: 1.2rem; }
.brand span { color: var(--sand); }
.sidebar nav { display: flex; flex-direction: column; gap: 4px; }
.sidebar a {
  color: #d5e6ea; text-decoration: none; padding: .7rem .8rem; border-radius: 8px;
}
.sidebar a.active { background: rgba(255,255,255,.14); color: #fff; font-weight: 600; }
.side-note { margin-top: auto; font-size: .8rem; color: #9fc0c7; }
.overlay { position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 20; display: none; }
body.menu-open .sidebar { transform: none; }
body.menu-open .overlay { display: block; }

.topbar {
  position: sticky; top: 0; z-index: 10; display: flex; align-items: center; gap: .7rem;
  background: var(--card); border-bottom: 1px solid var(--line); padding: .6rem 1rem;
}
.icon-btn {
  border: 1px solid var(--line); background: #fff; font-size: 1.3rem; border-radius: 8px;
  width: 44px; height: 44px; cursor: pointer;
}
main { padding: 1rem; max-width: 960px; margin: 0 auto; }

/* Composants */
.card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 1rem; margin-bottom: 1rem;
}
.card-head { display: flex; justify-content: space-between; align-items: center; gap: .6rem; flex-wrap: wrap; }
.row { display: flex; flex-wrap: wrap; gap: .6rem; margin-top: .6rem; }
.grid3 { display: grid; gap: 1rem; grid-template-columns: 1fr; margin-bottom: 1rem; }
.notice {
  background: #fff6e6; border-left: 4px solid var(--sand); padding: .6rem .8rem;
  border-radius: 6px; font-size: .92rem;
}
.hint { color: var(--muted); font-size: .9rem; }
.plain { margin: 0; padding-left: 1.1rem; }
.plain li { margin-bottom: .4rem; }

.hero {
  background: var(--deep); color: #fff; border-radius: var(--radius);
  padding: 1.6rem 1.2rem; margin-bottom: 1rem;
}
.hero p { color: #cfe3e7; max-width: 60ch; }

.btn {
  border: 0; border-radius: 8px; padding: .75rem 1.1rem; font: inherit; font-weight: 600;
  cursor: pointer; min-height: 44px;
}
.btn-accent { background: var(--accent); color: #fff; }
.btn-accent:active { background: var(--accent-dark); }
.btn-light { background: #e8eef2; color: var(--ink); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-small { padding: .4rem .8rem; min-height: 36px; background: #e8eef2; color: var(--ink); }

/* Statistiques */
.stats { display: grid; grid-template-columns: 1fr 1fr; gap: .7rem; margin-bottom: .6rem; }
.stat {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: .8rem; display: flex; flex-direction: column; gap: .3rem;
}
.stat span { color: var(--muted); font-size: .85rem; }
.stat strong { font-size: 1.25rem; overflow-wrap: anywhere; }

/* Formulaires */
label { display: block; font-weight: 600; font-size: .92rem; margin-top: .8rem; }
input, select, textarea {
  display: block; width: 100%; margin-top: .3rem; padding: .7rem; font: inherit; color: var(--ink);
  border: 1px solid #b9c6d0; border-radius: 8px; background: #fff;
}
input.invalid, textarea.invalid { border-color: var(--danger); }
.err { color: var(--danger); font-size: .85rem; min-height: 0; display: block; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: .6rem; }
.filters { display: grid; gap: .5rem; grid-template-columns: 1fr; margin-bottom: .8rem; }
.filters input, .filters select { margin-top: 0; }
pre {
  white-space: pre-wrap; word-wrap: break-word; font: inherit; background: var(--bg);
  padding: .8rem; border-radius: 8px; margin: .6rem 0 0;
}

/* Commandes */
.order {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: .8rem; margin-bottom: .6rem; display: flex; flex-direction: column; gap: .4rem;
}
.order-top { display: flex; justify-content: space-between; gap: .6rem; align-items: baseline; }
.order small { color: var(--muted); }
.order-actions { display: flex; gap: .5rem; }
.badge {
  display: inline-block; padding: .1rem .55rem; border-radius: 99px; font-size: .78rem;
  font-weight: 600; background: #e8eef2; color: var(--ink);
}
.badge.payée, .badge.livrée { background: #dff3e8; color: var(--ok); }
.badge.en-attente { background: #fdebd0; color: #8a5a00; }
.badge.annulée { background: #f8dcd9; color: var(--danger); }
.badge.demo { background: #e5e1f5; color: #4a3d99; margin-left: .3rem; }
.empty { text-align: center; color: var(--muted); padding: 1.2rem; }

/* Dialogue */
dialog {
  border: 0; border-radius: var(--radius); padding: 1.1rem; width: min(480px, 94vw);
  max-height: 92vh; overflow-y: auto; color: var(--ink);
}
dialog::backdrop { background: rgba(0,0,0,.5); }

/* Chat */
.chat-log {
  height: 48vh; min-height: 260px; overflow-y: auto; display: flex; flex-direction: column;
  gap: .5rem; padding: .3rem;
}
.msg { max-width: 85%; padding: .6rem .8rem; border-radius: 12px; white-space: pre-wrap; overflow-wrap: anywhere; }
.msg.bot { background: #e8eef2; align-self: flex-start; }
.msg.user { background: var(--accent); color: #fff; align-self: flex-end; }
.chips { display: flex; flex-wrap: wrap; gap: .4rem; margin: .6rem 0; }
.chip {
  border: 1px solid var(--accent); color: var(--accent-dark); background: #fff;
  border-radius: 99px; padding: .35rem .8rem; font: inherit; font-size: .88rem; cursor: pointer;
}
.chat-form { display: flex; gap: .5rem; }
.chat-form input { margin: 0; }

.toast {
  position: fixed; left: 50%; bottom: 1.2rem; transform: translate(-50%, 150%);
  background: var(--ink); color: #fff; padding: .7rem 1.1rem; border-radius: 8px;
  transition: transform .25s; z-index: 50; max-width: 90vw; text-align: center;
}
.toast.show { transform: translate(-50%, 0); }

/* Tablette et ordinateur */
/* Barre de navigation fixe en bas (téléphone et tablette) */
.bottombar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 15; display: flex;
  background: var(--card); border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom, 0px);
}
.bottombar button {
  flex: 1; min-height: 56px; border: 0; background: none; font: inherit; font-size: .8rem;
  font-weight: 600; color: var(--muted); cursor: pointer; padding: .3rem .1rem;
}
.bottombar button.active { color: var(--accent); box-shadow: inset 0 3px 0 var(--accent); }
main { padding-bottom: 5.5rem; }
.toast { bottom: 5rem; }

@media (min-width: 700px) {
  .grid3 { grid-template-columns: repeat(3, 1fr); }
  .stats { grid-template-columns: repeat(4, 1fr); }
  .filters { grid-template-columns: 2fr 1fr; }
  .order { flex-direction: row; align-items: center; justify-content: space-between; }
  .order-top { flex-direction: column; gap: 0; }
}
@media (min-width: 960px) {
  .sidebar { transform: none; }
  .overlay { display: none !important; }
  .main { margin-left: 260px; }
  .topbar .icon-btn { display: none; }
  .bottombar { display: none; }
  .toast { bottom: 1.2rem; }
  main { padding: 1.5rem; }
}
@media (prefers-reduced-motion: reduce) {
  .sidebar, .toast { transition: none; }
}

.btn[disabled] { opacity: .6; cursor: wait; }
