/* ============================================================
   Secrétaire IA — Design 2026 "Soft Luxe"
   Aéré, lumineux, cartes nettes, couleur par touches, data-viz.
   ============================================================ */

:root {
  /* Duotone signature : Indigo × Corail */
  --brand: #6366f1;
  --brand-2: #fb7185;
  --brand-grad: linear-gradient(120deg, #6366f1 0%, #a855f7 52%, #fb7185 100%);
  --coral: #fb7185;

  --bg: #f4f5fb;
  --surface: #ffffff;
  --surface-2: #f6f7fc;
  --text: #14142a;
  --muted: #6b6f8a;
  --border: #ececf4;

  --violet: #7c6cff;
  --sky: #0ea5e9;
  --amber: #f59e0b;
  --emerald: #10b981;
  --rose: #f43f5e;

  --shadow: 0 14px 40px -20px rgba(30, 22, 80, 0.28), 0 4px 12px -8px rgba(30, 22, 80, 0.08);
  --shadow-lg: 0 30px 70px -30px rgba(30, 22, 80, 0.4);
  --shadow-brand: 0 16px 36px -16px rgba(99, 102, 241, 0.5);

  --radius: 22px;
  --radius-sm: 13px;
  --radius-lg: 26px;
  --sidebar-w: 264px;
}

[data-theme="dark"] {
  /* "Midnight indigo" — pas de noir */
  --bg: #17142f;
  --surface: #201c40;
  --surface-2: #29244f;
  --text: #f3f1fb;
  --muted: #a9a6cc;
  --border: rgba(255, 255, 255, 0.09);

  --shadow: 0 22px 54px -26px rgba(0, 0, 0, 0.55);
  --shadow-lg: 0 36px 84px -32px rgba(0, 0, 0, 0.65);
}

* { box-sizing: border-box; }
html, body { height: 100%; }

body {
  margin: 0;
  font-family: "Plus Jakarta Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  color: var(--text);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  background: var(--bg);
  background-image:
    radial-gradient(60% 45% at 100% 0%, rgba(251, 113, 133, 0.12), transparent 70%),
    radial-gradient(52% 42% at 0% 0%, rgba(99, 102, 241, 0.12), transparent 70%);
  background-attachment: fixed;
}
[data-theme="dark"] body {
  background-image:
    radial-gradient(55% 45% at 100% 0%, rgba(251, 113, 133, 0.20), transparent 70%),
    radial-gradient(52% 42% at 0% 5%, rgba(99, 102, 241, 0.22), transparent 70%);
}

.hidden { display: none !important; }
.muted { color: var(--muted); }
.error { color: var(--rose); font-size: 0.85rem; margin-top: 10px; min-height: 1em; font-weight: 600; }

h1, h2, h3, h4 { margin: 0; font-weight: 800; letter-spacing: -0.03em; }
a { color: var(--brand); }

.logo-mark {
  display: inline-flex; align-items: center; justify-content: center;
  width: 46px; height: 46px; border-radius: 14px;
  background: var(--brand-grad); color: #fff; font-size: 1.5rem;
  box-shadow: var(--shadow-brand);
}
.logo-mark.small { width: 38px; height: 38px; border-radius: 12px; font-size: 1.2rem; }

/* ============ Boutons & champs ============ */
button { font-family: inherit; cursor: pointer; border: none; }

.btn-primary,
#content button:not(.small):not(.ghost):not(.icon-btn):not(.hero-cta),
#login-form button {
  background: var(--brand-grad); color: #fff;
  padding: 12px 20px; border-radius: var(--radius-sm);
  font-size: 0.92rem; font-weight: 700;
  box-shadow: var(--shadow-brand);
  transition: transform 0.14s ease, box-shadow 0.22s ease, filter 0.2s ease;
}
.btn-primary:hover,
#content button:not(.small):not(.ghost):not(.icon-btn):not(.hero-cta):hover,
#login-form button:hover { transform: translateY(-2px); filter: brightness(1.05); box-shadow: 0 22px 44px -16px rgba(99, 102, 241, 0.6); }
.btn-block { width: 100%; margin-top: 22px; }

button.ghost {
  background: var(--surface); color: var(--text);
  border: 1px solid var(--border);
  padding: 10px 16px; border-radius: var(--radius-sm); font-weight: 700; font-size: 0.85rem;
  transition: all 0.16s ease; box-shadow: var(--shadow);
}
button.ghost:hover { border-color: var(--brand); color: var(--brand); transform: translateY(-1px); }
button.small { padding: 7px 13px; font-size: 0.78rem; border-radius: 10px; margin: 0; box-shadow: none; }

.icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 42px; height: 42px; border-radius: 13px;
  background: var(--surface); color: var(--muted);
  border: 1px solid var(--border); box-shadow: var(--shadow);
  transition: all 0.16s ease;
}
.icon-btn:hover { color: var(--brand); border-color: var(--brand); transform: translateY(-1px); }
.icon-btn svg { width: 19px; height: 19px; }

label { display: block; margin: 15px 0 6px; font-size: 0.8rem; font-weight: 700; color: var(--muted); }
input, select, textarea {
  width: 100%; padding: 12px 14px;
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  font-size: 0.92rem; font-family: inherit;
  background: var(--surface-2); color: var(--text);
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}
input::placeholder, textarea::placeholder { color: var(--muted); opacity: 0.65; }
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--brand); background: var(--surface);
  box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.14);
}
textarea { min-height: 120px; resize: vertical; }

/* ============ Login ============ */
.auth { display: grid; grid-template-columns: 1.05fr 1fr; min-height: 100vh; }
.auth-aside {
  position: relative; overflow: hidden;
  background: linear-gradient(150deg, #4338ca, #9333ea 52%, #fb7185);
  display: flex; align-items: center; justify-content: center; padding: 48px;
}
.auth-aside::before, .auth-aside::after { content: ""; position: absolute; border-radius: 50%; filter: blur(20px); }
.auth-aside::before { width: 360px; height: 360px; top: -100px; right: -80px; background: rgba(56, 189, 248, 0.4); }
.auth-aside::after { width: 280px; height: 280px; bottom: -90px; left: -70px; background: rgba(244, 63, 94, 0.32); }
.auth-aside-inner { position: relative; color: #fff; max-width: 400px; }
.auth-aside-inner h2 { font-size: 2.1rem; margin: 22px 0 12px; }
.auth-aside-inner p { font-size: 1.05rem; opacity: 0.92; line-height: 1.6; }
.auth-feats { list-style: none; padding: 0; margin: 32px 0 0; display: grid; gap: 13px; }
.auth-feats li { display: flex; align-items: center; gap: 11px; font-weight: 600; }
.auth-feats span { display: inline-flex; align-items: center; justify-content: center; width: 24px; height: 24px; border-radius: 8px; background: rgba(255, 255, 255, 0.25); font-size: 0.75rem; }
.auth-main { display: flex; align-items: center; justify-content: center; padding: 40px; }
.auth-card { width: 100%; max-width: 400px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 38px; box-shadow: var(--shadow-lg); }
.auth-card h1 { font-size: 1.8rem; margin: 22px 0 4px; }
.auth-card > p { margin: 0 0 8px; }

/* ============ App shell ============ */
.app-shell { display: grid; grid-template-columns: var(--sidebar-w) 1fr; min-height: 100vh; }

.sidebar {
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
  padding: 24px 16px;
  position: sticky; top: 0; height: 100vh;
}
.sidebar-brand { display: flex; align-items: center; gap: 12px; padding: 6px 8px 26px; }
.brand-name { font-weight: 700; font-size: 1.12rem; letter-spacing: -0.02em; }
.brand-name strong { background: var(--brand-grad); -webkit-background-clip: text; background-clip: text; color: transparent; }

.nav { display: flex; flex-direction: column; gap: 4px; flex: 1; }
.nav-item {
  display: flex; align-items: center; gap: 13px;
  padding: 12px 14px; border-radius: 14px;
  background: transparent; color: var(--muted);
  font-size: 0.92rem; font-weight: 700; text-align: left; width: 100%;
  transition: all 0.16s ease;
}
.nav-item svg { width: 20px; height: 20px; flex-shrink: 0; }
.nav-item:hover { background: var(--surface-2); color: var(--text); }
.nav-item.active { background: rgba(99, 102, 241, 0.12); color: var(--brand); }
.nav-item.active svg { stroke: var(--brand); }

.sidebar-foot { display: flex; align-items: center; gap: 10px; padding-top: 16px; margin-top: 8px; border-top: 1px solid var(--border); }
.user-chip { display: flex; align-items: center; gap: 11px; flex: 1; min-width: 0; }
.avatar { width: 40px; height: 40px; border-radius: 12px; flex-shrink: 0; background: var(--brand-grad); color: #fff; display: flex; align-items: center; justify-content: center; font-weight: 800; text-transform: uppercase; box-shadow: var(--shadow-brand); }
.user-meta { display: flex; flex-direction: column; min-width: 0; line-height: 1.25; }
.user-meta strong { font-size: 0.82rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-meta .muted { font-size: 0.72rem; }

/* ============ Main ============ */
.main { display: flex; flex-direction: column; min-width: 0; }
.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 24px 36px; position: sticky; top: 0; z-index: 5;
  background: color-mix(in srgb, var(--bg) 82%, transparent); backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
}
.topbar h1 { font-size: 1.5rem; }
.topbar #page-sub { font-size: 0.88rem; margin-top: 2px; }
.topbar-actions { display: flex; align-items: center; gap: 10px; }

.content { padding: 32px 36px 56px; max-width: 1280px; width: 100%; margin: 0 auto; animation: fade 0.4s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

[data-theme="light"] .ico-moon { display: none; }
[data-theme="dark"] .ico-sun { display: none; }

/* ============ Cartes ============ */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 24px; box-shadow: var(--shadow); }
.section-title { font-size: 1.12rem; margin: 4px 0 16px; }
.row { display: flex; gap: 22px; flex-wrap: wrap; }
.col { flex: 1; min-width: 280px; }
.card-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; }

/* ============ Dashboard ============ */
.hero {
  position: relative; overflow: hidden;
  border-radius: var(--radius-lg); padding: 34px 36px; margin-bottom: 26px;
  background: linear-gradient(115deg, #4f46e5 0%, #9333ea 50%, #fb7185 108%);
  color: #fff; box-shadow: var(--shadow-lg);
}
.hero::after { content: ""; position: absolute; width: 340px; height: 340px; border-radius: 50%; top: -130px; right: -70px; background: rgba(255, 255, 255, 0.14); }
.hero-eyebrow { position: relative; font-size: 0.74rem; font-weight: 800; letter-spacing: 0.12em; text-transform: uppercase; opacity: 0.85; }
.hero h2 { font-size: 1.95rem; position: relative; margin-top: 8px; }
.hero p { opacity: 0.94; margin-top: 8px; font-size: 1rem; position: relative; max-width: 560px; }
.hero-cta {
  position: relative; margin-top: 20px; background: #fff; color: #5b21b6;
  padding: 11px 20px; border-radius: 12px; font-weight: 800; font-size: 0.9rem;
  box-shadow: 0 12px 26px -12px rgba(0, 0, 0, 0.4); transition: transform 0.15s ease;
}
.hero-cta:hover { transform: translateY(-2px); }

.stats-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 20px; margin-bottom: 24px; }
.stat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px 20px 8px; box-shadow: var(--shadow); transition: transform 0.18s ease, box-shadow 0.22s ease; overflow: hidden; }
.stat:hover { transform: translateY(-4px); box-shadow: var(--shadow-lg); }
.stat-top { display: flex; align-items: center; justify-content: space-between; }
.chip { width: 44px; height: 44px; border-radius: 13px; display: flex; align-items: center; justify-content: center; }
.chip svg { width: 22px; height: 22px; }
.chip.violet { background: rgba(99, 102, 241, 0.14); color: var(--brand); }
.chip.rose { background: rgba(251, 113, 133, 0.16); color: var(--coral); }
.chip.sky { background: rgba(14, 165, 233, 0.14); color: var(--sky); }
.chip.amber { background: rgba(245, 158, 11, 0.16); color: var(--amber); }
.chip.emerald { background: rgba(16, 185, 129, 0.14); color: var(--emerald); }
.delta { font-size: 0.74rem; font-weight: 800; padding: 4px 9px; border-radius: 20px; }
.delta.up { background: rgba(16, 185, 129, 0.14); color: var(--emerald); }
.delta.down { background: rgba(244, 63, 94, 0.14); color: var(--rose); }
.stat-num { font-size: 2.15rem; font-weight: 800; letter-spacing: -0.04em; line-height: 1; margin-top: 16px; }
.stat-lbl { color: var(--muted); font-size: 0.85rem; margin-top: 6px; font-weight: 600; }
.spark { width: calc(100% + 40px); height: 40px; display: block; margin: 10px -20px -8px; }

.chart svg { width: 100%; height: 190px; display: block; }
.chart-x { display: flex; justify-content: space-between; color: var(--muted); font-size: 0.74rem; font-weight: 600; margin-top: 10px; padding: 0 4px; }

.svc-row { display: flex; flex-direction: column; gap: 10px; }
.svc { display: flex; align-items: center; gap: 10px; padding: 12px 15px; border-radius: 14px; background: var(--surface-2); font-weight: 700; font-size: 0.86rem; }
.dot { width: 9px; height: 9px; border-radius: 50%; margin-left: auto; }
.dot.up { background: var(--emerald); box-shadow: 0 0 0 4px rgba(16, 185, 129, 0.2); }
.dot.down { background: var(--rose); box-shadow: 0 0 0 4px rgba(244, 63, 94, 0.2); }

.quick-actions { display: flex; flex-wrap: wrap; gap: 16px; margin-top: 4px; }
.qa { display: flex; align-items: center; gap: 14px; padding: 18px 20px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow); font-weight: 700; flex: 1; min-width: 210px; transition: all 0.18s ease; cursor: pointer; }
.qa:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); border-color: var(--brand); }
.qa .chip { width: 44px; height: 44px; }

