/* Trustena CRM — mise en page (barre latérale + contenu). Hérite des tokens du
   design system (trustena.css) : navy/teal, cartes, tableaux. Ajoute le pipeline
   kanban, les tuiles, l'entonnoir et les pastilles de priorité. */

body { background: #eef3f8; }
.crm { display: grid; grid-template-columns: 15.5rem 1fr; min-height: 100vh; }
.crm-loading { padding: 3rem; color: var(--muted); }

/* --- Barre latérale --- */
.crm-side { background: linear-gradient(180deg, var(--navy) 0%, #0a1f38 100%); color: #cfe0ef; display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; }
.crm-side .brand { padding: 1.3rem 1.4rem 1rem; font-size: 1rem; letter-spacing: .16em; text-transform: uppercase; color: #9fd4d4; }
.crm-side .brand b { color: #fff; font-weight: 700; }
.crm-side .brand small { display: block; letter-spacing: .04em; text-transform: none; color: #7f9bb8; font-size: .72rem; margin-top: .2rem; }
.crm-nav { list-style: none; padding: .4rem 0; flex: 1; }
.crm-nav a { display: flex; align-items: center; gap: .6rem; padding: .62rem 1.4rem; color: #cfe0ef; text-decoration: none; font-size: .93rem; border-left: 3px solid transparent; }
.crm-nav a:hover { background: rgba(255,255,255,.05); color: #fff; }
.crm-nav a.on { background: rgba(15,163,163,.16); color: #fff; border-left-color: var(--teal); font-weight: 600; }
.crm-nav a .ic { width: 1.1rem; text-align: center; opacity: .85; }
.crm-nav a .n { margin-left: auto; background: rgba(255,255,255,.14); border-radius: 999px; font-size: .72rem; padding: .05rem .5rem; }
.crm-nav a .n.warn { background: #b00020; color: #fff; }
.crm-side .side-foot { padding: 1rem 1.4rem; font-size: .74rem; color: #7f9bb8; border-top: 1px solid rgba(255,255,255,.08); }

/* --- Zone de contenu --- */
.crm-main { padding: 0 0 3rem; min-width: 0; }
.crm-top { background: var(--card); border-bottom: 1px solid var(--line); padding: 1rem 1.8rem; display: flex; align-items: center; gap: 1rem; position: sticky; top: 0; z-index: 5; }
.crm-top h1 { font-size: 1.25rem; color: var(--navy); }
.crm-top .sub { color: var(--muted); font-size: .88rem; }
.crm-top .spacer { flex: 1; }

.role-switch { display: flex; gap: .3rem; background: #eef3f8; border-radius: 10px; padding: .25rem; }
.role-switch button { border: 0; background: transparent; padding: .4rem .8rem; border-radius: 8px; font-weight: 600; font-size: .85rem; color: var(--muted); cursor: pointer; }
.role-switch button.on { background: var(--card); color: var(--navy); box-shadow: 0 1px 3px rgba(11,36,64,.14); }

.crm-body { padding: 1.6rem 1.8rem; max-width: 78rem; }
.crm-demo { background: #fff7e6; border: 1px solid #f2dfb0; color: #7a5b12; border-radius: 10px; padding: .6rem .9rem; font-size: .82rem; margin-bottom: 1.3rem; }

/* --- Tuiles --- */
.tiles { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(12rem, 1fr)); margin-bottom: 1.3rem; }
.tile { background: var(--card); border-radius: var(--radius); padding: 1.1rem 1.2rem; box-shadow: var(--shadow); }
.tile .t-lab { font-size: .76rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.tile .t-val { font-size: 1.7rem; font-weight: 700; color: var(--navy); margin-top: .3rem; line-height: 1.1; }
.tile .t-val small { font-size: .8rem; font-weight: 600; color: var(--muted); }
.tile .t-hint { font-size: .8rem; color: var(--muted); margin-top: .2rem; }

/* --- Cartes & tableaux --- */
.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 1.2rem 1.3rem; margin-bottom: 1.2rem; }
.card h3 { font-size: 1rem; color: var(--navy); margin-bottom: .8rem; }
.card .note { color: var(--muted); font-size: .84rem; margin-bottom: .8rem; }
.grid2 { display: grid; gap: 1.2rem; grid-template-columns: 1fr 1fr; }
@media (max-width: 62rem) { .grid2 { grid-template-columns: 1fr; } }

table.tbl { width: 100%; border-collapse: collapse; font-size: .9rem; }
table.tbl th { text-align: left; font-size: .72rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 600; padding: .5rem .6rem; border-bottom: 1px solid var(--line); }
table.tbl td { padding: .55rem .6rem; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.tbl tr:last-child td { border-bottom: 0; }
table.tbl th.r, table.tbl td.r { text-align: right; font-variant-numeric: tabular-nums; }
table.tbl tr.od td { background: #fff6f6; }
table.tbl td.ko { color: var(--ko); font-weight: 600; }

/* Pastilles / chips */
.chip { display: inline-block; font-size: .72rem; font-weight: 600; letter-spacing: .02em; border-radius: 999px; padding: .12rem .55rem; background: #eef3f8; color: var(--navy); }
.chip.strat { background: #efe9fb; color: #5b3fa0; }
.chip.s-nouveau { background: #eef1f5; color: #6a7c90; }
.chip.s-qualifie { background: #e7f2fb; color: #1f5f9e; }
.chip.s-proposition { background: #e7f6f6; color: #0b7a7a; }
.chip.s-negociation { background: #fff3e0; color: #8a5a00; }
.chip.s-gagne { background: #e9f7ee; color: #23794a; }
.chip.s-perdu { background: #f6e7ea; color: #b00020; }

.pri { display: inline-block; min-width: 1.7rem; text-align: center; font-weight: 700; font-size: .8rem; border-radius: 7px; padding: .08rem .4rem; }
.pri-haute { background: #fbe3e3; color: #b00020; }
.pri-moyenne { background: #fdf1de; color: #8a5a00; }
.pri-basse { background: #e9eef4; color: #5b7186; }

.dot { display: inline-block; width: .6rem; height: .6rem; border-radius: 50%; margin-right: .45rem; vertical-align: middle; }
.dot.ok { background: var(--ok); } .dot.ko { background: var(--ko); }

/* --- Entonnoir --- */
.funnel { display: flex; flex-direction: column; gap: .5rem; }
.fn-row { display: grid; grid-template-columns: 6.5rem 1fr auto; align-items: center; gap: .7rem; font-size: .85rem; }
.fn-lab { color: var(--ink); }
.fn-bar { background: #eef3f8; border-radius: 999px; height: .7rem; overflow: hidden; }
.fn-fill { display: block; height: 100%; border-radius: 999px; background: var(--teal); }
.fn-fill.s-nouveau { background: #9fb2c6; }
.fn-fill.s-qualifie { background: #4f8fc9; }
.fn-fill.s-proposition { background: var(--teal); }
.fn-fill.s-negociation { background: #e0a53a; }
.fn-fill.s-gagne { background: var(--ok); }
.fn-fill.s-perdu { background: #d98a97; }
.fn-num { color: var(--muted); font-variant-numeric: tabular-nums; font-size: .8rem; white-space: nowrap; }

/* --- Pipeline kanban --- */
.kanban { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(15rem, 1fr); gap: .9rem; overflow-x: auto; padding-bottom: .5rem; }
.col { background: #eff4f9; border: 1px solid var(--line); border-radius: 12px; min-width: 0; display: flex; flex-direction: column; }
.col-h { display: flex; align-items: baseline; justify-content: space-between; gap: .4rem; padding: .7rem .8rem; font-weight: 700; color: var(--navy); font-size: .9rem; border-bottom: 1px solid var(--line); }
.col-h .col-meta { font-weight: 600; font-size: .74rem; color: var(--muted); }
.col-body { padding: .6rem; display: flex; flex-direction: column; gap: .55rem; }
.col-empty { color: var(--muted); text-align: center; padding: 1rem 0; font-size: .85rem; }
.deal { background: var(--card); border-radius: 10px; padding: .6rem .7rem; box-shadow: 0 1px 3px rgba(11,36,64,.08); border-left: 3px solid var(--line); }
.deal.band-haute { border-left-color: var(--ko); }
.deal.band-moyenne { border-left-color: #e0a53a; }
.deal.band-basse { border-left-color: #b7c3d0; }
.deal-t { font-weight: 600; color: var(--navy); font-size: .86rem; line-height: 1.3; }
.deal-a { color: var(--muted); font-size: .78rem; margin-top: .15rem; }
.deal-m { display: flex; align-items: center; justify-content: space-between; margin-top: .4rem; }
.deal-m .amt { font-weight: 700; color: var(--ink); font-size: .82rem; }
.deal-f { color: var(--muted); font-size: .74rem; margin-top: .35rem; }
.lost-note { color: var(--muted); font-size: .82rem; margin-top: .9rem; }

/* --- Activités --- */
.acts { list-style: none; display: flex; flex-direction: column; gap: .7rem; }
.act { display: flex; gap: .7rem; align-items: flex-start; }
.act-ic { width: 1.7rem; height: 1.7rem; flex: none; display: flex; align-items: center; justify-content: center; background: #eef3f8; border-radius: 8px; }
.act-t { color: var(--ink); font-size: .9rem; }
.act-m { color: var(--muted); font-size: .78rem; margin-top: .15rem; }
