/* =============================================================
   Planify by Coleen — design system
   Palette calme : encre bleu-nuit + pétrole + crème
   ============================================================= */
:root {
  --sans: 'Plus Jakarta Sans', ui-sans-serif, system-ui, -apple-system, sans-serif;

  --bg:        #f4f3ef;
  --surface:   #ffffff;
  --surface-2: #faf9f6;

  --ink:    #14233b;
  --ink-2:  #34425c;
  --muted:  #6b7488;
  --muted-2:#9aa1b1;

  --line:   #e6e3da;
  --line-2: #d8d4c8;

  --accent:    #0e6f63;   /* pétrole */
  --accent-d:  #0a5750;
  --accent-2:  #e1f1ec;

  --info:   #1f4f8a;
  --danger: #a83626;
  --danger-2:#f6e3df;
  --warn:   #a55a1c;

  --sb-bg:  #14233b;
  --sb-ink: #c9d2e2;
  --sb-active: rgba(255,255,255,.10);
  --sb-accent: #3ed1bd;

  --r-sm: 7px;
  --r-md: 11px;
  --r-lg: 16px;
  --shadow-sm: 0 1px 2px rgba(20,35,59,.06);
  --shadow-md: 0 6px 20px -10px rgba(20,35,59,.18);
  --shadow-lg: 0 18px 50px -20px rgba(20,35,59,.30);
  --tr: 140ms cubic-bezier(.4,0,.2,1);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--sans);
  background: var(--bg);
  color: var(--ink);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1,h2,h3 { color: var(--ink); margin: 0 0 .4em; line-height: 1.25; }
h1 { font-size: 1.6rem; font-weight: 700; }
h2 { font-size: 1.2rem; font-weight: 700; }
h3 { font-size: 1rem; font-weight: 600; }
p { margin: 0 0 1em; }
small { color: var(--muted); }

/* --- Boutons --- */
.btn {
  display: inline-flex; align-items: center; gap: .5em;
  font: inherit; font-weight: 600; font-size: .92rem;
  padding: .6em 1.1em; border-radius: var(--r-sm);
  border: 1px solid transparent; cursor: pointer;
  transition: var(--tr); text-decoration: none; line-height: 1;
}
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-d); text-decoration: none; }
.btn-ghost { background: var(--surface); color: var(--ink); border-color: var(--line-2); }
.btn-ghost:hover { background: var(--surface-2); text-decoration: none; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { filter: brightness(.93); text-decoration: none; }
.btn-sm { padding: .4em .8em; font-size: .85rem; }
.btn-block { width: 100%; justify-content: center; }
.btn-google {
  background: #fff; color: var(--ink); border-color: var(--line-2);
}
.btn-google:hover { background: var(--surface-2); text-decoration: none; }

/* --- Formulaires --- */
.field { margin-bottom: 1.1rem; }
.field label { display: block; font-weight: 600; font-size: .88rem; margin-bottom: .35rem; color: var(--ink-2); }
.field .hint { font-weight: 400; color: var(--muted); font-size: .82rem; }
input[type=text], input[type=email], input[type=password], input[type=number],
input[type=date], input[type=time], select, textarea {
  width: 100%; font: inherit; font-size: .95rem;
  padding: .6em .75em; border: 1px solid var(--line-2);
  border-radius: var(--r-sm); background: var(--surface); color: var(--ink);
  transition: var(--tr);
}
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-2);
}
textarea { resize: vertical; min-height: 80px; }
.row { display: flex; gap: 1rem; flex-wrap: wrap; }
.row > * { flex: 1; min-width: 140px; }

/* --- Alertes --- */
.alert { padding: .8em 1em; border-radius: var(--r-sm); margin-bottom: 1rem; font-size: .9rem; }
.alert-error { background: var(--danger-2); color: var(--danger); border: 1px solid #e9c4bc; }
.alert-success { background: var(--accent-2); color: var(--accent-d); border: 1px solid var(--accent); }

/* --- Cartes --- */
.card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-md); padding: 1.4rem; box-shadow: var(--shadow-sm);
}

/* --- Badges --- */
.badge { display: inline-block; padding: .2em .6em; border-radius: 999px; font-size: .75rem; font-weight: 600; }
.badge-ok { background: var(--accent-2); color: var(--accent-d); }
.badge-cancel { background: var(--danger-2); color: var(--danger); }

/* =============================================================
   Layout authentifié : sidebar + contenu
   ============================================================= */