/* ============ Tables ============ */
.table-wrap { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 15px 18px; font-size: 0.9rem; }
thead th { color: var(--muted); font-weight: 700; font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.06em; border-bottom: 1px solid var(--border); }
tbody tr { border-bottom: 1px solid var(--border); transition: background 0.12s ease; }
tbody tr:last-child { border-bottom: none; }
tbody tr:hover { background: var(--surface-2); }

/* ============ Badges ============ */
.badge { display: inline-flex; align-items: center; gap: 6px; padding: 4px 12px; border-radius: 20px; font-size: 0.74rem; font-weight: 800; background: rgba(99, 102, 241, 0.12); color: var(--brand); }
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge.done { background: rgba(16, 185, 129, 0.14); color: var(--emerald); }
.badge.pending { background: rgba(245, 158, 11, 0.16); color: #d97706; }
.badge.important, .badge.down { background: rgba(244, 63, 94, 0.14); color: var(--rose); }
.badge.neutral { background: rgba(107, 111, 138, 0.16); color: var(--muted); }
.badge.info { background: rgba(99, 102, 241, 0.14); color: var(--brand); }

/* Avatars dégradés (duotone) */
.av { width: 36px; height: 36px; border-radius: 11px; display: inline-flex; align-items: center; justify-content: center; font-weight: 800; font-size: 0.76rem; color: #fff; flex-shrink: 0; letter-spacing: 0.02em; }
.av-indigo { background: linear-gradient(135deg, #6366f1, #8b5cf6); }
.av-coral { background: linear-gradient(135deg, #fb7185, #f59e0b); }
.av-sky { background: linear-gradient(135deg, #0ea5e9, #6366f1); }
.cell { display: flex; align-items: center; gap: 12px; }
.cell .sub { color: var(--muted); font-size: 0.78rem; }

/* Pastille de priorité */
.pri { width: 8px; height: 8px; border-radius: 50%; display: inline-block; margin-right: 9px; vertical-align: middle; }
.pri.high { background: var(--coral); box-shadow: 0 0 0 3px rgba(251, 113, 133, 0.18); }
.pri.normal { background: var(--brand); box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.18); }
.pri.low { background: var(--muted); }

/* Barre d'outils de page + compteur */
.toolbar { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 18px; flex-wrap: wrap; }
.count { display: inline-flex; align-items: center; gap: 7px; font-size: 0.82rem; font-weight: 700; color: var(--muted); background: var(--surface); border: 1px solid var(--border); padding: 7px 14px; border-radius: 20px; box-shadow: var(--shadow); }
.count b { color: var(--text); }
.amount { font-weight: 800; letter-spacing: -0.02em; }
.empty { padding: 30px; text-align: center; color: var(--muted); font-weight: 600; }

/* ============ Divers ============ */
.flash { padding: 13px 17px; border-radius: var(--radius-sm); margin-bottom: 16px; font-weight: 600; font-size: 0.88rem; }
.flash.ok { background: rgba(16, 185, 129, 0.14); color: #047857; }
.flash.err { background: rgba(244, 63, 94, 0.14); color: var(--rose); }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 13px; }
pre { font-family: ui-monospace, "SFMono-Regular", Menlo, monospace; font-size: 0.85rem; background: var(--surface-2); padding: 15px; border-radius: var(--radius-sm); border: 1px solid var(--border); }
.skeleton { color: var(--muted); padding: 46px; text-align: center; font-weight: 600; }

/* ============ Responsive ============ */
@media (max-width: 960px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar { position: sticky; top: 0; height: auto; flex-direction: row; align-items: center; padding: 10px 14px; overflow-x: auto; border-right: none; border-bottom: 1px solid var(--border); z-index: 6; }
  .sidebar-brand { display: none; }
  .nav { flex-direction: row; gap: 4px; }
  .nav-item span { display: none; }
  .nav-item { padding: 11px; }
  .sidebar-foot { border-top: none; padding-top: 0; margin: 0 0 0 auto; }
  .user-meta { display: none; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .auth { grid-template-columns: 1fr; }
  .auth-aside { display: none; }
  .topbar, .content { padding-left: 18px; padding-right: 18px; }
}
@media (max-width: 540px) {
  .stats-grid { grid-template-columns: 1fr; }
  .grid2 { grid-template-columns: 1fr; }
}
