/* ============================================================
   Design system — DA extraite de la maquette Figma
   Fond crème chaud · navbar taupe · cartes blanches · accent orange
   Typo Archivo · gros chiffres noirs · vert positif · statut cyan
   ============================================================ */
@import url('https://fonts.googleapis.com/css2?family=Archivo:wght@400;500;600;700;800&display=swap');

:root {
  --bg: #F4F1EB;            /* fond crème chaud */
  --navbar: #BEAD8E;        /* taupe/khaki */
  --navbar-grad: linear-gradient(180deg, #C3B395 0%, #B8A584 100%);
  --card: #FFFFFF;
  --card-sub: #F1EFEA;      /* sous-cartes (tuiles) */
  --border: #E7E2D9;        /* bordure douce chaude */
  --border-strong: #D8D2C6;
  --accent: #FF5309;        /* orange accent (exact maquette) */
  --accent-press: #E04A07;
  --ink: #1A1A1A;           /* texte principal / gros chiffres */
  --muted: #9C9588;         /* texte secondaire chaud */
  --muted-2: #B7B0A2;
  --green: #2FA15A;
  --green-bg: #D9F0DD;
  --red: #D8472E;
  --status: #16D9C0;        /* pastille « à jour » */

  --r-card: 16px;
  --r-btn: 10px;
  --r-pill: 999px;
  --shadow: 0 1px 2px rgba(60,50,30,.04);
  --gap: 18px;
  --maxw: 1460px;
  --pad: 28px;
  font-family: 'Archivo', system-ui, -apple-system, 'Segoe UI', sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--ink); -webkit-font-smoothing: antialiased; }
a { color: inherit; text-decoration: none; }

