/*
 * file: /var/www/vhosts/occicrunch.com/missive.occicrunch.com/assets/app.css
 * version: 1.0.0
 * description: Styles de l'admin et du wizard Missive. Palette sobre slate + indigo,
 *              mobile d'abord (navigation basse sur téléphone), mode sombre automatique.
 *              Aucune dépendance externe (zéro CDN).
 */

:root {
  --bg: #f8fafc;
  --surface: #ffffff;
  --surface-2: #f1f5f9;
  --border: #e2e8f0;
  --text: #0f172a;
  --muted: #64748b;
  --primary: #4f46e5;
  --primary-ink: #ffffff;
  --primary-soft: #eef2ff;
  --ok: #15803d;
  --ok-soft: #dcfce7;
  --warn: #b45309;
  --warn-soft: #fef3c7;
  --danger: #b91c1c;
  --danger-soft: #fee2e2;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(15, 23, 42, .06), 0 1px 3px rgba(15, 23, 42, .08);
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0b1120;
    --surface: #111827;
    --surface-2: #1e293b;
    --border: #273449;
    --text: #e2e8f0;
    --muted: #94a3b8;
    --primary: #818cf8;
    --primary-ink: #0b1120;
    --primary-soft: #1e1b4b;
    --ok: #4ade80;
    --ok-soft: #052e16;
    --warn: #fbbf24;
    --warn-soft: #422006;
    --danger: #f87171;
    --danger-soft: #450a0a;
    --shadow: none;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, Ubuntu, sans-serif;
  padding-bottom: calc(76px + env(safe-area-inset-bottom));
}
a { color: var(--primary); }
h1 { font-size: 1.35rem; margin: 0 0 1rem; }
h2 { font-size: 1.1rem; margin: 1.5rem 0 .75rem; }
p { margin: .5rem 0; }
small, .muted { color: var(--muted); }
code, .mono { font-family: var(--mono); font-size: .9em; word-break: break-all; }

/* ---------- En-tête ---------- */
.topbar {
  position: sticky; top: 0; z-index: 10;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 10px 16px;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
}
.brand { display: flex; flex-direction: column; line-height: 1.1; text-decoration: none; color: var(--text); }
.brand strong { font-size: 1.15rem; letter-spacing: -.01em; }
.brand span { font-size: .72rem; color: var(--muted); }
.topnav { display: none; gap: 4px; }
.topnav a, .bottomnav a {
  text-decoration: none; color: var(--muted); font-weight: 500;
  border-radius: 8px; padding: 8px 12px; position: relative;
}
.topnav a.on { color: var(--primary); background: var(--primary-soft); }

/* ---------- Navigation basse (téléphone) ---------- */
.bottomnav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 10;
  background: var(--surface);
  border-top: 1px solid var(--border);
  display: grid; grid-template-columns: repeat(4, 1fr);
  padding: 4px 4px calc(4px + env(safe-area-inset-bottom));
}
.bottomnav a {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  min-height: 56px; font-size: .75rem; padding: 4px;
}
.bottomnav a svg { width: 22px; height: 22px; margin-bottom: 2px; }
.bottomnav a.on { color: var(--primary); }
.badge {
  display: inline-block; min-width: 20px; padding: 0 6px; border-radius: 999px;
  background: var(--danger); color: #fff; font-size: .72rem; font-weight: 700; text-align: center; line-height: 20px;
}
.bottomnav .badge { position: absolute; top: 4px; right: calc(50% - 22px); }

@media (min-width: 768px) {
  body { padding-bottom: 32px; }
  .bottomnav { display: none; }
  .topnav { display: flex; }
}

/* ---------- Mise en page ---------- */
main { max-width: 860px; margin: 0 auto; padding: 16px; overflow-wrap: anywhere; }
.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 16px; margin-bottom: 12px;
}
.card h2:first-child, .card h3:first-child, .card > input[type=hidden] + h2, .card > input[type=hidden] + input[type=hidden] + h2 { margin-top: 0; }
.row { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; }
.between { justify-content: space-between; }
.grid2 { display: grid; gap: 12px; grid-template-columns: 1fr; }
@media (min-width: 640px) { .grid2 { grid-template-columns: 1fr 1fr; } }
.stack > * + * { margin-top: 12px; }
.empty { text-align: center; padding: 32px 16px; color: var(--muted); }

/* ---------- Liste de brouillons ---------- */
.item { display: block; text-decoration: none; color: inherit; }
.item:active { opacity: .7; }
.item .subject { font-weight: 600; margin: 2px 0; overflow-wrap: anywhere; }
.item .meta { font-size: .85rem; color: var(--muted); overflow-wrap: anywhere; }
.excerpt { font-size: .9rem; color: var(--muted); margin-top: 6px; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }

/* ---------- Pastilles d'état ---------- */
.pill { display: inline-block; font-size: .75rem; font-weight: 600; border-radius: 999px; padding: 2px 10px; }
.pill.pending { background: var(--warn-soft); color: var(--warn); }
.pill.sent, .pill.ok { background: var(--ok-soft); color: var(--ok); }
.pill.rejected, .pill.revoked, .pill.ko { background: var(--surface-2); color: var(--muted); }
.pill.failed { background: var(--danger-soft); color: var(--danger); }

