/* Application Noézio : mêmes couleurs que le site noezio.com, pensée d'abord pour le téléphone. */
:root {
  --bg: #fbfaf7;
  --surface: #ffffff;
  --ink: #16151a;
  --muted: #5d5b66;
  --line: #e7e4dd;
  --accent: #4b3fd6;
  --accent-soft: #eeecfd;
  --warm: #f2b84b;
  --late: #c2410c;
  --late-soft: #fdeee6;
  --ok: #15803d;
  --whatsapp: #128c4a;
  --radius: 14px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #111015;
    --surface: #1a1920;
    --ink: #f3f1ec;
    --muted: #a7a4b0;
    --line: #2b2a33;
    --accent: #8f86ff;
    --accent-soft: #24223a;
    --late: #fb923c;
    --late-soft: #2e1d14;
    --ok: #4ade80;
    --whatsapp: #34d399;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 16px;
  line-height: 1.5;
}
a { color: var(--accent); }
button { font: inherit; }

/* En-tête */
.topbar {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; gap: 12px;
  padding: calc(env(safe-area-inset-top) + 10px) 16px 10px;
  background: var(--bg); border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 18px; color: var(--ink); text-decoration: none; }
.tabs { display: flex; gap: 4px; margin-left: auto; }
.tabs a { padding: 6px 12px; border-radius: 999px; color: var(--muted); text-decoration: none; font-size: 15px; font-weight: 500; }
.tabs a.active { background: var(--accent-soft); color: var(--accent); }
.link { background: none; border: 0; color: var(--muted); font-size: 14px; cursor: pointer; padding: 6px; }
@media (max-width: 520px) {
  .topbar { gap: 6px; }
  .topbar .brand { font-size: 0; gap: 0; }
  .tabs { margin-left: 0; }
  #logout { margin-left: auto; }
}

.page { max-width: 720px; margin: 0 auto; padding: 20px 16px calc(env(safe-area-inset-bottom) + 40px); }
h1 { font-size: 26px; line-height: 1.2; margin: 4px 0 4px; letter-spacing: -0.01em; }
h2 { font-size: 15px; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); margin: 28px 0 10px; }
.sub { color: var(--muted); margin: 0 0 8px; }

/* Cartes */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; margin-bottom: 10px; }
.card.late { border-color: color-mix(in srgb, var(--late) 45%, var(--line)); }
.card-title { font-weight: 600; margin: 0; }
.card-meta { color: var(--muted); font-size: 14px; margin: 2px 0 0; }
.card-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.amount { font-weight: 700; white-space: nowrap; font-variant-numeric: tabular-nums; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
a.contact-link { color: inherit; text-decoration: none; display: block; }

.badge { display: inline-block; font-size: 12px; font-weight: 600; padding: 2px 8px; border-radius: 999px; background: var(--accent-soft); color: var(--accent); }
.badge.late { background: var(--late-soft); color: var(--late); }
.badge.done { background: transparent; color: var(--muted); border: 1px solid var(--line); }

/* Boutons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 40px; padding: 8px 16px; border-radius: 999px; border: 1px solid transparent;
  background: var(--accent); color: #fff; font-weight: 600; font-size: 15px; text-decoration: none; cursor: pointer;
}
.btn:disabled { opacity: 0.6; cursor: default; }
.btn-whatsapp { background: var(--whatsapp); }
.btn-ghost { background: transparent; color: var(--ink); border-color: var(--line); }
.btn-block { width: 100%; }

/* Connexion */
.login { max-width: 400px; margin: 12vh auto 0; text-align: center; }
.login img { margin-bottom: 12px; }
.login form { text-align: left; margin-top: 24px; }
label { display: block; font-weight: 600; font-size: 14px; margin-bottom: 6px; }
input[type="email"], input[type="search"] {
  width: 100%; min-height: 46px; padding: 10px 14px; font-size: 16px;
  border: 1px solid var(--line); border-radius: 12px; background: var(--surface); color: var(--ink);
}
input:focus-visible, .btn:focus-visible, .tabs a:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.notice { background: var(--accent-soft); border-radius: 12px; padding: 12px 14px; margin-top: 16px; font-size: 15px; }
.error { color: var(--late); }

/* Statistiques */
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 16px; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; }
.stat b { display: block; font-size: 22px; font-variant-numeric: tabular-nums; }
.stat span { color: var(--muted); font-size: 13px; }

.empty { color: var(--muted); text-align: center; padding: 28px 12px; border: 1px dashed var(--line); border-radius: var(--radius); }

/* Conversation */
.messages { display: flex; flex-direction: column; gap: 6px; }
.bubble { max-width: 85%; padding: 8px 12px; border-radius: 14px; background: var(--surface); border: 1px solid var(--line); font-size: 15px; white-space: pre-wrap; overflow-wrap: anywhere; }
.bubble.out { align-self: flex-end; background: var(--accent-soft); border-color: transparent; }
.bubble time { display: block; color: var(--muted); font-size: 12px; margin-top: 2px; }
.back { display: inline-block; margin-bottom: 8px; color: var(--muted); text-decoration: none; font-size: 15px; }
