/* ===========================================================================
   Le Gochoki — Back-office d'administration
   =========================================================================== */
:root {
  --ink: #1b1815; --ink-2: #241f1b; --gold: #c2a36b; --gold-deep: #a8884e;
  --bg: #f3efe7; --card: #fff; --line: #e7e0d2; --text: #2a2521; --soft: #786e62;
  --green: #2f8a55; --green-bg: #e3f3e9; --blue: #2f6c9b; --blue-bg: #e3eef7;
  --red: #b54a3a; --red-bg: #f7e6e2; --amber: #b07d1e; --amber-bg: #f7eed6;
  --serif: 'Cormorant Garamond', Georgia, serif;
  --sans: 'Inter', system-ui, sans-serif;
  --radius: 14px; --shadow: 0 14px 40px -26px rgba(20,15,10,.5);
}
* { box-sizing: border-box; }
body { margin: 0; font-family: var(--sans); background: var(--bg); color: var(--text); font-size: 15px; }
a { color: inherit; text-decoration: none; }
code { font-family: ui-monospace, Menlo, monospace; font-size: .85em; background: #00000010; padding: 1px 6px; border-radius: 5px; }
.muted { color: var(--soft); }
.small { font-size: .85em; }
.hint { color: var(--soft); font-size: .82rem; display: block; margin-top: 5px; }

/* ---- Connexion ------------------------------------------------------------ */
.login-body { min-height: 100vh; display: grid; place-items: center; background:
  radial-gradient(circle at 30% 20%, #2a2420, #161310); padding: 24px; }
.login-card { background: var(--card); border-radius: 20px; padding: 44px 40px; width: 100%; max-width: 410px;
  box-shadow: 0 30px 80px -30px rgba(0,0,0,.7); text-align: center; }
.login-logo { height: 70px; margin: 0 auto 10px; filter: drop-shadow(0 4px 10px rgba(0,0,0,.15)); }
.login-card h1 { font-family: var(--serif); font-size: 1.9rem; margin: 8px 0 2px; }
.login-sub { color: var(--soft); margin: 0 0 22px; font-size: .92rem; }
.login-form { text-align: left; }
.login-form label { display: block; font-size: .76rem; text-transform: uppercase; letter-spacing: .08em;
  color: var(--gold-deep); font-weight: 600; margin: 14px 0 6px; }
.login-form input { width: 100%; padding: 12px 14px; border: 1px solid var(--line); border-radius: 10px; font-size: 1rem; }
.login-form input:focus { outline: none; border-color: var(--gold); }
.login-back { display: inline-block; margin-top: 20px; color: var(--soft); font-size: .88rem; }

.btn-admin { display: inline-flex; align-items: center; justify-content: center; gap: .4em; cursor: pointer;
  font-family: var(--sans); font-weight: 600; font-size: .82rem; letter-spacing: .04em; padding: 12px 22px;
  border-radius: 10px; border: 1px solid transparent; transition: .2s; }
.btn-gold-admin { background: var(--gold); color: #1c1813; width: 100%; margin-top: 22px; }
.login-form .btn-gold-admin, .stack-form .btn-gold-admin { font-size: .9rem; }
.btn-gold-admin:hover { background: var(--gold-deep); }
.btn-ghost { background: transparent; border-color: var(--line); color: var(--text); }
.btn-ghost:hover { border-color: var(--gold); color: var(--gold-deep); }
.btn-mini { padding: 8px 14px; font-size: .76rem; background: var(--ink); color: #fff; width: 100%; }
.btn-mini:hover { background: var(--gold-deep); }

/* ---- Mise en page --------------------------------------------------------- */
.admin { display: flex; min-height: 100vh; }
.sidebar { width: 250px; background: var(--ink); color: #d8cdbd; display: flex; flex-direction: column;
  position: fixed; inset: 0 auto 0 0; z-index: 50; }
.sidebar-brand { display: flex; align-items: center; gap: 12px; padding: 22px 22px 18px; border-bottom: 1px solid #ffffff12; }
.sb-mark { width: 42px; height: 42px; display: grid; place-items: center; border-radius: 11px; background: var(--gold);
  color: var(--ink); font-family: var(--serif); font-weight: 700; font-size: 1.5rem; }
.sidebar-brand strong { display: block; color: #fff; font-family: var(--serif); font-size: 1.25rem; line-height: 1; }
.sidebar-brand small { color: var(--gold); font-size: .72rem; letter-spacing: .1em; text-transform: uppercase; }
.sidebar-nav { display: flex; flex-direction: column; padding: 16px 12px; gap: 3px; flex: 1; }
.sidebar-nav a { display: flex; align-items: center; gap: 11px; padding: 11px 14px; border-radius: 10px;
  color: #cabfb0; font-weight: 500; font-size: .94rem; transition: .18s; position: relative; }
.sidebar-nav a:hover { background: #ffffff0d; color: #fff; }
.sidebar-nav a.active { background: var(--gold); color: var(--ink); font-weight: 600; }
.sidebar-nav .ic { width: 20px; text-align: center; opacity: .9; }
.badge { margin-left: auto; background: var(--red); color: #fff; font-size: .72rem; font-weight: 700;
  min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px; display: grid; place-items: center; }
.sidebar-nav a.active .badge { background: var(--ink); color: #fff; }
.sidebar-foot { padding: 16px; border-top: 1px solid #ffffff12; display: flex; flex-direction: column; gap: 10px; }
.sb-link { color: #cabfb0; font-size: .88rem; }
.sb-link:hover { color: var(--gold); }
.sb-logout { width: 100%; padding: 10px; background: #ffffff10; color: #e9ddcb; border: 1px solid #ffffff1a;
  border-radius: 9px; cursor: pointer; font-family: var(--sans); font-size: .88rem; transition: .2s; }
.sb-logout:hover { background: var(--red); border-color: var(--red); color: #fff; }

.main-col { margin-left: 250px; flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar { display: flex; align-items: center; gap: 16px; padding: 18px 30px; background: #fff;
  border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 30; }
.topbar-title { font-family: var(--serif); font-size: 1.6rem; margin: 0; font-weight: 600; }
.topbar-user { margin-left: auto; }
.user-chip { background: var(--bg); border: 1px solid var(--line); padding: 7px 16px; border-radius: 30px; font-weight: 600; font-size: .9rem; }
.burger { display: none; background: none; border: 0; font-size: 1.5rem; cursor: pointer; color: var(--ink); }
.content { padding: 30px; max-width: 1100px; width: 100%; }

/* ---- Flash ---------------------------------------------------------------- */
.flash { margin: 18px 30px 0; padding: 13px 18px; border-radius: 10px; font-weight: 500; font-size: .92rem; }
.flash small { display: block; font-weight: 400; opacity: .8; margin-top: 4px; }
.flash-ok { background: var(--green-bg); color: var(--green); border: 1px solid #bfe3cd; }
.flash-err { background: var(--red-bg); color: var(--red); border: 1px solid #ecc7bf; }

/* ---- Cartes & panneaux ---------------------------------------------------- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 26px; box-shadow: var(--shadow); }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 22px; }
.panel { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px 24px; box-shadow: var(--shadow); }
.panel-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.panel-head h2 { font-family: var(--serif); font-size: 1.4rem; margin: 0; }
.panel-link { color: var(--gold-deep); font-size: .85rem; font-weight: 600; }
.empty { color: var(--soft); padding: 18px 0; font-style: italic; }
.empty.card { text-align: center; padding: 40px; }
.page-intro { color: var(--soft); margin: 0 0 20px; }

/* ---- Statistiques --------------------------------------------------------- */
.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 18px; margin-bottom: 24px; }
.stat-card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px 24px; box-shadow: var(--shadow); }
.stat-card.accent { background: linear-gradient(150deg, var(--ink), #3a3128); border-color: var(--ink); }
.stat-card.accent .stat-num { color: var(--gold); }
.stat-card.accent .stat-label { color: #cabfb0; }
.stat-num { display: block; font-family: var(--serif); font-size: 2.6rem; font-weight: 700; line-height: 1; }
.stat-label { display: block; margin-top: 6px; color: var(--soft); font-size: .82rem; text-transform: uppercase; letter-spacing: .06em; }

/* ---- Tables --------------------------------------------------------------- */
.table-wrap { overflow-x: auto; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.table th { text-align: left; padding: 13px 14px; font-size: .72rem; text-transform: uppercase; letter-spacing: .06em;
  color: var(--soft); border-bottom: 1px solid var(--line); background: #faf7f1; white-space: nowrap; }
.table td { padding: 13px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr:hover { background: #faf7f1; }
.table.compact th, .table.compact td { padding: 9px 10px; }
.row-new { background: #fffaf0; }
.nowrap { white-space: nowrap; }
.note-cell { max-width: 200px; color: var(--soft); font-size: .85rem; }
.contact-cell a { color: var(--blue); }
.contact-cell .muted { color: var(--soft); }

.pill { display: inline-block; padding: 4px 11px; border-radius: 20px; font-size: .74rem; font-weight: 600; text-transform: capitalize; }
.pill-nouvelle { background: var(--blue-bg); color: var(--blue); }
.pill-confirmee { background: var(--green-bg); color: var(--green); }
.pill-honoree { background: var(--amber-bg); color: var(--amber); }
.pill-annulee { background: #ececec; color: #777; }

.wa { display: inline-block; padding: 3px 9px; border-radius: 6px; font-size: .72rem; font-weight: 600; text-transform: capitalize; }
.wa-sent { background: var(--green-bg); color: var(--green); }
.wa-pending { background: #eee; color: #888; }
.wa-failed { background: var(--red-bg); color: var(--red); }
.wa-skipped { background: var(--amber-bg); color: var(--amber); }

.inline-form { display: inline; }
.inline-form select { padding: 6px 8px; border-radius: 8px; border: 1px solid var(--line); font-size: .82rem; background: #fff; cursor: pointer; }
.actions-cell { white-space: nowrap; }
.icon-btn { background: #f1ece2; border: 1px solid var(--line); width: 32px; height: 32px; border-radius: 8px;
  cursor: pointer; font-size: .95rem; line-height: 1; transition: .18s; margin-left: 3px; }
.icon-btn:hover { background: var(--gold); border-color: var(--gold); }
.icon-btn.danger:hover { background: var(--red); border-color: var(--red); color: #fff; }

.filter-bar { display: flex; align-items: center; gap: 8px; margin-bottom: 20px; flex-wrap: wrap; }
.chip { padding: 7px 16px; border-radius: 30px; background: #fff; border: 1px solid var(--line);
  font-size: .85rem; font-weight: 500; text-transform: capitalize; transition: .18s; }
.chip:hover { border-color: var(--gold); }
.chip.on { background: var(--ink); color: #fff; border-color: var(--ink); }
.filter-count { margin-left: auto; color: var(--soft); font-size: .85rem; }
.pager { display: flex; gap: 6px; margin-top: 18px; justify-content: center; }
.pager a { padding: 8px 13px; border-radius: 9px; background: #fff; border: 1px solid var(--line); font-size: .88rem; }
.pager a.on { background: var(--gold); border-color: var(--gold); color: var(--ink); font-weight: 600; }

/* ---- Messages ------------------------------------------------------------- */
.msg-mini { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.msg-mini li { padding-left: 14px; border-left: 3px solid var(--line); }
.msg-mini li.unread { border-color: var(--gold); }
.msg-mini strong { display: block; }
.msg-mini-body { color: var(--soft); font-size: .88rem; }
.msg-mini time { display: block; color: var(--soft); font-size: .76rem; margin-top: 3px; }

.msg-list { display: grid; gap: 16px; }
.msg-card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px 24px; box-shadow: var(--shadow); }
.msg-card.unread { border-left: 4px solid var(--gold); }
.msg-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; margin-bottom: 10px; flex-wrap: wrap; }
.msg-head strong { font-size: 1.05rem; }
.msg-subject { color: var(--soft); }
.dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; background: var(--gold); margin-left: 6px; }
.msg-head time { color: var(--soft); font-size: .82rem; }
.msg-body { margin: 0 0 16px; white-space: pre-wrap; line-height: 1.6; }
.msg-foot { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding-top: 14px; border-top: 1px solid var(--line); flex-wrap: wrap; }
.msg-contact { display: flex; gap: 16px; font-size: .88rem; }
.msg-contact a { color: var(--blue); }
.msg-actions { display: flex; gap: 6px; }

/* ---- Formulaire contenu --------------------------------------------------- */
.content-form { display: flex; flex-direction: column; gap: 22px; }
.content-group { padding: 24px 26px; }
.group-title { font-family: var(--serif); font-size: 1.5rem; margin: 0 0 18px; padding-bottom: 12px; border-bottom: 1px solid var(--line); }
.fields { display: grid; grid-template-columns: 1fr 1fr; gap: 16px 20px; }
.admin-field { display: flex; flex-direction: column; }
.admin-field.full { grid-column: 1 / -1; }
.admin-field label { font-size: .78rem; font-weight: 600; color: var(--gold-deep); margin-bottom: 6px; text-transform: uppercase; letter-spacing: .04em; }
.admin-field input, .admin-field textarea, .admin-field select {
  padding: 11px 13px; border: 1px solid var(--line); border-radius: 9px; font-family: var(--sans); font-size: .95rem; background: #fff; color: var(--text); width: 100%; }
.admin-field textarea { resize: vertical; min-height: 78px; line-height: 1.5; }
.admin-field input:focus, .admin-field textarea:focus, .admin-field select:focus { outline: none; border-color: var(--gold); }
.sticky-save { position: sticky; bottom: 0; background: linear-gradient(0deg, var(--bg) 60%, transparent);
  padding: 16px 0 6px; display: flex; justify-content: flex-end; }
.sticky-save .btn-gold-admin { width: auto; margin: 0; padding: 13px 30px; }

.image-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 20px; margin-top: 16px; }
.image-card { border: 1px solid var(--line); border-radius: 12px; padding: 14px; background: #fbf9f4; }
.image-preview { height: 130px; border-radius: 9px; background-size: cover; background-position: center; background-color: #e9e2d4; margin-bottom: 12px; border: 1px solid var(--line); }
.image-card h3 { font-size: .95rem; margin: 0 0 10px; }
.image-form { display: flex; flex-direction: column; gap: 8px; }
.image-form input[type=file] { font-size: .8rem; }
.image-form input[type=url] { padding: 9px 11px; border: 1px solid var(--line); border-radius: 8px; font-size: .85rem; }
.image-form .or { text-align: center; color: var(--soft); font-size: .76rem; text-transform: uppercase; letter-spacing: .1em; }
.image-path { display: block; margin-top: 10px; font-size: .72rem; color: var(--soft); word-break: break-all; background: none; padding: 0; }

/* ---- Réglages ------------------------------------------------------------- */
.stack-form { display: flex; flex-direction: column; gap: 14px; }
.stack-form .btn-gold-admin { width: auto; align-self: flex-start; margin-top: 8px; padding: 12px 26px; }
.switch { display: flex; align-items: center; gap: 10px; font-weight: 600; cursor: pointer; }
.switch input { width: 18px; height: 18px; accent-color: var(--gold-deep); }
.days-row { display: flex; gap: 8px; flex-wrap: wrap; }
.day-check { display: inline-flex; align-items: center; gap: 6px; padding: 8px 12px; border: 1px solid var(--line);
  border-radius: 9px; cursor: pointer; font-size: .9rem; background: #fff; transition: border-color .15s; }
.day-check:hover { border-color: var(--gold); }
.day-check input { accent-color: var(--gold-deep); }
.beer-now { font-size: 1.05rem; margin: 4px 0 14px; }
.prov-block { border: 1px solid var(--line); border-radius: 11px; padding: 16px 18px; margin: 4px 0; }
.prov-block legend { font-weight: 700; color: var(--gold-deep); padding: 0 8px; font-size: .85rem; text-transform: uppercase; letter-spacing: .05em; }
.prov-block .hint { margin-bottom: 12px; }
.btn-detect { margin-top: 12px; }
.test-form { margin-top: 18px; padding-top: 18px; border-top: 1px solid var(--line); display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.info-box { margin-top: 22px; padding: 16px 18px; background: var(--bg); border-radius: 11px; }
.info-box h3 { margin: 0 0 4px; font-size: .78rem; text-transform: uppercase; letter-spacing: .06em; color: var(--soft); }
.info-box p { margin: 0; }

/* ---- Réglages : mise en page aérée ---- */
.settings-page { display: flex; flex-direction: column; gap: 28px; max-width: 880px; }
.settings-page .card { padding: 30px 32px; }
.settings-page .group-title { font-size: 1.7rem; }
.btn-big { padding: 16px 32px; font-size: .98rem; width: auto; align-self: flex-start; }

/* Éditeur d'horaires par jour */
.hours-form { display: flex; flex-direction: column; gap: 18px; }
.day-block { border: 1px solid var(--line); border-radius: 14px; padding: 18px 20px; background: #fbf9f4; }
.day-block-head { display: flex; align-items: center; gap: 12px; margin-bottom: 8px; }
.day-name { font-family: var(--serif); font-size: 1.4rem; font-weight: 600; }
.day-state { font-size: .7rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em;
  padding: 4px 12px; border-radius: 20px; }
.day-state.open { background: var(--green-bg); color: var(--green); }
.day-state.closed { background: #ececec; color: #888; }
.slot-section { display: flex; align-items: flex-start; gap: 14px; margin-top: 10px; }
.slot-label { flex: 0 0 44px; padding-top: 13px; font-size: .74rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: .05em; color: var(--gold-deep); }
.slot-grid { display: flex; flex-wrap: wrap; gap: 9px; flex: 1; }
.slot-btn { padding: 12px 16px; border-radius: 11px; border: 1.5px solid var(--line); background: #fff;
  color: var(--soft); font-family: var(--sans); font-size: 1rem; font-weight: 600; cursor: pointer;
  transition: transform .12s, background .15s, border-color .15s, color .15s; min-width: 64px; }
.slot-btn:hover { border-color: var(--gold); }
.slot-btn:active { transform: scale(.94); }
.slot-btn.on { background: var(--gold); border-color: var(--gold); color: var(--ink); box-shadow: 0 5px 14px -7px rgba(168,136,78,.85); }

/* Zone de danger (reset des bières ADN) */
.danger-zone { border: 2px dashed #d98b6a; background: #fdf3ee; }
.danger-title { font-family: var(--serif); font-size: 1.7rem; margin: 0 0 12px; color: var(--red); }
.danger-zone p { color: #7a4a38; }
.btn-danger { margin-top: 10px; padding: 18px 32px; border: 0; border-radius: 14px; cursor: pointer;
  background: linear-gradient(160deg, #d9533a, #b5391f); color: #fff; font-family: var(--sans);
  font-weight: 700; font-size: 1.06rem; letter-spacing: .02em; box-shadow: 0 12px 28px -12px rgba(181,57,31,.85);
  transition: transform .15s, box-shadow .2s; }
.btn-danger:hover { transform: translateY(-2px) rotate(-.6deg); box-shadow: 0 16px 34px -12px rgba(181,57,31,.95); }
.btn-danger:active { transform: scale(.97); }

.staff-note { display: block; margin-top: 6px; padding-top: 6px; border-top: 1px dashed var(--line);
  color: var(--gold-deep); font-size: .82rem; }

/* ---- Agenda des réservations à venir -------------------------------------- */
.agenda { margin-top: 44px; }
.agenda-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.agenda-title { font-family: var(--serif); font-size: 1.7rem; margin: 0; }
.agenda-count { color: var(--soft); font-size: .88rem; }
.agenda .page-intro { margin: 6px 0 22px; }

.agenda-day { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); margin-bottom: 18px; overflow: hidden; }
.agenda-day-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px;
  padding: 14px 22px; background: #faf7f1; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.agenda-day-title { font-family: var(--serif); font-size: 1.35rem; margin: 0; font-weight: 600; }
.agenda-rel { font-family: var(--sans); font-size: .66rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: .06em; color: var(--ink); background: var(--gold); padding: 3px 10px; border-radius: 20px;
  vertical-align: middle; margin-left: 4px; }
.agenda-day-meta { color: var(--soft); font-size: .84rem; }

.agenda-list { display: flex; flex-direction: column; }
.agenda-resa { display: flex; gap: 16px; padding: 16px 22px; border-top: 1px solid var(--line); }
.agenda-resa:first-child { border-top: 0; }
.agenda-resa:target { background: #fffaf0; box-shadow: inset 4px 0 0 var(--gold); }
.agenda-time { flex: 0 0 56px; font-family: var(--serif); font-size: 1.5rem; font-weight: 700;
  color: var(--gold-deep); line-height: 1.3; }
.agenda-body { flex: 1; min-width: 0; }
.agenda-line { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.agenda-name { font-size: 1.02rem; }
.agenda-guests { color: var(--soft); font-size: .86rem; }
.agenda-phone { color: var(--blue); font-size: .88rem; }
.agenda-cnote { margin: 8px 0 0; color: var(--soft); font-size: .88rem; }

.agenda-note-form { margin-top: 12px; }
.agenda-note-label { display: block; font-size: .7rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: .05em; color: var(--gold-deep); margin-bottom: 6px; }
.agenda-note-row { display: flex; gap: 8px; align-items: flex-start; }
.agenda-note-row textarea { flex: 1; min-height: 42px; padding: 10px 12px; border: 1px solid var(--line);
  border-radius: 9px; font-family: var(--sans); font-size: .9rem; background: #fff; color: var(--text);
  resize: vertical; line-height: 1.45; }
.agenda-note-row textarea:focus { outline: none; border-color: var(--gold); }
.btn-note { flex: 0 0 auto; padding: 10px 18px; font-size: .78rem; }

/* ---- Responsive ----------------------------------------------------------- */
@media (max-width: 860px) {
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
  .grid-2, .fields { grid-template-columns: 1fr; }
}
@media (max-width: 720px) {
  .sidebar { transform: translateX(-100%); transition: transform .3s ease; }
  .sidebar.open { transform: translateX(0); }
  .main-col { margin-left: 0; }
  .burger { display: block; }
  .content, .flash { padding-inline: 18px; margin-inline: 0; }
  .content { padding-top: 22px; }
  .agenda-resa { flex-direction: column; gap: 6px; }
  .agenda-time { flex-basis: auto; font-size: 1.3rem; }
  .agenda-note-row { flex-direction: column; }
  .btn-note { width: 100%; }
}