/* ---------- Formulaires ---------- */
label { display: block; font-weight: 600; font-size: .9rem; margin-bottom: 4px; }
.field { margin-bottom: 14px; }
.hint { font-size: .82rem; color: var(--muted); margin-top: 4px; font-weight: 400; }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=url], select, textarea {
  width: 100%; font: inherit; font-size: 16px; color: var(--text);
  background: var(--surface); border: 1px solid var(--border); border-radius: 10px;
  padding: 10px 12px; min-height: 44px;
}
textarea { min-height: 220px; resize: vertical; line-height: 1.45; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--primary); outline-offset: 0; border-color: transparent; }
.check { display: flex; gap: 10px; align-items: flex-start; font-weight: 400; margin: 8px 0; }
.check input { width: 22px; height: 22px; margin: 1px 0 0; flex: none; accent-color: var(--primary); }

/* ---------- Boutons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font: inherit; font-weight: 600; border-radius: 10px; border: 1px solid var(--border);
  background: var(--surface); color: var(--text); padding: 10px 16px; min-height: 44px;
  text-decoration: none; cursor: pointer;
}
.btn.primary { background: var(--primary); border-color: var(--primary); color: var(--primary-ink); }
.btn.danger { color: var(--danger); }
.btn.small { min-height: 36px; padding: 6px 12px; font-size: .9rem; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 16px; }
.actions .btn { flex: 1 1 auto; }
@media (min-width: 640px) { .actions .btn { flex: 0 0 auto; } }
.sticky-actions {
  position: sticky; bottom: calc(68px + env(safe-area-inset-bottom)); z-index: 5;
  background: var(--bg); padding: 10px 0; margin-top: 8px;
}
@media (min-width: 768px) { .sticky-actions { bottom: 0; } }

/* ---------- Alertes ---------- */
.flash { border-radius: 10px; padding: 12px 14px; margin-bottom: 12px; font-weight: 500; overflow-wrap: anywhere; }
.flash.ok { background: var(--ok-soft); color: var(--ok); }
.flash.err { background: var(--danger-soft); color: var(--danger); }
.flash.warn { background: var(--warn-soft); color: var(--warn); }
.note { background: var(--primary-soft); border-radius: 10px; padding: 10px 12px; font-size: .92rem; overflow-wrap: anywhere; }

/* ---------- Blocs de code copiables ---------- */
.copy {
  display: flex; gap: 8px; align-items: stretch; margin: 6px 0 12px;
}
.copy code {
  flex: 1; display: block; background: var(--surface-2); border-radius: 8px;
  padding: 10px 12px; font-size: .85rem; overflow-x: auto; white-space: pre-wrap;
}
.copy .btn { flex: none; }

/* ---------- Tableaux → cartes sur mobile ---------- */
.table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.table th, .table td { text-align: left; padding: 8px; border-bottom: 1px solid var(--border); vertical-align: top; overflow-wrap: anywhere; }
.table th { color: var(--muted); font-weight: 600; font-size: .8rem; }
@media (max-width: 639px) {
  .table thead { display: none; }
  .table, .table tbody, .table tr, .table td { display: block; width: 100%; }
  .table tr { border-bottom: 1px solid var(--border); padding: 8px 0; }
  .table td { border: 0; padding: 2px 0; }
  .table td[data-l]::before { content: attr(data-l) " : "; color: var(--muted); font-size: .8rem; }
}

/* ---------- Message d'origine ---------- */
details { background: var(--surface-2); border-radius: 10px; padding: 10px 12px; margin: 12px 0; }
summary { cursor: pointer; font-weight: 600; min-height: 28px; }
.mailbody { white-space: pre-wrap; overflow-wrap: anywhere; font-size: .92rem; margin-top: 8px; max-height: 60vh; overflow-y: auto; }

/* ---------- Wizard ---------- */
.steps { display: flex; gap: 4px; margin: 0 0 16px; }
.steps i { flex: 1; height: 4px; border-radius: 4px; background: var(--border); }
.steps i.done { background: var(--primary); }
.checklist { list-style: none; padding: 0; margin: 0; }
.checklist li { display: flex; gap: 10px; justify-content: space-between; padding: 8px 0; border-bottom: 1px solid var(--border); }
.meter { height: 6px; border-radius: 6px; background: var(--border); overflow: hidden; margin-top: 6px; }
.meter b { display: block; height: 100%; width: 0; background: var(--danger); transition: width .2s; }
.log { font-family: var(--mono); font-size: .82rem; background: var(--surface-2); border-radius: 8px; padding: 10px; white-space: pre-wrap; min-height: 120px; }
.hidden { display: none !important; }
.login { max-width: 380px; margin: 10vh auto; }


/* ---------- Wizard : pas de navigation basse ---------- */
body.wizard { padding-bottom: 16px; }
body.wizard .sticky-actions { bottom: 0; }

/* ---------- Utilitaires (aucun style en ligne : CSP stricte) ---------- */
textarea.short { min-height: 90px; }
.mb { margin-bottom: 12px; }
.center { text-align: center; }
.btn.block { width: 100%; }

/* end of file: /var/www/vhosts/occicrunch.com/missive.occicrunch.com/assets/app.css */
