/* ================= MTR Store - thème clair, moderne & interactif ================= */
:root {
  --accent: #6366f1;
  --accent-d: #4f46e5;
  --accent-soft: #eef0ff;
  --bg: #f6f7fb;
  --card: #ffffff;
  --txt: #1c1f2a;
  --muted: #6b7280;
  --line: #e7e9f0;
  --green: #16a34a;
  --green-soft: #e7f6ec;
  --red: #e11d48;
  --red-soft: #fde7ec;
  --amber: #d97706;
  --amber-soft: #fef3e2;
  --blue: #2563eb;
  --blue-soft: #e6efff;
  --radius: 16px;
  --shadow-sm: 0 1px 2px rgba(16,24,40,.06), 0 1px 3px rgba(16,24,40,.08);
  --shadow: 0 10px 25px rgba(16,24,40,.08);
  --shadow-lg: 0 20px 45px rgba(16,24,40,.16);
  --font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0; font-family: var(--font); background: var(--bg); color: var(--txt);
  line-height: 1.55; -webkit-font-smoothing: antialiased;
}
a { color: var(--accent-d); text-decoration: none; }
img { max-width: 100%; display: block; }
h1, h2, h3 { font-weight: 800; letter-spacing: -.02em; margin: 0; }
.container { max-width: 1140px; margin: 0 auto; padding: 0 20px; }

