/* ============================================================================
   downloads.atempo.com — charte Atempo (reprise de D:\DASHBOARD)
   Greige + teal. Layout back (sidebar) + front (appbar).
   ========================================================================== */
:root {
  --bg1:        #ECEBE5;   /* greige charte Atempo */
  --bg2:        #F4F3EE;
  --ink:        #16242C;   /* presque noir des titres / wordmark */
  --teal-light: #8FCBD0;
  --teal:       #2F7E88;   /* accent principal */
  --teal-dark:  #1E4E57;
  --grad:       linear-gradient(135deg, #2F7E88 0%, #1E4E57 100%);
  --muted:      #76786f;
  --line:       #dcdbd2;
  --ok:         #2f8f6b;
  --warn:       #c08a2d;
  --err:        #c0392b;
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  font-family: 'Segoe UI', system-ui, -apple-system, Roboto, Arial, sans-serif;
  font-size: 14px; line-height: 1.5; color: var(--ink);
  background: linear-gradient(180deg, var(--bg1), var(--bg2));
  margin: 0; min-height: 100vh;
}
a { color: var(--teal-dark); }

/* ---------- Layout back-office : sidebar + main ---------- */
.layout { display: flex; min-height: 100vh; }
.sidebar {
  width: 248px; flex: 0 0 248px; background: #fff;
  border-right: 1px solid var(--line); display: flex; flex-direction: column;
  box-shadow: 0 2px 14px rgba(22, 36, 44, .05);
}
.sidebar-header { padding: 18px 20px; border-bottom: 1px solid var(--line); }
.sidebar-logo { display: flex; align-items: center; gap: 12px; }
.sidebar-logo-icon {
  width: 38px; height: 38px; border-radius: 11px; background: var(--grad);
  display: flex; align-items: center; justify-content: center; flex: 0 0 38px;
}
.sidebar-logo-icon svg { width: 20px; height: 20px; fill: none; stroke: #fff;
  stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.sidebar-logo-name { font-weight: 700; font-size: 15px; color: var(--ink); }
.sidebar-logo-sub  { font-size: 11px; color: var(--muted); }
.sidebar-section { padding: 14px 12px 4px; }
.sidebar-section-label {
  font-size: 10px; text-transform: uppercase; letter-spacing: .6px;
  color: var(--muted); padding: 0 10px 6px; font-weight: 700;
}
.nav-link {
  display: flex; align-items: center; gap: 11px; padding: 9px 12px; margin: 2px 0;
  border-radius: 10px; color: var(--ink); text-decoration: none; font-size: 13.5px;
  font-weight: 500; transition: background .12s, color .12s;
}
.nav-link svg { width: 18px; height: 18px; fill: none; stroke: currentColor;
  stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; opacity: .8; }
.nav-link:hover { background: #f0efe9; }
.nav-link.active { background: var(--teal); color: #fff; box-shadow: 0 2px 8px rgba(30,78,87,.28); }
.nav-link.active svg { opacity: 1; }
.sidebar-footer { margin-top: auto; padding: 14px; border-top: 1px solid var(--line); }
.user-chip { display: flex; align-items: center; gap: 10px; }
.user-avatar {
  width: 36px; height: 36px; border-radius: 50%; background: var(--grad); color: #fff;
  display: flex; align-items: center; justify-content: center; font-weight: 700; flex: 0 0 36px;
}
.user-name { font-weight: 600; font-size: 13px; }
.user-role { font-size: 11px; color: var(--muted); }
.logout-btn svg { width: 18px; height: 18px; fill: none; stroke: var(--muted);
  stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.logout-btn:hover svg { stroke: var(--err); }
.main { flex: 1; min-width: 0; padding: 26px 30px; }

/* ---------- Front : appbar pleine largeur ---------- */
.appbar { background: #fff; padding: 16px 28px;
  box-shadow: 0 1px 0 var(--line), 0 2px 14px rgba(22, 36, 44, .05);
  display: flex; align-items: center; justify-content: space-between; }
.appbar h1 { font-size: 21px; font-weight: 700; margin: 0; color: var(--ink); }
.appbar .sub { font-size: 12px; color: var(--muted); margin-top: 3px; }
.appbar-right { display: flex; align-items: center; gap: 18px; }
.appbar .logout, .appbar .who {
  color: var(--teal-dark); text-decoration: none; font-size: 13px; font-weight: 600;
  background: #fff; border: 1px solid var(--line); padding: 7px 14px; border-radius: 999px; }
.appbar .logout:hover { background: #f0efe9; }
.logo { height: 30px; width: auto; color: var(--ink); display: block; }
.wrap { padding: 24px 28px; max-width: 1180px; margin: 0 auto; }

/* ---------- En-tête de page ---------- */
.page-head { display: flex; align-items: flex-start; justify-content: space-between;
  gap: 16px; margin-bottom: 18px; flex-wrap: wrap; }
.page-head h2 { margin: 0; font-size: 20px; }
.page-head .muted { margin-top: 2px; }

/* ---------- Cartes ---------- */
.card { background: #fff; border: 1px solid var(--line); border-radius: 16px;
  box-shadow: 0 4px 18px rgba(22, 36, 44, .06); padding: 18px 20px;
  margin-bottom: 18px; animation: rise .35s ease both; }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.grid { display: grid; gap: 16px; }
.grid-products { grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }

/* ---------- Champs ---------- */
label { font-size: 12px; font-weight: 600; color: var(--muted); display: block; margin-bottom: 4px; }
input[type=text], input[type=password], input[type=email], input[type=number],
input[type=date], input[type=datetime-local], input[type=file], select, textarea {
  padding: 9px 12px; border: 1.5px solid var(--line); border-radius: 10px; font-size: 14px;
  background: #fff; color: var(--ink); outline: none; width: 100%;
  transition: border-color .15s, box-shadow .15s; font-family: inherit; }
textarea { resize: vertical; min-height: 70px; }
input:focus, select:focus, textarea:focus {
  border-color: var(--teal); box-shadow: 0 0 0 3px rgba(47, 126, 136, .18); }
.field { margin-bottom: 12px; }
.field-inline { display: flex; gap: 12px; flex-wrap: wrap; }
.field-inline > .field { flex: 1; min-width: 160px; }

/* ---------- Boutons ---------- */
button, .btn { padding: 9px 16px; border: 0; border-radius: 10px; background: var(--grad);
  color: #fff; font-size: 14px; font-weight: 600; cursor: pointer; text-decoration: none;
  display: inline-flex; align-items: center; gap: 7px;
  box-shadow: 0 2px 8px rgba(30, 78, 87, .28);
  transition: transform .08s, box-shadow .15s, filter .15s; }
button:hover, .btn:hover { filter: brightness(1.07); transform: translateY(-1px);
  box-shadow: 0 5px 16px rgba(30, 78, 87, .40); }
button:active, .btn:active { transform: translateY(0); }
button:disabled { background: #c4cbc9; box-shadow: none; cursor: not-allowed; filter: none; transform: none; }
.btn-export { background: var(--ink); box-shadow: 0 2px 8px rgba(22, 36, 44, .25); }
.btn-ghost { background: #fff; color: var(--teal-dark); border: 1.5px solid var(--line); box-shadow: none; }
.btn-ghost:hover { background: #f0efe9; border-color: var(--teal); box-shadow: none; filter: none; }
.btn-danger { background: var(--err); box-shadow: 0 2px 8px rgba(192,57,43,.28); }
.btn-sm { padding: 6px 11px; font-size: 12.5px; }

/* ---------- Tableaux ---------- */
.wrap-scroll { overflow-x: auto; border-radius: 12px; }
table { width: 100%; border-collapse: separate; border-spacing: 0; margin-top: 6px; font-size: 13px; }
th { background: var(--grad); color: #fff; padding: 10px 11px; text-align: left;
  font-size: 11px; text-transform: uppercase; letter-spacing: .5px; white-space: nowrap; }
th:first-child { border-top-left-radius: 12px; }
th:last-child { border-top-right-radius: 12px; }
td { padding: 9px 11px; border-bottom: 1px solid var(--line); vertical-align: middle; }
tbody tr:nth-child(even) td { background: #f6f5f0; }
tbody tr:hover td { background: #eaf3f4; }

/* ---------- Badges / pills ---------- */
.badge { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 11px;
  font-weight: 700; white-space: nowrap; }
.badge-os { background: #eef4f4; color: var(--teal-dark); }
.badge-fmt { background: #f0efe9; color: var(--ink); }
.badge-pub { background: var(--ok); color: #fff; }
.badge-draft { background: #b3ada3; color: #fff; }
.badge-sched { background: var(--warn); color: #fff; }

/* ---------- Divers ---------- */
.title { font-size: 15px; font-weight: 700; color: var(--ink); }
.muted { color: var(--muted); font-size: 12px; }
.err   { color: var(--err); font-size: 13px; font-weight: 600; }
.ok    { color: var(--ok); font-size: 13px; font-weight: 600; }
.hidden { display: none; }
.spacer { flex: 1; }
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 14px; }
.stat { background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 16px 18px;
  box-shadow: 0 4px 18px rgba(22,36,44,.06); }
.stat .n { font-size: 26px; font-weight: 800; color: var(--teal-dark); }
.stat .l { font-size: 12px; color: var(--muted); margin-top: 2px; }

/* ---------- Flash messages ---------- */
.flash { padding: 11px 15px; border-radius: 10px; margin-bottom: 14px; font-size: 13px; font-weight: 600; }
.flash-ok { background: #e6f4ee; color: var(--ok); border: 1px solid #bfe3d2; }
.flash-err { background: #fceae8; color: var(--err); border: 1px solid #f3c6c0; }

/* ---------- Carte produit (front) ---------- */
.product-card { background: #fff; border: 1px solid var(--line); border-radius: 16px;
  box-shadow: 0 4px 18px rgba(22,36,44,.06); overflow: hidden; animation: rise .35s ease both; }
.product-card .ph { padding: 16px 18px; border-bottom: 1px solid var(--line);
  display: flex; align-items: center; gap: 12px; }
.product-card .pico { width: 40px; height: 40px; border-radius: 11px; background: var(--grad);
  display: flex; align-items: center; justify-content: center; color: #fff; font-weight: 800; flex: 0 0 40px; }
.product-card .pb { padding: 6px 18px 14px; }
.rel-line { display: flex; align-items: center; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--line); }
.rel-line:last-child { border-bottom: 0; }
.rel-meta { flex: 1; min-width: 0; }
.rel-ver { font-weight: 700; }

/* ---------- Login / portail centré ---------- */
.auth-screen { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px; }
.auth-box { background: #fff; border: 1px solid var(--line); border-radius: 18px;
  box-shadow: 0 10px 40px rgba(22,36,44,.10); padding: 34px 36px; width: 100%; max-width: 410px;
  animation: rise .35s ease both; }
.auth-box .brand { display: flex; align-items: center; gap: 12px; margin-bottom: 8px; }
.auth-box h1 { font-size: 19px; margin: 0; }
.auth-box .sub { color: var(--muted); font-size: 13px; margin: 4px 0 22px; }
.auth-box button, .auth-box .btn { width: 100%; justify-content: center; }
.divider { display: flex; align-items: center; gap: 12px; color: var(--muted);
  font-size: 12px; margin: 18px 0; }
.divider::before, .divider::after { content: ""; flex: 1; height: 1px; background: var(--line); }
