/* ==========================================================================
   MAOSTACHE — coque applicative v0.8.0
   --------------------------------------------------------------------------
   Chargée après app.css. Reprend la barre latérale, la barre supérieure et
   le tableau de bord. Interface claire, typographie large, respiration —
   charte Moustache.
   ========================================================================== */

:root {
	--sb-largeur: 250px;
	--sb-fond: #14142b;
	--sb-fond-actif: #e7213a;
	--sb-txt: #a9aec8;
	--sb-txt-actif: #ffffff;
	--sb-trait: rgba(255, 255, 255, .07);
}

/* --------------------------------------------------------------------------
   Coque
   -------------------------------------------------------------------------- */

.mst {
	display: grid;
	grid-template-columns: var(--sb-largeur) minmax(0, 1fr);
	min-height: 100vh;
	background: var(--fond);
	font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

.mst-main {
	min-width: 0;
	display: flex;
	flex-direction: column;
}

.mst-content {
	padding: 0 32px 40px;
	min-width: 0;
}

/* --------------------------------------------------------------------------
   Barre latérale
   -------------------------------------------------------------------------- */

.mst-sidebar {
	background: var(--sb-fond);
	color: var(--sb-txt);
	display: flex;
	flex-direction: column;
	gap: 4px;
	padding: 20px 14px 16px;
	position: sticky;
	top: 0;
	height: 100vh;
	overflow-y: auto;
	overscroll-behavior: contain;
}

.mst-sidebar::-webkit-scrollbar {
	width: 6px;
}

.mst-sidebar::-webkit-scrollbar-thumb {
	background: rgba(255, 255, 255, .12);
	border-radius: 3px;
}

.mst-brand {
	display: flex;
	align-items: center;
	gap: 11px;
	padding: 4px 8px 20px;
}

.mst-brand .mst-logo {
	width: 38px;
	height: 38px;
	flex: 0 0 38px;
	border-radius: 11px;
	background: linear-gradient(135deg, #e7213a, #ff5a6e);
	display: grid;
	place-items: center;
	color: #fff;
}

.mst-brand .mst-logo svg {
	width: 22px;
	height: 22px;
}

.mst-brand-txt {
	display: flex;
	flex-direction: column;
	min-width: 0;
}

.mst-brand-name {
	font-size: 15px;
	font-weight: 800;
	letter-spacing: -.02em;
	color: #fff;
	line-height: 1.2;
}

.mst-brand-baseline {
	font-size: 10.5px;
	color: var(--sb-txt);
	line-height: 1.3;
	margin-top: 1px;
}

.mst-nav {
	display: flex;
	flex-direction: column;
	gap: 2px;
	flex: 1;
}

.mst-nav-groupe {
	font-size: 10px;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: .09em;
	color: rgba(255, 255, 255, .32);
	padding: 18px 10px 7px;
}

.mst-nav-item {
	display: flex;
	align-items: center;
	gap: 11px;
	padding: 9px 11px;
	border-radius: 9px;
	color: var(--sb-txt);
	font-size: 13.5px;
	font-weight: 500;
	text-decoration: none;
	transition: background .16s, color .16s;
	line-height: 1.3;
}

.mst-nav-item:hover {
	background: rgba(255, 255, 255, .06);
	color: #fff;
}

.mst-nav-item.is-active {
	background: var(--sb-fond-actif);
	color: #fff;
	font-weight: 600;
	box-shadow: 0 4px 14px rgba(231, 33, 58, .32);
}

.mst-nav-item.is-active:hover {
	background: var(--sb-fond-actif);
	color: #fff;
}

.mst-nav-icon {
	flex: 0 0 18px;
	display: grid;
	place-items: center;
	opacity: .95;
}

.mst-nav-icon svg {
	width: 17px;
	height: 17px;
}

.mst-nav-label {
	flex: 1;
	min-width: 0;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.mst-nav-count {
	flex: 0 0 auto;
	min-width: 21px;
	padding: 1px 6px;
	border-radius: 999px;
	background: rgba(255, 255, 255, .13);
	color: #fff;
	font-size: 10.5px;
	font-weight: 700;
	text-align: center;
}

.mst-nav-item.is-active .mst-nav-count {
	background: rgba(255, 255, 255, .26);
}

.mst-nav-count.is-alerte {
	background: var(--ambre);
	color: #1e293b;
}

.mst-nav-badge {
	flex: 0 0 auto;
	padding: 2px 6px;
	border-radius: 5px;
	background: rgba(139, 92, 246, .22);
	color: #c4b5fd;
	font-size: 8.5px;
	font-weight: 800;
	letter-spacing: .06em;
}

.mst-nav-point {
	flex: 0 0 5px;
	width: 5px;
	height: 5px;
	border-radius: 50%;
	background: rgba(255, 255, 255, .22);
}

.mst-nav-item.is-soon {
	opacity: .62;
}

/* Pied : organisation, utilisateur, crédits */

.mst-sidebar-pied {
	margin-top: 20px;
	padding-top: 14px;
	border-top: 1px solid var(--sb-trait);
	display: flex;
	flex-direction: column;
	gap: 8px;
}

.mst-carte-org,
.mst-carte-user {
	display: flex;
	align-items: center;
	gap: 10px;
	padding: 9px 10px;
	border-radius: 10px;
	background: rgba(255, 255, 255, .045);
	text-decoration: none;
	color: inherit;
}

.mst-carte-org:hover {
	background: rgba(255, 255, 255, .09);
}

.mst-carte-avatar,
.mst-carte-initiale {
	flex: 0 0 32px;
	width: 32px;
	height: 32px;
	border-radius: 9px;
	display: grid;
	place-items: center;
	color: #fff;
	font-size: 13px;
	font-weight: 700;
}

.mst-carte-avatar {
	background: linear-gradient(135deg, #e7213a, #ff5a6e);
}

.mst-carte-avatar svg {
	width: 18px;
	height: 18px;
}

.mst-carte-initiale {
	background: linear-gradient(135deg, #0090e7, #38b6ff);
}

.mst-carte-txt {
	display: flex;
	flex-direction: column;
	min-width: 0;
	line-height: 1.3;
}

.mst-carte-txt strong {
	font-size: 12.5px;
	font-weight: 600;
	color: #fff;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.mst-carte-txt small {
	font-size: 10.5px;
	color: var(--sb-txt);
}

.mst-credits {
	margin-top: 4px;
	padding: 13px;
	border-radius: 12px;
	background: rgba(255, 255, 255, .045);
	border: 1px solid var(--sb-trait);
}

.mst-credits-titre {
	font-size: 11px;
	font-weight: 600;
	color: var(--sb-txt);
}

.mst-credits-chiffre {
	display: flex;
	align-items: baseline;
	gap: 5px;
	margin: 5px 0 8px;
}

.mst-credits-chiffre strong {
	font-size: 24px;
	font-weight: 800;
	color: #fff;
	letter-spacing: -.03em;
}

.mst-credits-chiffre span {
	font-size: 12px;
	color: var(--sb-txt);
}

.mst-credits-barre {
	height: 5px;
	border-radius: 3px;
	background: rgba(255, 255, 255, .12);
	overflow: hidden;
}

.mst-credits-barre span {
	display: block;
	height: 100%;
	border-radius: 3px;
	background: linear-gradient(90deg, #22c55e, #14b8a6);
}

.mst-credits-note {
	margin: 8px 0 10px;
	font-size: 10.5px;
	line-height: 1.5;
	color: var(--sb-txt);
}

.mst-credits .mst-btn {
	font-size: 12px;
	padding: 8px 12px;
}

.mst-credits .mst-btn-ghost {
	background: rgba(255, 255, 255, .07);
	border-color: var(--sb-trait);
	color: #fff;
}

.mst-credits .mst-btn-ghost:hover {
	background: rgba(255, 255, 255, .13);
	color: #fff;
	border-color: rgba(255, 255, 255, .2);
}

/* --------------------------------------------------------------------------
   Barre supérieure
   -------------------------------------------------------------------------- */

.mst-topbar {
	display: flex;
	align-items: center;
	gap: 16px;
	padding: 14px 32px;
	background: var(--blanc);
	border-bottom: 1px solid var(--trait);
	position: sticky;
	top: 0;
	z-index: 20;
}

.mst-search {
	position: relative;
	flex: 1;
	max-width: 480px;
}

.mst-search input[type="search"] {
	width: 100%;
	padding: 9px 46px 9px 38px;
	border: 1px solid var(--trait);
	border-radius: 10px;
	background: var(--fond);
	font-size: 13px;
	font-family: inherit;
	color: var(--texte);
}

.mst-search input[type="search"]:focus {
	outline: none;
	border-color: var(--rouge);
	background: var(--blanc);
	box-shadow: 0 0 0 3px rgba(231, 33, 58, .09);
}

.mst-search-icon {
	position: absolute;
	left: 12px;
	top: 50%;
	transform: translateY(-50%);
	color: var(--gris);
	display: grid;
	place-items: center;
	pointer-events: none;
}

.mst-search-icon svg {
	width: 16px;
	height: 16px;
}

.mst-kbd {
	position: absolute;
	right: 10px;
	top: 50%;
	transform: translateY(-50%);
	padding: 2px 6px;
	border-radius: 5px;
	border: 1px solid var(--trait);
	background: var(--blanc);
	font-size: 10.5px;
	font-family: inherit;
	color: var(--gris);
	pointer-events: none;
}

.mst-topbar-actions {
	display: flex;
	align-items: center;
	gap: 9px;
	margin-left: auto;
}

.mst-icon-btn {
	position: relative;
	width: 36px;
	height: 36px;
	border-radius: 10px;
	border: 1px solid var(--trait);
	background: var(--blanc);
	display: grid;
	place-items: center;
	color: var(--gris);
	text-decoration: none;
	transition: color .16s, border-color .16s;
}

.mst-icon-btn:hover {
	color: var(--rouge);
	border-color: var(--rouge);
}

.mst-icon-btn svg {
	width: 17px;
	height: 17px;
}

.mst-icon-badge {
	position: absolute;
	top: -5px;
	right: -5px;
	min-width: 17px;
	height: 17px;
	padding: 0 4px;
	border-radius: 999px;
	background: var(--rouge);
	color: #fff;
	font-size: 10px;
	font-weight: 700;
	display: grid;
	place-items: center;
	border: 2px solid var(--blanc);
}

/* Titre de page */

.mst-page-head {
	padding: 26px 32px 18px;
}

.mst-page-head h1 {
	margin: 0;
	font-size: 25px;
	font-weight: 800;
	letter-spacing: -.035em;
	color: var(--encre);
	line-height: 1.2;
}

.mst-page-head p {
	margin: 4px 0 0;
	font-size: 13.5px;
	color: var(--gris);
}

/* --------------------------------------------------------------------------
   Tableau de bord
   -------------------------------------------------------------------------- */

.mst-salut {
	display: flex;
	align-items: flex-start;
	justify-content: space-between;
	gap: 20px;
	flex-wrap: wrap;
	margin-bottom: 22px;
}

.mst-salut h2 {
	margin: 0;
	font-size: 21px;
	font-weight: 800;
	letter-spacing: -.03em;
	color: var(--encre);
}

.mst-salut p {
	margin: 3px 0 0;
	font-size: 13.5px;
	color: var(--gris);
}

/* Indicateurs */

.mst-kpis {
	display: grid;
	grid-template-columns: repeat(5, 1fr);
	gap: 14px;
	margin-bottom: 20px;
}

.mst-kpi {
	background: var(--blanc);
	border: 1px solid var(--trait);
	border-radius: 14px;
	padding: 17px 18px;
	display: flex;
	flex-direction: column;
	gap: 2px;
	transition: box-shadow .2s, transform .2s;
}

.mst-kpi:hover {
	transform: translateY(-2px);
	box-shadow: 0 8px 24px rgba(0, 0, 0, .06);
}

.mst-kpi-icone {
	width: 36px;
	height: 36px;
	border-radius: 10px;
	display: grid;
	place-items: center;
	margin-bottom: 10px;
}

.mst-kpi-icone svg {
	width: 18px;
	height: 18px;
}

.mst-kpi-icone.ton-violet { background: #f3efff; color: #8b5cf6; }
.mst-kpi-icone.ton-bleu   { background: #eff6ff; color: #0090e7; }
.mst-kpi-icone.ton-ambre  { background: #fffbeb; color: #f59e0b; }
.mst-kpi-icone.ton-vert   { background: #f0fdf4; color: #22c55e; }
.mst-kpi-icone.ton-rouge  { background: #fef2f2; color: #e7213a; }
.mst-kpi-icone.ton-gris   { background: #f1f5f9; color: #64748b; }

.mst-kpi-label {
	font-size: 12px;
	color: var(--gris);
	font-weight: 500;
}

.mst-kpi-valeur {
	font-size: 27px;
	font-weight: 800;
	letter-spacing: -.04em;
	color: var(--encre);
	line-height: 1.15;
}

.mst-kpi-note {
	font-size: 11.5px;
	color: var(--gris-clair, #94a3b8);
	margin-top: 1px;
}

/* Grille de panneaux */

.mst-dash-grid {
	display: grid;
	grid-template-columns: 1.35fr 1fr 1fr;
	gap: 16px;
	margin-bottom: 16px;
	align-items: start;
}

.mst-dash .mst-panel {
	background: var(--blanc);
	border: 1px solid var(--trait);
	border-radius: 14px;
	padding: 18px 20px 20px;
	margin: 0;
}

.mst-dash .mst-panel-head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	margin-bottom: 14px;
}

.mst-dash .mst-panel-head h2 {
	display: flex;
	align-items: center;
	gap: 9px;
	margin: 0;
	font-size: 14.5px;
	font-weight: 700;
	letter-spacing: -.02em;
	color: var(--encre);
}

.mst-panel-icone {
	width: 27px;
	height: 27px;
	border-radius: 8px;
	display: grid;
	place-items: center;
	flex: 0 0 27px;
}

.mst-panel-icone svg {
	width: 15px;
	height: 15px;
}

.mst-panel-icone.ton-violet { background: #f3efff; color: #8b5cf6; }
.mst-panel-icone.ton-bleu   { background: #eff6ff; color: #0090e7; }
.mst-panel-icone.ton-ambre  { background: #fffbeb; color: #f59e0b; }
.mst-panel-icone.ton-vert   { background: #f0fdf4; color: #22c55e; }
.mst-panel-icone.ton-rouge  { background: #fef2f2; color: #e7213a; }

.mst-link {
	font-size: 12.5px;
	font-weight: 600;
	color: var(--secondaire, #0090e7);
	text-decoration: none;
	white-space: nowrap;
}

.mst-link:hover {
	text-decoration: underline;
}

/* Listes de panneau */

.mst-liste {
	list-style: none;
	margin: 0;
	padding: 0;
	display: flex;
	flex-direction: column;
}

.mst-ligne {
	display: flex;
	align-items: center;
	gap: 14px;
	padding: 12px 0;
	border-bottom: 1px solid var(--trait);
}

.mst-ligne:last-child {
	border-bottom: none;
	padding-bottom: 0;
}

.mst-ligne:first-child {
	padding-top: 0;
}

.mst-ligne-corps {
	flex: 1;
	min-width: 0;
	display: flex;
	flex-direction: column;
	gap: 2px;
	text-decoration: none;
	color: inherit;
}

a.mst-ligne-corps:hover .mst-ligne-titre {
	color: var(--rouge);
}

.mst-etiquette {
	align-self: flex-start;
	padding: 2px 8px;
	border-radius: 5px;
	background: #f1f5f9;
	color: #64748b;
	font-size: 10px;
	font-weight: 700;
	letter-spacing: .02em;
	margin-bottom: 3px;
}

.mst-ligne-titre {
	font-size: 13px;
	font-weight: 600;
	color: var(--texte);
	line-height: 1.4;
	transition: color .16s;
}

.mst-ligne-meta {
	font-size: 11.5px;
	color: var(--gris);
}

.mst-ligne-cote {
	flex: 0 0 auto;
	display: flex;
	flex-direction: column;
	align-items: flex-end;
	gap: 3px;
	text-align: right;
}

.mst-score {
	width: 36px;
	height: 36px;
	border-radius: 50%;
	display: grid;
	place-items: center;
	font-size: 12.5px;
	font-weight: 800;
	color: #22c55e;
	border: 2.5px solid #bbf7d0;
	background: #f0fdf4;
}

.mst-ligne-montant {
	font-size: 12.5px;
	font-weight: 700;
	color: var(--encre);
}

.mst-ligne-jours {
	font-size: 11px;
	font-weight: 700;
	color: var(--gris);
}

.mst-ligne-jours.is-urgent {
	color: var(--rouge);
}

/* Activité */

.mst-activite {
	list-style: none;
	margin: 0;
	padding: 0;
	display: flex;
	flex-direction: column;
	gap: 11px;
}

.mst-activite li {
	display: flex;
	align-items: flex-start;
	gap: 10px;
}

.mst-activite-puce {
	flex: 0 0 8px;
	width: 8px;
	height: 8px;
	border-radius: 50%;
	margin-top: 5px;
	background: var(--gris);
}

.mst-activite-puce.ton-violet { background: #8b5cf6; }
.mst-activite-puce.ton-bleu   { background: #0090e7; }
.mst-activite-puce.ton-vert   { background: #22c55e; }
.mst-activite-puce.ton-gris   { background: #94a3b8; }

.mst-activite-txt {
	flex: 1;
	min-width: 0;
	font-size: 12.5px;
	line-height: 1.45;
	color: var(--texte);
}

.mst-activite-quand {
	flex: 0 0 auto;
	font-size: 11px;
	color: var(--gris-clair, #94a3b8);
	white-space: nowrap;
}

/* Mini-statistiques */

.mst-mini-stats {
	display: grid;
	grid-template-columns: repeat(4, 1fr);
	gap: 10px;
	margin-bottom: 12px;
}

.mst-mini-stats div {
	display: flex;
	flex-direction: column;
	gap: 1px;
}

.mst-mini-stats strong {
	font-size: 19px;
	font-weight: 800;
	letter-spacing: -.03em;
	color: var(--encre);
}

.mst-mini-stats span {
	font-size: 10.5px;
	color: var(--gris);
}

.mst-panel-pied {
	margin: 0;
	font-size: 11.5px;
	line-height: 1.6;
	color: var(--gris);
}

/* Panneau inactif */

.mst-inactif {
	display: flex;
	flex-direction: column;
	align-items: flex-start;
	gap: 12px;
	padding: 6px 0;
}

.mst-inactif p {
	margin: 0;
	font-size: 12.5px;
	line-height: 1.6;
	color: var(--gris);
}

/* Anneau de consommation */

.mst-credits-vue {
	display: flex;
	align-items: center;
	gap: 18px;
	flex-wrap: wrap;
}

.mst-donut {
	--part: 0;
	flex: 0 0 104px;
	width: 104px;
	height: 104px;
	border-radius: 50%;
	display: grid;
	place-items: center;
	background: conic-gradient(var(--secondaire, #0090e7) calc(var(--part) * 1%), #eef2f7 0);
	position: relative;
}

.mst-donut::before {
	content: "";
	position: absolute;
	inset: 13px;
	border-radius: 50%;
	background: var(--blanc);
}

.mst-donut-val,
.mst-donut-lbl {
	position: relative;
	z-index: 1;
	text-align: center;
	display: block;
}

.mst-donut-val {
	font-size: 19px;
	font-weight: 800;
	letter-spacing: -.03em;
	color: var(--encre);
}

.mst-donut-lbl {
	font-size: 10px;
	color: var(--gris);
}

.mst-legende-liste {
	list-style: none;
	margin: 0;
	padding: 0;
	flex: 1;
	min-width: 140px;
	display: flex;
	flex-direction: column;
	gap: 7px;
}

.mst-legende-liste li {
	display: flex;
	align-items: center;
	gap: 8px;
	font-size: 12px;
}

.mst-puce {
	flex: 0 0 8px;
	width: 8px;
	height: 8px;
	border-radius: 50%;
	background: var(--secondaire, #0090e7);
}

.mst-legende-lbl {
	flex: 1;
	color: var(--texte);
}

.mst-legende-val {
	font-weight: 700;
	color: var(--encre);
}

/* Barre Compagnon Stache */

.mst-compagnon-barre {
	display: flex;
	align-items: center;
	gap: 18px;
	flex-wrap: wrap;
	background: var(--blanc);
	border: 1px solid var(--trait);
	border-radius: 14px;
	padding: 16px 20px;
}

.mst-compagnon-ident {
	display: flex;
	align-items: center;
	gap: 12px;
	min-width: 0;
}

.mst-compagnon-avatar {
	flex: 0 0 40px;
	width: 40px;
	height: 40px;
	border-radius: 11px;
	background: linear-gradient(135deg, #8b5cf6, #6366f1);
	color: #fff;
	display: grid;
	place-items: center;
}

.mst-compagnon-avatar svg {
	width: 20px;
	height: 20px;
}

.mst-compagnon-ident strong {
	display: block;
	font-size: 13.5px;
	font-weight: 700;
	color: var(--encre);
	line-height: 1.3;
}

.mst-compagnon-ident small {
	font-size: 12px;
	color: var(--gris);
}

.mst-compagnon-barre .mst-chat-form {
	display: flex;
	align-items: center;
	gap: 9px;
	flex: 1;
	min-width: 260px;
	margin-left: auto;
}

.mst-compagnon-barre .mst-chat-form input {
	flex: 1;
	min-width: 0;
	padding: 10px 14px;
	border: 1px solid var(--trait);
	border-radius: 10px;
	background: var(--fond);
	font-size: 13px;
	font-family: inherit;
	color: var(--texte);
}

.mst-compagnon-barre .mst-chat-form input:focus {
	outline: none;
	border-color: var(--rouge);
	background: var(--blanc);
	box-shadow: 0 0 0 3px rgba(231, 33, 58, .09);
}

.mst-empty-txt {
	margin: 0;
	font-size: 12.5px;
	line-height: 1.65;
	color: var(--gris);
}

/* --------------------------------------------------------------------------
   Adaptations
   -------------------------------------------------------------------------- */

@media (max-width: 1400px) {
	.mst-kpis {
		grid-template-columns: repeat(3, 1fr);
	}
}

@media (max-width: 1180px) {
	.mst-dash-grid {
		grid-template-columns: 1fr 1fr;
	}
}

@media (max-width: 900px) {
	.mst {
		grid-template-columns: 1fr;
	}

	.mst-sidebar {
		position: static;
		height: auto;
	}

	.mst-kpis,
	.mst-dash-grid {
		grid-template-columns: 1fr;
	}

	.mst-content,
	.mst-topbar,
	.mst-page-head {
		padding-left: 18px;
		padding-right: 18px;
	}
}
