/* ============================================================
   NEXUS PILOTE — Design system des maquettes
   Inspiré du Dashboard Canva : sidebar claire + tuiles sombres
   Accent océan (teal). 100% autonome, aucune dépendance.
   ============================================================ */

:root {
  --bg:        #eef1f6;
  --surface:   #ffffff;
  --ink:       #0e1218;   /* tuiles sombres (style Canva) */
  --ink-2:     #161c24;
  --ink-3:     #222a34;
  --text:      #0f1620;
  --muted:     #6a7480;
  --muted-2:   #9aa3ad;
  --line:      #e3e7ee;
  --line-soft: #eef1f5;
  --accent:    #11b5c7;   /* teal océan */
  --accent-d:  #0a8e9d;
  --accent-soft:#e6f7f9;
  --blue:      #3b82f6;
  --ok:        #10b981;
  --warn:      #f59e0b;
  --danger:    #ef4444;
  --radius:    16px;
  --radius-sm: 10px;
  --shadow:    0 1px 2px rgba(16,22,32,.04), 0 8px 24px rgba(16,22,32,.06);
  --shadow-tile: 0 10px 30px rgba(14,18,24,.18);
  --font: "Segoe UI", system-ui, -apple-system, Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  line-height: 1.45;
}
a { text-decoration: none; color: inherit; }
img { max-width: 100%; }

/* ---------- Layout général ---------- */
.app { display: flex; min-height: 100vh; }