@keyframes fadeUp { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
@keyframes pop { 0% { transform: scale(.9); } 60% { transform: scale(1.04); } 100% { transform: scale(1); } }
@keyframes pulse { 0%,100% { box-shadow: 0 0 0 0 rgba(99,102,241,.45); } 50% { box-shadow: 0 0 0 10px rgba(99,102,241,0); } }

/* ---------- annonce ---------- */
.announce {
  background: linear-gradient(90deg, var(--accent), var(--accent-d));
  color: #fff; text-align: center; font-size: 14px; font-weight: 500; padding: 9px 16px;
}

/* ---------- header ---------- */
header.site {
  position: sticky; top: 0; z-index: 40; background: rgba(255,255,255,.85);
  backdrop-filter: blur(12px); border-bottom: 1px solid var(--line);
}
.nav { display: flex; align-items: center; justify-content: space-between; height: 64px; }
.brand { display: flex; align-items: center; gap: 11px; }
.brand .logo {
  width: 38px; height: 38px; border-radius: 11px; color: #fff; font-weight: 800; font-size: 18px;
  background: linear-gradient(135deg, var(--accent), var(--accent-d)); display: grid; place-items: center;
  box-shadow: var(--shadow-sm);
}
.brand .name { font-weight: 800; font-size: 19px; letter-spacing: -.02em; }
.brand .name small { display: block; font-weight: 500; font-size: 11px; color: var(--muted); letter-spacing: .12em; text-transform: uppercase; }
.nav-links { display: flex; gap: 6px; align-items: center; }
.nav-links a { color: var(--muted); font-size: 14px; font-weight: 500; padding: 8px 12px; border-radius: 9px; transition: .15s; }
.nav-links a:hover { color: var(--txt); background: var(--accent-soft); }
@media (max-width: 640px) { .nav-links { display: none; } }

/* ---------- hero ---------- */
.hero { padding: 70px 0 48px; text-align: center; background:
  radial-gradient(900px 360px at 50% -40%, var(--accent-soft), transparent 70%); }
.hero .eyebrow { animation: fadeUp .5s both; }
.hero h1 { font-size: clamp(32px, 6vw, 54px); margin: 10px 0 14px; animation: fadeUp .5s .05s both; }
.hero p { color: var(--muted); max-width: 540px; margin: 0 auto 26px; font-size: 17px; animation: fadeUp .5s .1s both; }
.hero .cta { display: inline-flex; gap: 12px; flex-wrap: wrap; justify-content: center; animation: fadeUp .5s .15s both; }
.eyebrow { color: var(--accent-d); text-transform: uppercase; letter-spacing: .14em; font-size: 12px; font-weight: 700; }

/* ---------- boutons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 8px; justify-content: center;
  border: 1px solid var(--line); background: var(--card); color: var(--txt);
  padding: 11px 20px; border-radius: 11px; cursor: pointer; font-size: 14px; font-weight: 600;
  font-family: var(--font); transition: transform .12s, box-shadow .15s, background .15s, border-color .15s;
}
.btn:hover { box-shadow: var(--shadow-sm); border-color: #d4d7e3; }
.btn:active { transform: scale(.97); }
.btn.primary { background: var(--accent); color: #fff; border: none; box-shadow: 0 6px 16px rgba(99,102,241,.32); }
.btn.primary:hover { background: var(--accent-d); transform: translateY(-1px); box-shadow: 0 10px 22px rgba(99,102,241,.4); }
.btn.ghost { background: transparent; }
.btn.danger { color: var(--red); border-color: var(--red-soft); background: var(--red-soft); }
.btn.danger:hover { background: var(--red); color: #fff; border-color: var(--red); }
.btn.sm { padding: 7px 13px; font-size: 13px; border-radius: 9px; }
.btn:disabled { opacity: .55; cursor: not-allowed; }

/* ---------- sections ---------- */
section { padding: 50px 0; }
.section-head { text-align: center; margin-bottom: 34px; }
.section-head h2 { font-size: 30px; margin-bottom: 8px; }
.section-head p { color: var(--muted); margin: 0; }

/* ---------- grille produits ---------- */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 22px; }
.product {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  overflow: hidden; display: flex; flex-direction: column; transition: transform .18s, box-shadow .2s;
  animation: fadeUp .4s both;
}
.product:hover { transform: translateY(-6px); box-shadow: var(--shadow-lg); }
.product .ph { aspect-ratio: 4/3; background: #eef0f5; overflow: hidden; position: relative; }
.product .ph img { width: 100%; height: 100%; object-fit: cover; transition: transform .45s; }
.product:hover .ph img { transform: scale(1.06); }
.product .tag {
  position: absolute; top: 10px; left: 10px; background: rgba(255,255,255,.92);
  color: var(--accent-d); font-size: 11px; font-weight: 700; padding: 4px 10px; border-radius: 999px;
  text-transform: uppercase; letter-spacing: .04em; backdrop-filter: blur(4px);
}
.product .body { padding: 15px 16px 18px; display: flex; flex-direction: column; gap: 5px; flex: 1; }
.product .pname { font-weight: 700; font-size: 18px; letter-spacing: -.01em; }
.product .desc { color: var(--muted); font-size: 13.5px; flex: 1; }
.product .row { display: flex; align-items: center; justify-content: space-between; margin-top: 8px; }
.product .price { font-size: 21px; font-weight: 800; }
.badge { font-size: 12px; font-weight: 600; padding: 3px 10px; border-radius: 999px; }
.badge.stock { color: var(--green); background: var(--green-soft); }
.badge.out { color: var(--red); background: var(--red-soft); }

/* ---------- barre de recherche ---------- */
.search-bar { max-width: 720px; margin: 0 auto 30px; }
.search-input { position: relative; display: flex; align-items: center; }
.search-input .search-ico { position: absolute; left: 16px; font-size: 16px; opacity: .55; pointer-events: none; }
.search-input input { padding-left: 42px; padding-right: 40px; height: 50px; border-radius: 999px; font-size: 15px; box-shadow: var(--shadow-sm); }
.search-clear { position: absolute; right: 8px; width: 32px; height: 32px; border-radius: 50%; border: none; background: var(--bg); color: var(--muted); font-size: 20px; line-height: 1; cursor: pointer; display: grid; place-items: center; }
.search-clear:hover { background: var(--line); color: var(--txt); }
.brand-chips { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin-top: 16px; }
.chip { background: var(--card); border: 1px solid var(--line); color: var(--muted); padding: 6px 13px; border-radius: 999px; font-size: 13px; font-weight: 600; cursor: pointer; transition: .12s; }
.chip:hover { border-color: var(--accent); color: var(--accent-d); }
.chip.active { background: var(--accent); color: #fff; border-color: var(--accent); }
.search-count { text-align: center; color: var(--muted); font-size: 13px; margin-top: 14px; }

/* ---------- demande spéciale (encadré orange) ---------- */
.special-banner { max-width: 640px; margin: 26px auto 0; background: #fff7ed; border: 1px solid #fdba74; border-radius: 14px; padding: 16px 18px; display: flex; align-items: center; gap: 16px; justify-content: space-between; flex-wrap: wrap; box-shadow: 0 8px 22px rgba(234,88,12,.14); animation: fadeUp .5s .2s both; }
.special-banner .sb-text { color: #9a3412; font-weight: 600; font-size: 14px; text-align: left; flex: 1; min-width: 220px; line-height: 1.45; }
.order-closed { background: #fff7ed; border: 1px solid #fdba74; color: #9a3412; border-radius: 12px; padding: 13px 15px; font-size: 13.5px; font-weight: 600; line-height: 1.5; }
.special-btn { background: #f97316; color: #fff; border: none; box-shadow: 0 6px 16px rgba(249,115,22,.35); white-space: nowrap; }
.special-btn:hover { background: #ea580c; transform: translateY(-1px); }
@media (max-width: 560px) { .special-banner { flex-direction: column; text-align: center; } .special-banner .sb-text { text-align: center; } .special-btn { width: 100%; } }

/* upload photo (formulaire demande) */
.photo-drop { display: flex; align-items: center; justify-content: center; gap: 8px; border: 1.5px dashed var(--line); border-radius: 12px; padding: 16px; cursor: pointer; color: var(--muted); font-size: 14px; font-weight: 600; transition: .15s; }
.photo-drop:hover { border-color: var(--accent); color: var(--accent-d); background: var(--accent-soft); }
.photo-preview { max-width: 100%; max-height: 220px; border-radius: 12px; margin-top: 10px; border: 1px solid var(--line); }

/* chat : pièce jointe + image dans bulle */
.chat-attach { width: 42px; height: 42px; flex-shrink: 0; border-radius: 50%; display: grid; place-items: center; cursor: pointer; font-size: 18px; background: var(--bg); border: 1px solid var(--line); }
.chat-attach:hover { background: var(--accent-soft); border-color: var(--accent); }
.chat-photo-preview { position: relative; padding: 8px 12px 0 14px; }
.chat-photo-preview img { max-height: 80px; border-radius: 8px; border: 1px solid var(--line); display: block; }
.chat-photo-preview button { position: absolute; top: 2px; left: 86px; background: var(--red); color: #fff; border: none; width: 22px; height: 22px; border-radius: 50%; cursor: pointer; font-size: 15px; line-height: 1; }
.msg img.msg-img { max-width: 100%; border-radius: 10px; display: block; cursor: pointer; }
.msg img.msg-img + .time { margin-top: 4px; }
/* badge de section (depuis quelle interface le client écrit) */
.msg-ctx { font-size: 10px; font-weight: 700; padding: 1px 7px; border-radius: 999px; }
.msg-ctx.puff { background: #ede9fe; color: #6d28d9; }
.msg-ctx.watch { background: var(--accent-soft); color: var(--accent-d); }
.msg .msg-ctx { display: block; width: fit-content; margin: 0 0 4px; }
.cp .msg-ctx { display: inline-block; margin-right: 4px; vertical-align: middle; }

/* ---------- calendrier ---------- */
.cal-wrap { max-width: 720px; margin: 0 auto; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; box-shadow: var(--shadow-sm); }
.cal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.cal-head h3 { font-size: 19px; text-transform: capitalize; }
.cal-nav { display: flex; gap: 8px; }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.cal-dow { text-align: center; color: var(--muted); font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; padding-bottom: 6px; }
.cal-day { aspect-ratio: 1/1; display: grid; place-items: center; border-radius: 10px; font-size: 14px; color: var(--muted); background: var(--bg); border: 1px solid transparent; transition: .12s; }
.cal-day.empty { background: transparent; }
.cal-day.past { opacity: .35; }
.cal-day.open { background: var(--green-soft); color: var(--green); font-weight: 700; border-color: #bfe6cd; }
.cal-day.today { box-shadow: inset 0 0 0 2px var(--accent); color: var(--accent-d); font-weight: 700; }
.cal-legend { display: flex; gap: 18px; justify-content: center; margin-top: 16px; color: var(--muted); font-size: 13px; flex-wrap: wrap; }
.dot { display: inline-block; width: 11px; height: 11px; border-radius: 4px; margin-right: 6px; vertical-align: middle; }
.dot.open { background: var(--green); }
.dot.closed { background: var(--bg); border: 1px solid var(--line); }
.periods-list { max-width: 720px; margin: 18px auto 0; display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; }
.period-chip { background: var(--green-soft); border: 1px solid #bfe6cd; color: var(--green); padding: 7px 14px; border-radius: 999px; font-size: 13px; font-weight: 600; }

/* ---------- modale ---------- */
.modal-bg { position: fixed; inset: 0; background: rgba(17,21,35,.5); backdrop-filter: blur(3px); display: none; align-items: flex-start; justify-content: center; z-index: 100; padding: 28px 16px; overflow-y: auto; }
.modal-bg.show { display: flex; }
.modal { background: var(--card); border-radius: 18px; width: 100%; max-width: 720px; box-shadow: var(--shadow-lg); overflow: hidden; animation: pop .22s both; }
.modal-top { display: grid; grid-template-columns: 1fr 1fr; }
@media (max-width: 620px) { .modal-top { grid-template-columns: 1fr; } }
.modal-top .img { background: #eef0f5; min-height: 220px; }
.modal-top .img img { width: 100%; height: 100%; object-fit: cover; }
.modal-top .info { padding: 22px; }
.modal-top .info h3 { font-size: 25px; margin: 6px 0 8px; }
.modal .price-lg { font-size: 27px; font-weight: 800; color: var(--accent-d); }
.specs { list-style: none; padding: 0; margin: 14px 0 0; display: grid; grid-template-columns: 1fr 1fr; gap: 6px 16px; }
.specs li { font-size: 13px; color: var(--muted); display: flex; justify-content: space-between; gap: 10px; border-bottom: 1px solid var(--line); padding: 5px 0; }
.specs li span { color: var(--txt); font-weight: 600; text-align: right; }
.modal-form { padding: 22px; border-top: 1px solid var(--line); }
.modal-form h4 { margin-bottom: 14px; font-size: 13px; color: var(--accent-d); text-transform: uppercase; letter-spacing: .08em; }
.modal-close { position: absolute; top: 14px; right: 16px; width: 34px; height: 34px; border-radius: 50%; font-size: 22px; color: var(--txt); cursor: pointer; background: rgba(255,255,255,.9); border: 1px solid var(--line); z-index: 2; display: grid; place-items: center; }
.modal-close:hover { background: #fff; }

/* ---------- formulaires ---------- */
.field { margin-bottom: 14px; }
.field label { display: block; font-size: 13px; font-weight: 600; color: var(--txt); margin-bottom: 6px; }
.field .req { color: var(--accent-d); }
input, select, textarea { width: 100%; background: #fff; border: 1px solid var(--line); color: var(--txt); padding: 11px 12px; border-radius: 10px; font-size: 14px; font-family: var(--font); transition: border-color .15s, box-shadow .15s; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
textarea { resize: vertical; min-height: 70px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 540px) { .form-row { grid-template-columns: 1fr; } }
.help { font-size: 12px; color: var(--muted); margin-top: 4px; }

/* ---------- toast ---------- */
.toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%) translateY(20px); background: var(--txt); color: #fff; padding: 13px 22px; border-radius: 12px; box-shadow: var(--shadow-lg); z-index: 300; opacity: 0; pointer-events: none; transition: .25s; max-width: 90vw; text-align: center; font-weight: 500; font-size: 14px; }
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.err { background: var(--red); }
.toast.ok { background: var(--green); }

/* ---------- footer ---------- */
footer.site { border-top: 1px solid var(--line); padding: 36px 0; color: var(--muted); font-size: 14px; background: var(--card); }
.foot-grid { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 20px; }
.foot-grid a { color: var(--muted); }
.foot-grid a:hover { color: var(--accent-d); }

/* ---------- confirmation ---------- */
.confirm-box { padding: 40px 24px; text-align: center; }
.confirm-box .check { width: 64px; height: 64px; margin: 0 auto 16px; border-radius: 50%; background: var(--green-soft); color: var(--green); display: grid; place-items: center; font-size: 32px; animation: pop .3s both; }
.empty-note { text-align: center; color: var(--muted); padding: 30px; }

/* =================== WIDGET CHAT CLIENT =================== */
.chat-fab {
  position: fixed; bottom: 22px; right: 22px; z-index: 150; width: 60px; height: 60px; border-radius: 50%;
  background: var(--accent); color: #fff; border: none; cursor: pointer; box-shadow: var(--shadow-lg);
  font-size: 26px; display: grid; place-items: center; transition: transform .15s; animation: pulse 2.4s infinite;
}
.chat-fab:hover { transform: scale(1.08); background: var(--accent-d); }
.chat-fab .badge-dot { position: absolute; top: -3px; right: -3px; min-width: 22px; height: 22px; padding: 0 5px; border-radius: 999px; background: var(--red); color: #fff; font-size: 12px; font-weight: 700; display: none; place-items: center; border: 2px solid var(--bg); }
.chat-fab .badge-dot.show { display: grid; }

.chat-panel {
  position: fixed; bottom: 22px; right: 22px; z-index: 151; width: 370px; max-width: calc(100vw - 32px);
  height: 540px; max-height: calc(100vh - 44px); background: var(--card); border-radius: 18px;
  box-shadow: var(--shadow-lg); display: none; flex-direction: column; overflow: hidden; animation: pop .2s both;
}
.chat-panel.show { display: flex; }
.chat-head { background: linear-gradient(135deg, var(--accent), var(--accent-d)); color: #fff; padding: 16px 18px; display: flex; align-items: center; justify-content: space-between; }
.chat-head .t { font-weight: 700; font-size: 16px; }
.chat-head .s { font-size: 12px; opacity: .85; }
.chat-head button { background: rgba(255,255,255,.2); border: none; color: #fff; width: 30px; height: 30px; border-radius: 50%; cursor: pointer; font-size: 18px; }
.chat-head button:hover { background: rgba(255,255,255,.32); }
.chat-body { flex: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 10px; background: var(--bg); }
.chat-intro { text-align: center; color: var(--muted); font-size: 13px; margin: auto 0; padding: 20px; }
.msg { max-width: 80%; padding: 9px 13px; border-radius: 14px; font-size: 14px; line-height: 1.4; white-space: pre-wrap; word-wrap: break-word; animation: fadeUp .25s both; }
.msg .time { display: block; font-size: 10px; opacity: .6; margin-top: 3px; }
.msg.client { align-self: flex-end; background: var(--accent); color: #fff; border-bottom-right-radius: 4px; }
.msg.admin { align-self: flex-start; background: #fff; border: 1px solid var(--line); border-bottom-left-radius: 4px; }
.msg.system { align-self: center; background: var(--amber-soft); color: var(--amber); border: 1px solid #f5dcae; font-size: 12.5px; max-width: 92%; border-radius: 12px; }
.chat-foot { padding: 12px; border-top: 1px solid var(--line); display: flex; gap: 8px; background: var(--card); }
.chat-foot input { border-radius: 999px; }
.chat-foot button { flex-shrink: 0; width: 42px; height: 42px; border-radius: 50%; padding: 0; }
.chat-name-row { padding: 0 12px 12px; }

/* =================== ADMIN =================== */
.login-screen { min-height: 100vh; display: grid; place-items: center; padding: 20px; }
.login-card { background: var(--card); border-radius: 18px; padding: 34px; width: 100%; max-width: 400px; box-shadow: var(--shadow); animation: fadeUp .4s both; }
.login-card .logo { width: 54px; height: 54px; border-radius: 14px; margin: 0 auto 18px; background: linear-gradient(135deg, var(--accent), var(--accent-d)); display: grid; place-items: center; font-weight: 800; color: #fff; font-size: 24px; }
.login-card h1 { text-align: center; font-size: 23px; margin-bottom: 4px; }
.login-card p { text-align: center; color: var(--muted); margin: 0 0 22px; font-size: 14px; }

.admin-shell { display: none; }
.admin-shell.show { display: block; }
.admin-top { background: var(--card); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 30; }
.admin-top .nav { height: 60px; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 26px; overflow-x: auto; }
.tab { padding: 13px 16px; cursor: pointer; color: var(--muted); border-bottom: 2px solid transparent; white-space: nowrap; font-size: 14px; font-weight: 600; transition: .12s; display: flex; align-items: center; gap: 7px; }
.tab:hover { color: var(--txt); }
.tab.active { color: var(--accent-d); border-bottom-color: var(--accent); }
.tab .pill { background: var(--red); color: #fff; font-size: 11px; font-weight: 700; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px; display: none; place-items: center; }
.tab .pill.show { display: grid; }
.tab-panel { display: none; animation: fadeUp .3s both; }
.tab-panel.active { display: block; }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 16px; margin-bottom: 28px; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 18px; box-shadow: var(--shadow-sm); }
.stat .n { font-size: 28px; font-weight: 800; letter-spacing: -.02em; }
.stat .l { color: var(--muted); font-size: 13px; margin-top: 2px; }
.stat .n.accent { color: var(--accent-d); }

table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 11px 12px; border-bottom: 1px solid var(--line); font-size: 14px; vertical-align: top; }
th { color: var(--muted); font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; }
tr:hover td { background: var(--bg); }
.tbl-wrap { background: var(--card); border: 1px solid var(--line); border-radius: 14px; overflow: hidden; box-shadow: var(--shadow-sm); }
.tbl-scroll { overflow-x: auto; }

.status { font-size: 12px; font-weight: 600; padding: 3px 10px; border-radius: 999px; display: inline-block; }
.status.pending { color: var(--amber); background: var(--amber-soft); }
.status.confirmed { color: var(--blue); background: var(--blue-soft); }
.status.completed { color: var(--green); background: var(--green-soft); }
.status.cancelled { color: var(--red); background: var(--red-soft); }

.panel-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px; flex-wrap: wrap; gap: 12px; }
.panel-head h2 { font-size: 23px; }
.admin-card { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 20px; margin-bottom: 16px; box-shadow: var(--shadow-sm); }
.admin-card h3 { margin-bottom: 14px; font-size: 17px; }

.prod-admin { display: grid; grid-template-columns: 90px 1fr auto; gap: 16px; align-items: center; }
.prod-admin .thumb { width: 90px; height: 70px; border-radius: 10px; object-fit: cover; background: #eef0f5; }
@media (max-width: 600px) { .prod-admin { grid-template-columns: 1fr; } .prod-admin .thumb { width: 100%; height: 150px; } }

.spec-rows { display: flex; flex-direction: column; gap: 8px; }
.spec-row { display: grid; grid-template-columns: 1fr 1fr auto; gap: 8px; }
.period-row { display: grid; grid-template-columns: 1fr 1fr 1fr auto; gap: 10px; align-items: end; margin-bottom: 10px; }
@media (max-width: 700px) { .period-row { grid-template-columns: 1fr 1fr; } }

.filters { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.filters select, .filters input { width: auto; }
.flex { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.spacer { flex: 1; }
.hidden { display: none !important; }

/* ---- admin : messagerie ---- */
.chat-layout { display: grid; grid-template-columns: 320px 1fr; gap: 16px; height: 600px; }
@media (max-width: 800px) { .chat-layout { grid-template-columns: 1fr; height: auto; } .chat-layout.thread-open .conv-list { display: none; } .chat-layout:not(.thread-open) .thread-pane { display: none; } }
.conv-list { background: var(--card); border: 1px solid var(--line); border-radius: 14px; overflow-y: auto; box-shadow: var(--shadow-sm); }
.conv-item { padding: 14px 16px; border-bottom: 1px solid var(--line); cursor: pointer; transition: .12s; }
.conv-item:hover { background: var(--bg); }
.conv-item.active { background: var(--accent-soft); }
.conv-item .cn { font-weight: 700; font-size: 14px; display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.conv-item .cp { color: var(--muted); font-size: 13px; margin-top: 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.conv-item .undot { background: var(--red); color: #fff; font-size: 11px; font-weight: 700; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px; display: grid; place-items: center; }
.conv-time { color: var(--muted); font-size: 11px; font-weight: 500; }
.thread-pane { background: var(--card); border: 1px solid var(--line); border-radius: 14px; display: flex; flex-direction: column; overflow: hidden; box-shadow: var(--shadow-sm); }
.thread-head { padding: 14px 18px; border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.thread-head .tn { font-weight: 700; }
.thread-body { flex: 1; overflow-y: auto; padding: 18px; display: flex; flex-direction: column; gap: 10px; background: var(--bg); min-height: 320px; }
.thread-foot { padding: 12px; border-top: 1px solid var(--line); display: flex; gap: 8px; }
.thread-empty { margin: auto; color: var(--muted); text-align: center; padding: 30px; }
.back-btn { display: none; }
@media (max-width: 800px) { .back-btn { display: inline-flex; } }

/* ---- responsive petits ecrans ---- */
@media (max-width: 480px) {
  .chat-layout { min-height: 320px; }
  .thread-body { min-height: 240px; }
}
@media (max-width: 420px) {
  .chat-panel { width: calc(100vw - 16px); max-width: none; right: 8px; bottom: 8px; height: calc(100vh - 90px); max-height: none; }
  .chat-fab { bottom: 16px; right: 16px; }
}

/* ---- écran d'entrée client (compte) ---- */
#app, #puffApp, #modeGate { display: none; }
body.authed #authGate { display: none; }
body.authed #modeGate { display: flex; }
body.authed.mode-montres #modeGate, body.authed.mode-puffs #modeGate { display: none; }
body.authed.mode-montres #app { display: block; }
body.authed.mode-puffs #puffApp { display: block; }
/* chat masqué tant qu'aucune section n'est choisie */
body:not(.mode-montres):not(.mode-puffs) .chat-fab,
body:not(.mode-montres):not(.mode-puffs) .chat-panel { display: none !important; }

/* écran de choix de section */
#modeGate { min-height: 100vh; align-items: center; justify-content: center; padding: 24px; }
.mode-wrap { background: var(--card); border-radius: 18px; padding: 36px 30px; width: 100%; max-width: 560px; box-shadow: var(--shadow); text-align: center; animation: fadeUp .4s both; }
.mode-wrap .logo { width: 54px; height: 54px; border-radius: 14px; margin: 0 auto 16px; background: linear-gradient(135deg, var(--accent), var(--accent-d)); display: grid; place-items: center; font-weight: 800; color: #fff; font-size: 24px; }
.mode-wrap h1 { font-size: 24px; margin-bottom: 4px; }
.mode-wrap p { color: var(--muted); margin: 0 0 24px; }
.mode-cards { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 480px) { .mode-cards { grid-template-columns: 1fr; } }
.mode-card { background: var(--bg); border: 2px solid var(--line); border-radius: 16px; padding: 26px 18px; cursor: pointer; transition: .15s; text-align: center; font-family: var(--font); }
.mode-card:hover { border-color: var(--accent); transform: translateY(-3px); box-shadow: var(--shadow); background: var(--accent-soft); }
.mode-card .mc-ico { font-size: 40px; margin-bottom: 10px; }
.mode-card .mc-title { font-weight: 800; font-size: 19px; color: var(--txt); }
.mode-card .mc-desc { color: var(--muted); font-size: 13px; margin-top: 4px; line-height: 1.4; }
.mode-logout { margin-top: 22px; background: none; border: none; color: var(--muted); cursor: pointer; font-size: 13px; font-family: var(--font); text-decoration: underline; }
.mode-logout:hover { color: var(--txt); }

/* bandeau âge (puffs) */
.age-notice { max-width: 560px; margin: 22px auto 0; background: #fef3c7; border: 1px solid #fcd34d; color: #92400e; border-radius: 12px; padding: 12px 16px; font-size: 13px; font-weight: 600; }

/* historique des demandes (puffs) */
.req-item { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; margin-bottom: 12px; box-shadow: var(--shadow-sm); animation: fadeUp .3s both; }
.req-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.req-head strong { font-size: 15px; }
.req-meta { color: var(--muted); font-size: 12.5px; margin-top: 4px; }
.req-det { font-size: 14px; margin-top: 6px; color: var(--txt); }
.auth-tabs { display: flex; gap: 6px; background: var(--bg); padding: 4px; border-radius: 11px; margin-bottom: 18px; }
.auth-tab { flex: 1; text-align: center; padding: 9px; border-radius: 8px; cursor: pointer; font-weight: 600; font-size: 14px; color: var(--muted); transition: .12s; }
.auth-tab.active { background: var(--card); color: var(--accent-d); box-shadow: var(--shadow-sm); }
.user-chip { display: flex; align-items: center; gap: 10px; }
.user-chip .uname { font-weight: 600; font-size: 14px; }
.user-chip .uname::before { content: "👤 "; }
@media (max-width: 680px) { .user-chip .uname { display: none; } .nav-links { display: none; } }