.layout { display: flex; min-height: 100vh; }
.sidebar {
  width: 240px; flex-shrink: 0; background: var(--sb-bg); color: var(--sb-ink);
  display: flex; flex-direction: column; padding: 1.2rem .9rem;
}
.sidebar .brand { display: flex; align-items: center; gap: .6rem; padding: .3rem .5rem 1.3rem; }
.sidebar .brand .logo {
  width: 34px; height: 34px; border-radius: 9px; background: var(--sb-accent);
  display: grid; place-items: center; color: var(--sb-bg); font-weight: 800;
}
.sidebar .brand b { color: #fff; font-size: 1.05rem; }
.sidebar nav { display: flex; flex-direction: column; gap: .15rem; flex: 1; }
.sidebar nav a {
  display: flex; align-items: center; gap: .6rem; color: var(--sb-ink);
  padding: .6rem .7rem; border-radius: var(--r-sm); font-weight: 500; font-size: .92rem;
  transition: var(--tr);
}
.sidebar nav a:hover { background: var(--sb-active); text-decoration: none; color: #fff; }
.sidebar nav a.active { background: var(--sb-active); color: #fff; }
.sidebar nav a.active { box-shadow: inset 3px 0 0 var(--sb-accent); }
.sidebar .sb-foot { border-top: 1px solid rgba(255,255,255,.1); padding-top: .9rem; font-size: .85rem; }
.sidebar .sb-foot .who { color: #fff; font-weight: 600; }
.sidebar .sb-foot a { color: var(--sb-ink); }

.main { flex: 1; min-width: 0; }
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 1rem 2rem; border-bottom: 1px solid var(--line); background: var(--surface);
}
.content { padding: 2rem; max-width: 1100px; }

/* Barre supérieure mobile (cachée sur desktop) */
.mobile-top { display: none; }
.brand-m { display: flex; align-items: center; gap: .5rem; font-weight: 800; color: var(--ink); }
.brand-m .logo { width: 30px; height: 30px; border-radius: 8px; background: var(--accent);
  color: #fff; display: grid; place-items: center; font-size: 1rem; }
.burger { background: none; border: none; cursor: pointer; padding: .4rem; display: grid; gap: 5px; }
.burger span { width: 22px; height: 2px; background: var(--ink); border-radius: 2px; display: block; }
.nav-overlay { display: none; }

/* Tableaux : permettre le défilement horizontal sur petit écran */
.table-wrap { width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }

.kpis { display: grid; grid-template-columns: repeat(auto-fit,minmax(180px,1fr)); gap: 1rem; margin-bottom: 1.6rem; }
.kpi { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); padding: 1.2rem; }
.kpi .n { font-size: 2rem; font-weight: 800; color: var(--accent); }
.kpi .l { color: var(--muted); font-size: .88rem; }

/* --- Tables --- */
table.list { width: 100%; border-collapse: collapse; background: var(--surface); border-radius: var(--r-md); overflow: hidden; border: 1px solid var(--line); }
table.list th, table.list td { padding: .8em 1em; text-align: left; border-bottom: 1px solid var(--line); }
table.list th { font-size: .78rem; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); background: var(--surface-2); }
table.list tr:last-child td { border-bottom: none; }

/* =============================================================
   Pages d'authentification (centrées)
   ============================================================= */
.auth-wrap { min-height: 100vh; display: grid; place-items: center; padding: 2rem; }
.auth-card { width: 100%; max-width: 420px; }
.auth-card .brand { text-align: center; margin-bottom: 1.6rem; }
.auth-card .brand .logo {
  width: 52px; height: 52px; border-radius: 14px; background: var(--accent);
  display: grid; place-items: center; color: #fff; font-weight: 800; font-size: 1.4rem; margin: 0 auto .8rem;
}
.auth-card .card { box-shadow: var(--shadow-md); }
.sep { display: flex; align-items: center; gap: .8rem; color: var(--muted); font-size: .82rem; margin: 1.1rem 0; }
.sep::before, .sep::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.muted-foot { text-align: center; margin-top: 1.1rem; font-size: .9rem; color: var(--muted); }

/* --- Utilitaires --- */
.stack > * + * { margin-top: 1rem; }
.flex { display: flex; align-items: center; gap: .6rem; }
.between { justify-content: space-between; }
.page-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1.4rem; gap: 1rem; flex-wrap: wrap; }
.empty { text-align: center; color: var(--muted); padding: 3rem 1rem; }
.dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; flex-shrink: 0; }

/* ---- Tablette ---- */
@media (max-width: 1024px) {
  .sidebar { width: 210px; }
  .content { padding: 1.6rem; }
}

/* ---- Mobile : sidebar en tiroir coulissant ---- */
@media (max-width: 760px) {
  .mobile-top {
    display: flex; align-items: center; gap: .8rem;
    padding: .7rem 1rem; border-bottom: 1px solid var(--line);
    background: var(--surface); position: sticky; top: 0; z-index: 30;
  }
  .sidebar {
    position: fixed; top: 0; left: 0; bottom: 0; width: 250px; z-index: 50;
    transform: translateX(-100%); transition: transform var(--tr);
  }
  body.nav-open .sidebar { transform: translateX(0); box-shadow: var(--shadow-lg); }
  body.nav-open .nav-overlay {
    display: block; position: fixed; inset: 0; z-index: 40;
    background: rgba(15,26,43,.45);
  }
  .content { padding: 1.1rem; }
  h1 { font-size: 1.35rem; }
  .page-head { gap: .6rem; }
  /* Les cartes d'action en pleine largeur */
  .page-head .btn { width: 100%; justify-content: center; }
  .page-head { flex-direction: column; align-items: stretch; }
}

/* ---- Très petits écrans ---- */
@media (max-width: 420px) {
  .kpis { grid-template-columns: 1fr 1fr; }
  .row { flex-direction: column; }
  .row > * { min-width: 0; }
}
