/* Le Sass — espace gérant */
:root {
  --bg: #0e0b16; --bg-2: #131029; --surface: #191333; --surface-2: #211a40;
  --violet: #8a6dff; --violet-soft: #b9a7ff; --gold: #cda253; --gold-soft: #e3c682;
  --text: #f4efe6; --muted: #b6accb; --muted-2: #8d84a4;
  --border: rgba(150,124,224,0.18); --border-soft: rgba(150,124,224,0.10);
  --danger: #ff6b6b; --success: #7ee0a7;
  --radius: 14px; --radius-sm: 10px; --ease: cubic-bezier(0.22,1,0.36,1);
}
* , *::before, *::after { box-sizing: border-box; }
body { margin: 0; font-family: "Karla", system-ui, sans-serif; background: var(--bg); color: var(--text); font-size: 16px; line-height: 1.55; }
h1, h2, h3 { font-family: "Playfair Display", Georgia, serif; margin: 0; }
input, button, textarea { font-family: inherit; }
:focus-visible { outline: 2px solid var(--violet-soft); outline-offset: 2px; }

.brand-mark { display: inline-grid; place-items: center; width: 30px; height: 30px; border-radius: 8px; background: linear-gradient(140deg, var(--violet), #6a4bd6); color: #fff; font-family: "Playfair Display", serif; font-weight: 700; }

/* Boutons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 0.5em; font-weight: 700; border-radius: 999px; border: 1px solid transparent; cursor: pointer; padding: 0.62em 1.15em; font-size: 0.95rem; transition: transform 0.15s var(--ease), background 0.2s, border-color 0.2s, box-shadow 0.2s; color: var(--text); background: transparent; }
.btn:hover { transform: translateY(-1px); }
.btn-sm { padding: 0.45em 0.9em; font-size: 0.85rem; }
.btn-primary { background: linear-gradient(135deg, var(--gold-soft), var(--gold)); color: #241804; box-shadow: 0 10px 24px -12px rgba(205,162,83,0.7); }
.btn-ghost { border-color: var(--border); background: rgba(255,255,255,0.02); }
.btn-ghost:hover { border-color: var(--violet); color: var(--violet-soft); }
.btn-add { border: 1px dashed var(--border); color: var(--violet-soft); background: rgba(138,109,255,0.06); font-weight: 600; }
.btn-add:hover { border-color: var(--violet); background: rgba(138,109,255,0.12); }
.btn-block { display: flex; width: 100%; margin-top: 14px; padding: 0.9em; }
.btn[disabled] { opacity: 0.55; cursor: progress; transform: none; }

.link-mini { color: var(--muted); font-size: 0.85rem; text-decoration: underline; text-underline-offset: 3px; }
.link-mini:hover { color: var(--gold-soft); }

/* ===== Connexion ===== */
.login-screen { min-height: 100vh; min-height: 100dvh; display: grid; place-items: center; padding: 24px;
  background: radial-gradient(60% 50% at 50% 0%, rgba(138,109,255,0.22), transparent 60%), var(--bg); }
.login-box { width: 100%; max-width: 380px; background: var(--surface); border: 1px solid var(--border); border-radius: 18px; padding: 34px 30px; box-shadow: 0 30px 60px -24px rgba(0,0,0,0.7); display: flex; flex-direction: column; }
.login-brand { display: flex; align-items: center; gap: 0.5rem; font-family: "Playfair Display", serif; font-size: 1.35rem; font-weight: 700; margin-bottom: 1.2rem; }
.login-box h1 { font-size: 1.7rem; margin-bottom: 0.3rem; }
.login-sub { color: var(--muted); font-size: 0.92rem; margin: 0 0 1.4rem; }
.login-box label { font-size: 0.85rem; font-weight: 600; color: var(--muted); margin-bottom: 0.4rem; }
.login-box input { background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius-sm); color: var(--text); padding: 0.75em 0.9em; font-size: 1rem; margin-bottom: 1.2rem; }
.login-box input:focus { outline: none; border-color: var(--violet); box-shadow: 0 0 0 3px rgba(138,109,255,0.18); }
.login-error { color: var(--danger); font-size: 0.9rem; min-height: 1.2em; margin: 0.8rem 0 0; }
.back-site { color: var(--muted-2); font-size: 0.86rem; margin-top: 1rem; text-align: center; }
.back-site:hover { color: var(--text); }

/* ===== Application ===== */
.admin-header { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 18px; flex-wrap: wrap; padding: 12px 22px; background: rgba(14,11,22,0.92); backdrop-filter: blur(12px); border-bottom: 1px solid var(--border); }
.admin-brand { display: flex; align-items: center; gap: 0.5rem; font-size: 0.98rem; }
.tabs { display: flex; gap: 6px; margin: 0 auto 0 8px; }
.tab { background: none; border: 0; color: var(--muted); font-weight: 700; padding: 8px 14px; border-radius: 999px; cursor: pointer; font-size: 0.95rem; }
.tab:hover { color: var(--text); background: rgba(138,109,255,0.08); }
.tab.active { color: var(--text); background: rgba(138,109,255,0.16); }
.badge { display: inline-grid; place-items: center; min-width: 20px; height: 20px; padding: 0 5px; border-radius: 999px; background: var(--gold); color: #241804; font-size: 0.72rem; font-weight: 800; margin-left: 4px; }
.admin-actions { display: flex; align-items: center; gap: 14px; }

.panel { max-width: 900px; margin: 0 auto; padding: 26px 22px 120px; }
.panel-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 22px; }
.panel-head h2 { font-size: 1.7rem; }
.hint { color: var(--muted); font-size: 0.9rem; margin: 0.3rem 0 0; max-width: 46ch; }
.panel-head-actions { display: flex; align-items: center; gap: 12px; }
.save-state { font-size: 0.86rem; font-weight: 600; }
.save-state.ok { color: var(--success); }
.save-state.err { color: var(--danger); }
.save-state.dirty { color: var(--gold-soft); }

.editor-field { margin-bottom: 22px; }
.editor-field label { display: block; font-size: 0.85rem; font-weight: 600; color: var(--muted); margin-bottom: 0.4rem; }
.editor-field input { width: 100%; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); color: var(--text); padding: 0.7em 0.9em; font-size: 1rem; }
.editor-field input:focus { outline: none; border-color: var(--violet); box-shadow: 0 0 0 3px rgba(138,109,255,0.18); }

