/* ============================================================
   SHTY CRM — Feuille de style
   ============================================================ */
:root{
  --indigo:#4f46e5; --indigo-d:#4338ca;
  --blue:#0ea5e9; --green:#10b981; --amber:#f59e0b; --red:#ef4444; --slate:#475569;
  --ink:#0f172a; --muted:#64748b; --line:#e6e8ef; --bg:#f4f6fb; --card:#ffffff;
  --radius:14px; --shadow:0 1px 2px rgba(16,24,40,.04),0 8px 24px rgba(16,24,40,.06);
}
*{box-sizing:border-box}
html,body{margin:0;padding:0}
body{font-family:Inter,system-ui,-apple-system,Segoe UI,Roboto,sans-serif;background:var(--bg);color:var(--ink);font-size:14.5px;line-height:1.5}
a{color:inherit;text-decoration:none}
h1,h2,h3{margin:0}
.muted{color:var(--muted)}
.strong{font-weight:600}
.nowrap{white-space:nowrap}
code{background:#eef2ff;color:#3730a3;padding:.1em .4em;border-radius:5px;font-size:.85em}

/* ---------- Layout ---------- */
.layout{display:flex;min-height:100vh}
.sidebar{width:250px;background:linear-gradient(180deg,#1e1b4b 0%,#312e81 100%);color:#c7d2fe;display:flex;flex-direction:column;position:fixed;inset:0 auto 0 0;height:100vh;z-index:40}
.brand{display:flex;align-items:center;gap:.7rem;padding:1.25rem 1.25rem;border-bottom:1px solid rgba(255,255,255,.08)}
.brand__logo{width:38px;height:38px;border-radius:10px;background:linear-gradient(135deg,#6366f1,#0ea5e9);display:grid;place-items:center;font-weight:800;color:#fff;font-size:1.1rem;box-shadow:0 4px 12px rgba(99,102,241,.4)}
.brand__logo--lg{width:56px;height:56px;font-size:1.6rem;margin:0 auto}
.brand__name{font-weight:800;color:#fff;font-size:1.02rem;line-height:1.15;display:flex;flex-direction:column}
.brand__name span{font-weight:500;font-size:.72rem;color:#a5b4fc;letter-spacing:.02em}
.nav{padding:.9rem .7rem;display:flex;flex-direction:column;gap:.15rem;flex:1}
.nav__item{display:flex;align-items:center;gap:.7rem;padding:.62rem .8rem;border-radius:10px;color:#c7d2fe;font-weight:500;transition:.15s}
.nav__item:hover{background:rgba(255,255,255,.07);color:#fff}
.nav__item.is-active{background:rgba(255,255,255,.14);color:#fff;font-weight:600}
.nav__item .ico{width:18px;text-align:center;opacity:.9}
.sidebar__foot{padding:1rem;border-top:1px solid rgba(255,255,255,.08);display:flex;flex-direction:column;gap:.6rem}
.user{display:flex;align-items:center;gap:.6rem}
.user__avatar{width:36px;height:36px;border-radius:50%;background:#6366f1;color:#fff;display:grid;place-items:center;font-weight:700}
.user__meta{display:flex;flex-direction:column;line-height:1.2}
.user__meta strong{color:#fff;font-size:.9rem}
.user__meta span{color:#a5b4fc;font-size:.75rem}

.main{flex:1;margin-left:250px;min-width:0;display:flex;flex-direction:column}
.topbar{display:flex;align-items:center;gap:1rem;padding:1rem 1.6rem;background:var(--card);border-bottom:1px solid var(--line);position:sticky;top:0;z-index:20}
.topbar__title{font-size:1.2rem;font-weight:700;flex:1}
.burger{display:none;background:none;border:none;font-size:1.3rem;cursor:pointer;color:var(--ink)}
.content{padding:1.6rem;flex:1;max-width:1280px;width:100%}
.pagefoot{padding:1.2rem 1.6rem;color:var(--muted);font-size:.82rem;border-top:1px solid var(--line)}

/* ---------- Boutons ---------- */
.btn{display:inline-flex;align-items:center;justify-content:center;gap:.4rem;padding:.58rem 1rem;border-radius:10px;font-weight:600;font-size:.9rem;cursor:pointer;border:1px solid transparent;transition:.15s;white-space:nowrap}
.btn--primary{background:var(--indigo);color:#fff}
.btn--primary:hover{background:var(--indigo-d)}
.btn--ghost{background:#fff;border-color:var(--line);color:var(--ink)}
.btn--ghost:hover{background:#f8fafc}
.btn--danger-ghost{background:#fff;border-color:#fecaca;color:var(--red)}
.btn--danger-ghost:hover{background:#fef2f2}
.btn--block{width:100%}
.btn--sm{padding:.4rem .7rem;font-size:.82rem}
.link{color:var(--indigo);font-weight:600;background:none;border:none;cursor:pointer;font-size:inherit;padding:0}
.link:hover{text-decoration:underline}
.link--danger{color:var(--red)}

/* ---------- Flash ---------- */
.flash{margin:0 0 1.1rem;padding:.8rem 1rem;border-radius:10px;font-weight:500}
.flash--success{background:#ecfdf5;color:#065f46;border:1px solid #a7f3d0}
.flash--error{background:#fef2f2;color:#991b1b;border:1px solid #fecaca}

/* ---------- KPI ---------- */
.kpi-grid{display:grid;grid-template-columns:repeat(4,1fr);gap:1rem;margin-bottom:1.2rem}
.kpi-grid--5{grid-template-columns:repeat(5,1fr)}
.kpi{background:var(--card);border:1px solid var(--line);border-radius:var(--radius);padding:1.1rem 1.2rem;box-shadow:var(--shadow);position:relative;overflow:hidden}
.kpi::before{content:"";position:absolute;left:0;top:0;bottom:0;width:4px}
.kpi--indigo::before{background:var(--indigo)} .kpi--green::before{background:var(--green)}
.kpi--blue::before{background:var(--blue)} .kpi--amber::before{background:var(--amber)}
.kpi--slate::before{background:var(--slate)}
.kpi__label{color:var(--muted);font-size:.8rem;font-weight:600;text-transform:uppercase;letter-spacing:.03em}
.kpi__value{font-size:2rem;font-weight:800;margin:.25rem 0 .1rem}
.kpi__value--sm{font-size:1.25rem}
.kpi__sub{color:var(--muted);font-size:.8rem}

/* ---------- Cards / grid ---------- */
.grid{display:grid;gap:1rem;margin-bottom:1.2rem}
.grid--2{grid-template-columns:1fr 1fr}
.grid--3{grid-template-columns:repeat(3,1fr)}
.card{background:var(--card);border:1px solid var(--line);border-radius:var(--radius);padding:1.2rem;box-shadow:var(--shadow);margin-bottom:1.2rem}
.card--flush{padding:0;overflow:hidden}
.card--form{max-width:820px}
.card__head{display:flex;align-items:center;justify-content:space-between;margin-bottom:1rem}
.card__head h3{font-size:1rem;font-weight:700}
.chart-box{position:relative;width:100%;height:280px}
.chart-box--tall{height:320px}
.chart-box canvas{position:absolute;inset:0;width:100%!important;height:100%!important}

/* ---------- Tables ---------- */
.table-wrap{overflow-x:auto}
.table{width:100%;border-collapse:collapse;font-size:.9rem}
.table th{text-align:left;padding:.7rem .9rem;color:var(--muted);font-weight:600;font-size:.78rem;text-transform:uppercase;letter-spacing:.02em;border-bottom:1px solid var(--line);background:#fafbff}
.table td{padding:.72rem .9rem;border-bottom:1px solid var(--line);vertical-align:middle}
.table--rows tr:last-child td{border-bottom:none}
.table--rows tbody tr:hover{background:#fafbff}
.table--mini td{padding:.5rem .3rem;font-size:.88rem;border-bottom:1px solid #f1f3f9}

/* ---------- Badges ---------- */
.badge{display:inline-block;padding:.22rem .6rem;border-radius:999px;font-size:.76rem;font-weight:600;line-height:1.4}
.badge--green{background:#ecfdf5;color:#047857}
.badge--blue{background:#eff6ff;color:#1d4ed8}
.badge--amber{background:#fffbeb;color:#b45309}
.badge--red{background:#fef2f2;color:#b91c1c}
.badge--gray{background:#f1f5f9;color:#475569}
.badge--indigo{background:#eef2ff;color:#4338ca}

/* ---------- Rank list / minibars ---------- */
.ranklist{list-style:none;margin:0;padding:0;display:flex;flex-direction:column;gap:.6rem}
.ranklist li{display:grid;grid-template-columns:96px 1fr 32px;align-items:center;gap:.6rem;font-size:.86rem}
.ranklist__bar{background:#eef2f7;border-radius:6px;height:8px;overflow:hidden}
.ranklist__bar i{display:block;height:100%;background:linear-gradient(90deg,#4f46e5,#0ea5e9);border-radius:6px}
.ranklist__val{text-align:right;font-weight:600;color:var(--muted)}
.minibar{display:inline-block;width:100%;height:7px;background:#eef2f7;border-radius:5px;overflow:hidden;vertical-align:middle}
.minibar i{display:block;height:100%;background:linear-gradient(90deg,#4f46e5,#0ea5e9)}

/* ---------- Filtres / liste ---------- */
.filters{display:flex;flex-wrap:wrap;gap:.6rem;margin-bottom:1rem;align-items:center}
.filters__search{flex:1;min-width:220px}
.filters input,.filters select,.form input,.form select,.form textarea,.auth-form input{
  font-family:inherit;font-size:.9rem;padding:.55rem .7rem;border:1px solid var(--line);border-radius:9px;background:#fff;color:var(--ink);width:100%}
.filters input,.filters select{width:auto}
.filters select{min-width:150px}
input:focus,select:focus,textarea:focus{outline:none;border-color:var(--indigo);box-shadow:0 0 0 3px rgba(79,70,229,.12)}
.list-meta{display:flex;align-items:center;justify-content:space-between;margin-bottom:.8rem;color:var(--muted)}

/* ---------- Pagination ---------- */
.pagination{display:flex;align-items:center;justify-content:center;gap:1rem;margin-top:1.2rem}
.pagination__info{color:var(--muted);font-size:.86rem}

/* ---------- Formulaire ---------- */
.form{display:flex;flex-direction:column;gap:1rem}
.form label{display:flex;flex-direction:column;gap:.35rem;font-weight:600;font-size:.85rem;color:#334155}
.form input,.form select,.form textarea{font-weight:400}
.form__row{display:grid;grid-template-columns:1fr 1fr;gap:1rem}
.form__row--3{grid-template-columns:1fr 1fr 1fr}
.form__actions{display:flex;justify-content:flex-end;gap:.7rem;margin-top:.4rem}
.card--form + .card--form{margin-top:0}
.card--form p{margin:.3rem 0}

/* ---------- Auth ---------- */
.auth-body{display:grid;place-items:center;min-height:100vh;background:linear-gradient(135deg,#1e1b4b,#312e81 60%,#0ea5e9)}
.auth-card{background:#fff;width:100%;max-width:400px;border-radius:18px;padding:2.2rem 2rem;box-shadow:0 24px 60px rgba(15,23,42,.35)}
.auth-brand{text-align:center;margin-bottom:1.4rem}
.auth-brand h1{font-size:1.4rem;font-weight:800;margin-top:.7rem}
.auth-brand p{color:var(--muted);margin:.2rem 0 0}
.auth-form{display:flex;flex-direction:column;gap:.9rem}
.auth-form label{display:flex;flex-direction:column;gap:.35rem;font-weight:600;font-size:.85rem;color:#334155}
.auth-hint{text-align:center;color:var(--muted);font-size:.8rem;margin-top:1rem}

/* ---------- Responsive ---------- */
@media (max-width:1050px){ .kpi-grid,.kpi-grid--5{grid-template-columns:repeat(2,1fr)} .grid--2,.grid--3{grid-template-columns:1fr} }
@media (max-width:820px){
  .sidebar{transform:translateX(-100%);transition:.25s}
  .sidebar.open{transform:none}
  .main{margin-left:0}
  .burger{display:block}
  .form__row,.form__row--3{grid-template-columns:1fr}
  .topbar__actions .btn{padding:.5rem .7rem;font-size:.82rem}
}