/* ── NavBar ── */
.nav {
  position: sticky; top: 0; z-index: 50;
  background: var(--navbar-grad);
  height: 84px; display: flex; align-items: center; gap: 36px;
  padding: 0 40px; color: #fff;
}
.nav-links { display: flex; align-items: center; gap: 30px; }
.nav-links a { font-weight: 600; font-size: 17px; color: #fff; opacity: .92; padding: 6px 12px; border-radius: var(--r-btn); }
.nav-links a:hover { opacity: 1; }
.nav-links a.active { background: rgba(255,255,255,.22); opacity: 1; }
.nav-spacer { flex: 1; }
.nav-chip {
  display: inline-flex; align-items: center; gap: 8px;
  background: #fff; color: var(--ink); border-radius: var(--r-pill);
  padding: 8px 16px; font-weight: 700; font-size: 15px;
}
.nav-chip .tk { color: var(--accent); font-weight: 700; font-size: 12px; }
.nav-chip .eur { color: var(--muted); font-weight: 600; font-size: 12px; }
.nav-status { display: inline-flex; align-items: center; gap: 8px; color: #fff; font-size: 13px; font-weight: 500; opacity: .95; }
.nav-status .dot { width: 9px; height: 9px; border-radius: 50%; background: var(--status); box-shadow: 0 0 0 3px rgba(22,217,192,.25); }
.nav-status .dot.off { background: #E07A56; box-shadow: 0 0 0 3px rgba(224,122,86,.25); }
.nav-burger { display: none; background: none; border: 0; color: #fff; font-size: 26px; cursor: pointer; }

/* ── Layout ── */
.wrap { max-width: var(--maxw); margin: 0 auto; padding: 28px 40px 56px; }
.page-head { display: flex; align-items: center; gap: 26px; padding: 4px 4px 20px; }
.page-tab { font-size: 19px; font-weight: 600; color: var(--muted); cursor: pointer; }
.page-tab.active { color: var(--ink); }
.gear { margin-left: auto; width: 38px; height: 38px; border-radius: var(--r-btn); background: #fff; border: 1px solid var(--border); display: inline-flex; align-items: center; justify-content: center; cursor: pointer; color: var(--muted); }
.gear:hover { color: var(--accent); border-color: var(--accent); }

/* ── Cartes ── */
.card { background: var(--card); border: 1px solid var(--border); border-radius: var(--r-card); box-shadow: var(--shadow); padding: var(--pad); margin-bottom: var(--gap); }
.card.sub { background: var(--card-sub); border-color: var(--border); }
.grid { display: grid; gap: var(--gap); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-2 { grid-template-columns: 1.1fr 1.9fr; }
.split { display: grid; grid-template-columns: 360px 1fr; gap: 36px; align-items: center; }

/* ── Typo utilitaires ── */
.section-label { font-size: 11px; font-weight: 700; letter-spacing: .09em; text-transform: uppercase; color: var(--accent); margin: 0 0 14px; }
.label { font-size: 11px; color: var(--muted); margin: 0 0 6px; }
.stat-big { font-size: 47px; line-height: 1; font-weight: 800; letter-spacing: -.02em; margin: 0; color: var(--ink); }
.stat-md { font-size: 30px; font-weight: 800; letter-spacing: -.01em; margin: 0; color: var(--ink); }
.sub { font-size: 13px; color: var(--muted); margin: 8px 0 0; }
.muted { color: var(--muted); }
.pos { color: var(--green); font-weight: 600; }
.neg { color: var(--red); font-weight: 600; }

/* ── Pills / badges ── */
.pill { display: inline-flex; align-items: center; gap: 6px; border-radius: var(--r-pill); padding: 6px 14px; font-size: 14px; font-weight: 600; }
.pill.green { background: var(--green-bg); color: var(--green); }
.pill.grey { background: #ECE9E2; color: var(--muted); }
.pill.orange { background: #FCE6D9; color: var(--accent); }

/* ── Boutons ── */
.btn { font-family: inherit; font-size: 15px; font-weight: 600; border-radius: var(--r-btn); padding: 11px 18px; border: 1px solid var(--border-strong); background: #fff; color: var(--ink); cursor: pointer; }
.btn:hover { border-color: var(--accent); color: var(--accent); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; width: 100%; padding: 13px; }
.btn-primary:hover { background: var(--accent-press); border-color: var(--accent-press); color: #fff; }
.btn-danger { background: var(--red); border-color: var(--red); color: #fff; }
.btn-danger:hover { background: #b93a24; border-color: #b93a24; color: #fff; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }

/* ── Segmented ── */
.seg { display: inline-flex; background: #fff; border: 1px solid var(--border-strong); border-radius: var(--r-btn); padding: 3px; }
.seg button { font-family: inherit; border: 0; background: none; padding: 8px 22px; font-size: 14px; font-weight: 600; color: var(--muted); border-radius: 8px; cursor: pointer; }
.seg button.active { background: var(--accent); color: #fff; }

/* ── Segmented spécifique à l'auth (conteneur blanc, pastille active gris clair, texte foncé) ── */
.seg-auth { display: flex; width: 100%; background: #fff; border-radius: 12px; padding: 5px; gap: 4px; }
.seg-auth button { flex: 1; font-family: inherit; border: 0; background: transparent; padding: 9px 0; font-size: 14px; font-weight: 600; color: var(--ink); border-radius: 9px; cursor: pointer; }
.seg-auth button.active { background: #ECEAE6; }
.seg-auth button:not(.active) { color: #6f6a60; font-weight: 600; }

/* ── Inputs ── */
.field { margin-bottom: 12px; }
.input { width: 100%; font-family: inherit; font-size: 15px; padding: 12px 15px; border: 1px solid var(--border-strong); border-radius: var(--r-btn); background: #fff; color: var(--ink); }
.input::placeholder { color: var(--muted-2); letter-spacing: .04em; }
.input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(239,90,18,.12); }

/* ── Barre de progression (réserve) ── */
.progress { height: 6px; background: #EDEAE2; border-radius: var(--r-pill); overflow: hidden; }
.progress > i { display: block; height: 100%; background: var(--accent); border-radius: var(--r-pill); }
.progress-row { display: flex; justify-content: space-between; font-size: 11px; color: var(--muted); margin-top: 6px; }

/* ── Tableaux / listes ── */
.list { width: 100%; border-collapse: collapse; font-size: 14px; }
.list th { text-align: left; font-weight: 600; color: var(--muted); font-size: 12px; padding: 8px 10px; border-bottom: 1px solid var(--border); }
.list td { padding: 10px; border-bottom: 1px solid var(--border); }
.list tr:last-child td { border-bottom: 0; }

/* ── États (vide / chargement / erreur) ── */
.state { padding: 28px; text-align: center; color: var(--muted); font-size: 14px; }
.state.error { color: var(--red); }
.skeleton { background: linear-gradient(90deg, #EEEAE2 25%, #F5F2EC 50%, #EEEAE2 75%); background-size: 200% 100%; animation: sk 1.2s infinite; border-radius: 8px; height: 1em; }
@keyframes sk { from { background-position: 200% 0; } to { background-position: -200% 0; } }

/* ── Logo auth ── */
.auth-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: #fff; }
.auth-card { background: #ECEAE6; border-radius: var(--r-card); padding: 26px; width: 380px; }
.auth-logo { width: 54px; height: 52px; margin: 0 auto 22px; display: block; }

/* ── Drawer de réglages (glisse depuis la droite, ouvert par la roue crantée) ── */
.drawer-overlay {
  position: fixed; inset: 0; background: rgba(26, 26, 26, .35);
  opacity: 0; pointer-events: none; transition: opacity .25s ease; z-index: 60;
}
.drawer-overlay.open { opacity: 1; pointer-events: auto; }
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; width: min(440px, 92vw);
  background: var(--card); border-left: 1px solid var(--border);
  box-shadow: -12px 0 32px rgba(60, 50, 30, .14);
  transform: translateX(105%); transition: transform .28s cubic-bezier(.2, .7, .2, 1);
  z-index: 61; display: flex; flex-direction: column;
}
.drawer.open { transform: translateX(0); }
.drawer-head { display: flex; align-items: center; justify-content: space-between; padding: 24px 28px 18px; border-bottom: 1px solid var(--border); }
.drawer-title { font-size: 19px; font-weight: 700; margin: 0; }
.drawer-close { background: none; border: 0; font-size: 20px; color: var(--muted); cursor: pointer; padding: 6px 10px; border-radius: 8px; }
.drawer-close:hover { color: var(--accent); background: var(--card-sub); }
.drawer-body { padding: 24px 28px 32px; overflow-y: auto; flex: 1; }
.drawer-body .section-label { margin-top: 22px; }
.drawer-body .section-label:first-child { margin-top: 0; }
@media (prefers-reduced-motion: reduce) { .drawer, .drawer-overlay { transition: none; } }

/* ── Responsive ── */
@media (max-width: 980px) {
  .grid-3 { grid-template-columns: 1fr; }
  .grid-2, .split { grid-template-columns: 1fr; }
  .nav-links { display: none; }
  .nav-burger { display: block; }
  .wrap { padding: 20px 16px 40px; }
  .stat-big { font-size: 38px; }
}

/* Accessibilité : focus visible homogène */
a:focus-visible, button:focus-visible, .input:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
@media (prefers-reduced-motion: reduce) { .skeleton { animation: none; } }