/* ---------- Sidebar ---------- */
.sidebar {
  width: 248px; flex: 0 0 248px;
  background: var(--surface);
  border-right: 1px solid var(--line);
  display: flex; flex-direction: column;
  padding: 22px 18px;
  position: sticky; top: 0; height: 100vh;
}
.brand { display: flex; align-items: center; gap: 11px; padding: 4px 8px 22px; }
.brand .logo {
  width: 38px; height: 38px; border-radius: 11px;
  background: linear-gradient(135deg, var(--accent), #0a8e9d);
  display: grid; place-items: center; color: #fff; flex: 0 0 auto;
  box-shadow: 0 6px 16px rgba(17,181,199,.35);
}
.brand .name { font-weight: 700; font-size: 16px; letter-spacing: -.2px; }
.brand .sub { font-size: 11px; color: var(--muted); font-weight: 500; }

.nav { display: flex; flex-direction: column; gap: 3px; margin-top: 6px; }
.nav .label {
  font-size: 10.5px; text-transform: uppercase; letter-spacing: .9px;
  color: var(--muted-2); font-weight: 700; padding: 14px 10px 6px;
}
.nav a {
  display: flex; align-items: center; gap: 11px;
  padding: 9px 11px; border-radius: 10px;
  color: #41505f; font-size: 14px; font-weight: 500;
  transition: background .12s, color .12s;
}
.nav a:hover { background: var(--line-soft); color: var(--text); }
.nav a.active { background: var(--ink); color: #fff; font-weight: 600; }
.nav a.active svg { color: var(--accent); }
.nav a svg { width: 18px; height: 18px; flex: 0 0 auto; color: #8893a0; }
.nav a.active svg { color: var(--accent); }

.sidebar .bottom { margin-top: auto; padding-top: 14px; border-top: 1px solid var(--line); }
.sidebar .user { display: flex; align-items: center; gap: 10px; padding: 8px; border-radius: 10px; }
.sidebar .user:hover { background: var(--line-soft); }
.sidebar .avatar {
  width: 34px; height: 34px; border-radius: 50%; flex: 0 0 auto;
  background: linear-gradient(135deg,#334155,#0e1218); color:#fff;
  display: grid; place-items: center; font-size: 13px; font-weight: 700;
}
.sidebar .user .meta { font-size: 13px; font-weight: 600; }
.sidebar .user .meta small { display: block; font-size: 11px; color: var(--muted); font-weight: 500; }

/* ---------- Zone principale ---------- */
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  display: flex; align-items: center; gap: 16px;
  padding: 18px 30px; background: var(--surface);
  border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 5;
}
.topbar h1 { font-size: 20px; font-weight: 700; margin: 0; letter-spacing: -.3px; }
.topbar .crumb { font-size: 12.5px; color: var(--muted); font-weight: 500; }
.topbar .spacer { flex: 1; }
.search {
  display: flex; align-items: center; gap: 9px;
  background: var(--bg); border: 1px solid var(--line);
  padding: 9px 14px; border-radius: 11px; min-width: 280px; color: var(--muted);
  font-size: 13.5px;
}
.search svg { width: 16px; height: 16px; }
.icon-btn {
  width: 40px; height: 40px; border-radius: 11px; border: 1px solid var(--line);
  background: var(--surface); display: grid; place-items: center; cursor: pointer;
  color: #41505f; position: relative;
}
.icon-btn .dot { position: absolute; top: 8px; right: 9px; width: 8px; height: 8px; border-radius: 50%; background: var(--danger); border: 2px solid #fff; }

.content { padding: 26px 30px 60px; }
.section-title { font-size: 13px; font-weight: 700; color: #3b4654; text-transform: uppercase; letter-spacing: .6px; margin: 30px 0 14px; display: flex; align-items: center; gap: 10px; }
.section-title:first-child { margin-top: 4px; }
.section-title .count { font-size: 11px; color: var(--muted); background: var(--surface); border: 1px solid var(--line); padding: 2px 9px; border-radius: 20px; font-weight: 600; }
.section-title .add { margin-left: auto; font-size: 12.5px; color: var(--accent-d); font-weight: 600; display: inline-flex; align-items: center; gap: 5px; text-transform: none; letter-spacing: 0; }

/* ---------- Grilles ---------- */
.grid { display: grid; gap: 16px; }
.g-3 { grid-template-columns: repeat(3, 1fr); }
.g-4 { grid-template-columns: repeat(4, 1fr); }
.g-2 { grid-template-columns: repeat(2, 1fr); }
@media (max-width: 1180px){ .g-4 { grid-template-columns: repeat(2,1fr);} .g-3{grid-template-columns:repeat(2,1fr);} }

/* ---------- Tuiles sombres (style Canva) ---------- */
.tile {
  background: var(--ink); color: #fff; border-radius: var(--radius);
  padding: 18px 20px; min-height: 120px; position: relative; overflow: hidden;
  display: flex; flex-direction: column; justify-content: space-between;
  box-shadow: var(--shadow-tile); transition: transform .14s, box-shadow .14s;
  border: 1px solid #1d2630;
}
.tile:hover { transform: translateY(-3px); box-shadow: 0 16px 40px rgba(14,18,24,.28); }
.tile .tile-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.tile .tile-ico { width: 38px; height: 38px; border-radius: 11px; background: rgba(255,255,255,.08); display: grid; place-items: center; color: var(--accent); }
.tile .tile-ico svg { width: 20px; height: 20px; }
.tile .tile-label { font-size: 12px; color: #9fb0bd; font-weight: 600; text-transform: uppercase; letter-spacing: .5px; }
.tile .tile-value { font-size: 30px; font-weight: 800; letter-spacing: -1px; margin-top: 4px; }
.tile .tile-value small { font-size: 14px; font-weight: 600; color: #9fb0bd; }
.tile .tile-name { font-size: 16px; font-weight: 700; }
.tile .tile-meta { font-size: 12.5px; color: #9fb0bd; margin-top: 6px; }
.tile .tag { display: inline-flex; align-items: center; gap: 5px; font-size: 11px; font-weight: 700; padding: 3px 9px; border-radius: 20px; }
.tile .tag.up { background: rgba(16,185,129,.16); color: #4ade80; }
.tile .tag.warn { background: rgba(245,158,11,.16); color: #fbbf24; }
.tile .tag.danger { background: rgba(239,68,68,.16); color: #f87171; }
.tile .glow { position: absolute; right: -30px; top: -30px; width: 130px; height: 130px; border-radius: 50%; background: radial-gradient(circle, rgba(17,181,199,.25), transparent 70%); pointer-events: none; }

/* Variante tuile flotte/équipement avec statut */
.tile.asset { min-height: 150px; }
.tile.asset .status-row { display: flex; gap: 8px; align-items: center; margin-top: auto; }
.bar { height: 6px; border-radius: 6px; background: rgba(255,255,255,.12); overflow: hidden; flex: 1; }
.bar > span { display: block; height: 100%; border-radius: 6px; background: var(--accent); }
.bar.warn > span { background: var(--warn); }
.bar.danger > span { background: var(--danger); }

/* ---------- Tuiles "action" claires (clients/raccourcis) ---------- */
.qtile {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px 18px; display: flex; align-items: center; gap: 14px;
  box-shadow: var(--shadow); transition: transform .14s, border-color .14s;
}
.qtile:hover { transform: translateY(-2px); border-color: #cfd6df; }
.qtile .q-ico { width: 44px; height: 44px; border-radius: 12px; background: var(--accent-soft); color: var(--accent-d); display: grid; place-items: center; flex: 0 0 auto; }
.qtile .q-ico svg { width: 22px; height: 22px; }
.qtile .q-txt b { display: block; font-size: 14.5px; font-weight: 700; }
.qtile .q-txt small { font-size: 12.5px; color: var(--muted); }

/* ---------- Agents IA (pastilles) ---------- */
.agents { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.agent {
  display: flex; flex-direction: column; align-items: center; gap: 9px; width: 92px; text-align: center;
}
.agent .bubble {
  width: 72px; height: 72px; border-radius: 50%;
  background: var(--ink); color: #fff; display: grid; place-items: center;
  box-shadow: var(--shadow-tile); transition: transform .14s; position: relative;
}
.agent:hover .bubble { transform: translateY(-3px) scale(1.04); }
.agent .bubble svg { width: 28px; height: 28px; color: var(--accent); }
.agent .bubble .badge { position: absolute; top: -3px; right: -3px; min-width: 20px; height: 20px; padding: 0 5px; border-radius: 20px; background: var(--danger); color: #fff; font-size: 11px; font-weight: 700; display: grid; place-items: center; border: 2px solid var(--bg); }
.agent .a-name { font-size: 12px; font-weight: 600; color: #41505f; }
.help-bubble { margin-left: auto; display: flex; align-items: center; gap: 9px; background: var(--ink); color: #fff; padding: 13px 20px; border-radius: 16px 16px 4px 16px; font-weight: 600; font-size: 14px; box-shadow: var(--shadow-tile); }
.help-bubble svg { width: 20px; height: 20px; color: var(--accent); }

/* ---------- Cartes / panneaux génériques ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-head { padding: 16px 20px; border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 12px; }
.card-head h3 { margin: 0; font-size: 15px; font-weight: 700; }
.card-body { padding: 18px 20px; }
.card-head .spacer { flex: 1; }

.pill { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; padding: 4px 11px; border-radius: 20px; }
.pill.ok { background: #e7f8f1; color: #0a8a5e; }
.pill.warn { background: #fef3e2; color: #b8770a; }
.pill.danger { background: #fdeaea; color: #c5302e; }
.pill.info { background: var(--accent-soft); color: var(--accent-d); }
.pill.muted { background: var(--line-soft); color: var(--muted); }

.btn { display: inline-flex; align-items: center; gap: 8px; padding: 9px 16px; border-radius: 10px; font-weight: 600; font-size: 13.5px; cursor: pointer; border: 1px solid transparent; }
.btn svg { width: 16px; height: 16px; }
.btn.primary { background: var(--accent); color: #fff; }
.btn.primary:hover { background: var(--accent-d); }
.btn.ghost { background: var(--surface); border-color: var(--line); color: #41505f; }
.btn.ghost:hover { border-color: #cfd6df; }
.btn.dark { background: var(--ink); color: #fff; }

/* ---------- Tableaux ---------- */
table.tbl { width: 100%; border-collapse: collapse; font-size: 13.5px; }
table.tbl th { text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .5px; color: var(--muted); font-weight: 700; padding: 0 14px 10px; border-bottom: 1px solid var(--line); }
table.tbl td { padding: 13px 14px; border-bottom: 1px solid var(--line-soft); }
table.tbl tr:hover td { background: #fafbfc; }
table.tbl .who { display: flex; align-items: center; gap: 11px; }
.avatar-sm { width: 34px; height: 34px; border-radius: 50%; background: linear-gradient(135deg,#334155,#0e1218); color:#fff; display: grid; place-items: center; font-size: 12px; font-weight: 700; flex: 0 0 auto; }

/* ---------- Divers ---------- */
.muted { color: var(--muted); }
.flex { display: flex; align-items: center; gap: 12px; }
.between { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.stat-row { display: flex; gap: 26px; flex-wrap: wrap; }
.stat b { font-size: 22px; font-weight: 800; letter-spacing: -.5px; }
.stat small { display: block; font-size: 12px; color: var(--muted); font-weight: 600; }

/* Bandeau "maquette" discret */
.mock-flag { position: fixed; bottom: 14px; left: 50%; transform: translateX(-50%); background: rgba(14,18,24,.9); color: #fff; font-size: 11px; padding: 6px 14px; border-radius: 20px; z-index: 50; letter-spacing: .3px; }