/* Categories */
.cat-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; margin-bottom: 16px; }
.cat-head { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.cat-name { flex: 1; background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius-sm); color: var(--text); padding: 0.6em 0.8em; font-size: 1.1rem; font-weight: 700; font-family: "Playfair Display", serif; }
.cat-name:focus { outline: none; border-color: var(--violet); }
.cat-tools { display: flex; gap: 6px; }
.icon-btn { width: 34px; height: 34px; border-radius: 8px; border: 1px solid var(--border); background: rgba(255,255,255,0.03); color: var(--muted); cursor: pointer; font-size: 1rem; transition: background 0.2s, color 0.2s, border-color 0.2s; }
.icon-btn:hover { background: rgba(255,255,255,0.08); color: var(--text); }
.icon-btn.danger:hover { background: rgba(255,107,107,0.15); color: var(--danger); border-color: var(--danger); }

.items { display: flex; flex-direction: column; gap: 8px; margin-bottom: 12px; }
.item-row { display: flex; gap: 8px; align-items: stretch; background: var(--bg); border: 1px solid var(--border-soft); border-radius: var(--radius-sm); padding: 8px; }
.item-main { display: flex; flex-direction: column; gap: 6px; flex: 1; min-width: 0; }
.item-row input { background: var(--surface-2); border: 1px solid var(--border-soft); border-radius: 8px; color: var(--text); padding: 0.5em 0.7em; font-size: 0.95rem; }
.item-row input:focus { outline: none; border-color: var(--violet); }
.item-nom { font-weight: 600; }
.item-prix { width: 120px; flex: none; text-align: right; font-variant-numeric: tabular-nums; }
.item-row .del-item { align-self: center; }

.sticky-save { position: fixed; bottom: 0; left: 0; right: 0; z-index: 15; display: flex; align-items: center; justify-content: flex-end; gap: 14px; padding: 12px 22px; background: rgba(14,11,22,0.94); backdrop-filter: blur(12px); border-top: 1px solid var(--border); }

/* Messages */
#messages-list { display: flex; flex-direction: column; gap: 12px; }
.msg-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px 18px; }
.msg-card.unread { border-color: rgba(205,162,83,0.5); }
.msg-top { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.msg-from { font-weight: 700; font-size: 1.05rem; }
.msg-date { color: var(--muted-2); font-size: 0.82rem; }
.msg-meta { color: var(--muted); font-size: 0.88rem; margin: 0.3rem 0 0.7rem; display: flex; flex-wrap: wrap; gap: 4px 14px; }
.msg-meta a { color: var(--gold-soft); }
.msg-subject { color: var(--violet-soft); font-weight: 600; }
.msg-body { white-space: pre-wrap; color: var(--text); background: var(--bg); border-radius: var(--radius-sm); padding: 12px 14px; font-size: 0.94rem; }
.msg-actions { display: flex; gap: 10px; margin-top: 12px; }
.empty-state { text-align: center; color: var(--muted); padding: 60px 20px; }

@media (max-width: 620px) {
  .item-row { flex-wrap: wrap; }
  .item-prix { width: 100%; text-align: left; }
  .tabs { order: 3; width: 100%; margin: 6px 0 0; }
  .admin-header { gap: 10px; }
}
