/*
Theme Name: Espace Client Instant B
Description: Thème autonome pour l'espace client (client.instant-b.fr) — connexion, mot de passe, portail. Communique avec le CRM (installation séparée) via son API REST, jamais de base de données partagée.
Author: Instant B
Version: 1.6.1
*/

body{
	margin: 0;
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
	background: #f5f6f8;
}

.crm-auth-wrap{
	position: fixed; inset: 0; z-index: 999999; overflow-y: auto;
	min-height: 100vh; display: flex; align-items: center; justify-content: center;
	background: #f5f6f8; padding: 20px; box-sizing: border-box;
}
.crm-auth-card{
	background: #fff; border-radius: 12px; padding: 40px;
	width: 100%; max-width: 400px; box-shadow: 0 10px 40px rgba(41,47,76,.12);
	box-sizing: border-box;
}
.crm-auth-logo{ text-align: center; margin-bottom: 20px; }
.crm-auth-title{ text-align: center; font-size: 22px; font-weight: 700; color: #323338; margin: 0 0 8px; }
.crm-auth-intro{ text-align: center; font-size: 14px; color: #676879; margin: 0 0 24px; }
.crm-auth-form{ display: flex; flex-direction: column; gap: 16px; }
.crm-auth-field{ margin-bottom: 20px; }
.crm-auth-field label{ display: block; font-size: 13px; font-weight: 600; color: #4b5563; margin-bottom: 6px; }
.crm-auth-field input{
	width: 100%; padding: 11px 14px; border: 1px solid #d0d4e4; border-radius: 6px;
	font-size: 14px; box-sizing: border-box;
}
.crm-auth-field input:focus{ outline: none; border-color: #0073ea; box-shadow: 0 0 0 3px rgba(0,115,234,.12); }
.crm-auth-pw-wrap{ position: relative; }
.crm-auth-pw-wrap input{ padding-right: 40px; }
.crm-auth-pw-toggle{
	position: absolute; right: 8px; top: 50%; transform: translateY(-50%);
	background: none; border: none; cursor: pointer; font-size: 16px; padding: 4px;
}
.crm-auth-btn{
	background: #0073ea; color: #fff; border: none; border-radius: 6px;
	padding: 12px; font-size: 15px; font-weight: 600; cursor: pointer;
	transition: background .15s;
}
.crm-auth-btn:hover{ background: #0060c2; }
.crm-auth-link{ text-align: center; font-size: 13px; color: #0073ea; text-decoration: none; }
.crm-auth-link:hover{ text-decoration: underline; }
.crm-pw-rules{ list-style: none; padding: 0; margin: 6px 0 0; font-size: 12px; color: #9699a6; }
.crm-pw-rules li.is-ok{ color: #037f4c; }
.crm-pw-rules li.is-ok::before{ content: "✓ "; }
.modal-errors{
	background: #fdeef1; border: 1px solid #f5c2cc; color: #c9184a;
	border-radius: 6px; padding: 10px 14px; font-size: 13px; margin-bottom: 4px;
}
.crm-auth-success{
	background: #eafaf1; border: 1px solid #b7e4c7; color: #037f4c;
	border-radius: 6px; padding: 10px 14px; font-size: 13px; text-align: center;
}

/* Liste des dossiers (portail) */
.ec-gallery-grid img{ width: 100%; height: 90px; object-fit: cover; border-radius: 6px; border: 1px solid #e7e8ec; }

/* Détail d'un dossier — sections partagées entre onglets */
.ec-section-title{ font-size: 15px; font-weight: 700; color: #323338; margin: 24px 0 12px; padding-bottom: 6px; border-bottom: 1px solid #e7e8ec; }
.ec-gallery-tab__label{ font-size: 13px; font-weight: 700; color: #676879; margin: 16px 0 8px; }
.ec-gallery-group__title{ font-size: 12.5px; color: #9699a6; margin: 10px 0 6px; }
.ec-gallery-grid{ display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 8px; }

/* Signature électronique — porté depuis l'ancienne popup à jeton */
.qs-pdf{ width:100%; height:420px; border:1px solid #e6e9f0; border-radius:8px; margin-bottom:18px; box-sizing:border-box; }
.qs-cgv{ display:flex; align-items:flex-start; gap:10px; font-size:13.5px; color:#323338; margin-bottom:20px; }
.qs-cgv input{ margin-top:3px; }
.qs-cgv a{ color:#0073ea; cursor:pointer; }
.qs-mode-tabs{ display:flex; gap:8px; margin-bottom:12px; }
.qs-mode-tab{
	flex:1; text-align:center; padding:9px; border-radius:8px; border:1.5px solid #e0e3eb;
	background:#fff; color:#676879; font-weight:600; font-size:13.5px; cursor:pointer;
}
.qs-mode-tab.is-active{ background:#0073ea; border-color:#0073ea; color:#fff; }
.qs-pad-wrap{ border:1.5px dashed #c4c9d8; border-radius:8px; margin-bottom:10px; }
#qs-pad{ width:100%; height:160px; display:block; cursor:crosshair; touch-action:none; }
.qs-type-input{
	width:100%; box-sizing:border-box; border:1px solid #d0d4e4; border-radius:6px;
	padding:10px 12px; font-size:15px; margin-bottom:10px;
}
#qs-type-preview{
	height:80px; display:flex; align-items:center; justify-content:center;
	font-size:42px; color:#1a1a2e; border:1.5px dashed #c4c9d8; border-radius:8px; margin-bottom:10px;
	font-family:'Sacramento',cursive;
}
.qs-actions{ display:flex; justify-content:space-between; align-items:center; margin-top:8px; }
.qs-clear{ background:none; border:none; color:#676879; font-size:13px; cursor:pointer; text-decoration:underline; }
.qs-submit{
	background:#00c875; color:#fff; border:none; border-radius:6px; padding:12px 28px;
	font-size:14px; font-weight:700; cursor:pointer;
}
.qs-submit:disabled{ opacity:.5; cursor:default; }
.qs-done{ text-align:center; padding:20px 0; }
.qs-done h2{ color:#00c875; margin-bottom:8px; }
.qs-pdf-viewer{
	position:fixed; inset:0; z-index:1000000; background:rgba(20,20,26,.85);
	display:flex; align-items:center; justify-content:center; padding:30px;
}
.qs-pdf-viewer iframe{
	width:100%; height:100%; max-width:900px; background:#fff;
	border:none; border-radius:8px; box-shadow:0 10px 40px rgba(0,0,0,.4);
}
.qs-pdf-viewer__close{
	position:absolute; top:14px; right:18px; background:none; border:none;
	color:#fff; font-size:32px; line-height:1; cursor:pointer; opacity:.8;
}

/* ============== Coquille (sidebar + topbar), comme le CRM ============== */
.ec-shell{ display:flex; min-height:100vh; background:#f5f6f8; }
.ec-sidebar{
	width:220px; flex-shrink:0; background:#20264d; color:#fff;
	display:flex; flex-direction:column; padding:20px 0;
}
.ec-sidebar__logo{ padding:0 20px 24px; font-size:18px; font-weight:700; }
.ec-sidebar__nav{ display:flex; flex-direction:column; }
.ec-sidebar__link{
	display:flex; align-items:center; gap:10px; padding:11px 20px;
	color:#c3c6d4; text-decoration:none; font-size:14px; font-weight:500;
	border-left:3px solid transparent; transition:background .15s,color .15s;
}
.ec-sidebar__link:hover{ background:rgba(255,255,255,.06); color:#fff; }
.ec-sidebar__link.is-active{ background:rgba(255,255,255,.1); color:#fff; border-left-color:#0073ea; }
.ec-sidebar__icon{ font-size:16px; }
.ec-body{ flex:1; display:flex; flex-direction:column; min-width:0; }
.ec-topbar{
	height:60px; flex-shrink:0; background:#fff; border-bottom:1px solid #e7e8ec;
	display:flex; align-items:center; justify-content:flex-end; padding:0 24px;
}
.ec-topbar__spacer{ flex:1; }
.ec-topbar__account{ position:relative; }
.ec-topbar__account-btn{
	display:flex; align-items:center; gap:8px; background:none; border:none;
	cursor:pointer; font-size:13.5px; font-weight:600; color:#323338; padding:6px 8px; border-radius:6px;
}
.ec-topbar__account-btn:hover{ background:#f0f1f6; }
.ec-avatar{
	width:28px; height:28px; border-radius:50%; background:#0073ea; color:#fff;
	display:flex; align-items:center; justify-content:center; font-size:13px; font-weight:700;
}
.ec-account-menu{
	position:absolute; right:0; top:calc(100% + 6px); background:#fff; border:1px solid #e7e8ec;
	border-radius:8px; box-shadow:0 8px 24px rgba(41,47,76,.12); min-width:160px; z-index:10; overflow:hidden;
}
.ec-account-menu button{
	display:block; width:100%; text-align:left; padding:10px 14px; background:none; border:none;
	cursor:pointer; font-size:13.5px; color:#e2445c;
}
.ec-account-menu button:hover{ background:#fdeef1; }
.ec-main{ flex:1; padding:32px 40px; max-width:1120px; box-sizing:border-box; }
.ec-page-title{ font-size:22px; font-weight:700; color:#323338; margin:0 0 4px; }
.ec-page-subtitle{ font-size:13.5px; color:#676879; margin:0 0 24px; }
.ec-back-link{ display:inline-block; margin-bottom:14px; }
.ec-empty{ color:#9699a6; font-size:14px; }
.ec-intro-text{ color:#676879; font-size:13.5px; margin-bottom:18px; }

/* ============== Grille d'événements ============== */
.ec-event-grid{ display:grid; grid-template-columns:repeat(3, 1fr); gap:20px; }
@media (max-width: 900px){ .ec-event-grid{ grid-template-columns:repeat(2, 1fr); } }
@media (max-width: 600px){ .ec-event-grid{ grid-template-columns:1fr; } }
.ec-event-card{
	display:block; background:#fff; border:1px solid #e7e8ec; border-radius:10px; padding:18px;
	text-decoration:none; transition:box-shadow .15s, border-color .15s;
}
.ec-event-card:hover{ border-color:#0073ea; box-shadow:0 6px 20px rgba(0,115,234,.1); }
.ec-event-card__top{ margin-bottom:12px; }
.ec-event-card__name{ font-size:15px; font-weight:700; color:#323338; margin-bottom:8px; }
.ec-event-card__meta{ font-size:12.5px; color:#676879; margin-top:2px; }
.ec-pill{
	display:inline-flex; align-items:center; padding:4px 10px; border-radius:12px;
	color:#fff; font-size:11.5px; font-weight:700; white-space:nowrap;
}

/* ============== Onglets du détail dossier ============== */
.ec-tabs{ display:flex; gap:4px; border-bottom:2px solid #e7e8ec; margin-bottom:24px; }
.ec-tab{
	padding:10px 18px; font-size:14px; font-weight:600; color:#676879; cursor:pointer;
	border-bottom:2px solid transparent; margin-bottom:-2px; transition:color .15s, border-color .15s;
}
.ec-tab:hover{ color:#323338; }
.ec-tab.is-active{ color:#0073ea; border-bottom-color:#0073ea; }
.ec-doc-actions{ display:flex; flex-wrap:wrap; gap:10px; margin-bottom:20px; }
.ec-doc-actions--col{ flex-direction:column; align-items:flex-start; }
.ec-doc-btn{
	display:inline-flex; align-items:center; gap:8px; background:#fff; border:1.5px solid #e0e3eb;
	border-radius:8px; padding:12px 18px; font-size:14px; font-weight:600; color:#323338;
	text-decoration:none; cursor:pointer; transition:border-color .15s, background .15s;
}
.ec-doc-btn:hover{ border-color:#0073ea; background:#f7fafd; }
.ec-doc-btn.is-disabled{
	color:#c5c7d0; border-color:#e7e8ec; cursor:not-allowed; opacity:.7;
}
.ec-doc-btn.is-disabled:hover{ border-color:#e7e8ec; background:#fff; }

/* ============== QR code événement ============== */
.ec-qr-wrap{ display:flex; flex-direction:column; align-items:center; gap:14px; padding:20px 0; }
.ec-qr-wrap img{ border:1px solid #e7e8ec; border-radius:10px; padding:10px; background:#fff; }
.ec-qr-link{ font-size:12px; color:#9699a6; word-break:break-all; text-align:center; max-width:320px; }

/* ============== Feedback — étoiles ============== */
.ec-fb-stars{ margin-bottom:18px; }
.ec-fb-stars__label{ font-size:13.5px; font-weight:600; color:#4b5563; margin-bottom:6px; }
.ec-fb-stars__row span{ font-size:30px; color:#e0e3eb; cursor:pointer; transition:color .1s; }
.ec-fb-stars__row span.is-on{ color:#ffc107; }
.ec-file-list{ display:flex; flex-direction:column; gap:6px; }
.ec-file-list__item{ font-size:13.5px; color:#0073ea; text-decoration:none; }
.ec-file-list__item:hover{ text-decoration:underline; }

/* Sous-onglets du formulaire de complétion (une réception + facturation) */
.ec-subtabs{ display:flex; gap:4px; border-bottom:1px solid #e7e8ec; margin-bottom:20px; flex-wrap:wrap; }
.ec-subtab{
	padding:9px 16px; font-size:13.5px; font-weight:600; color:#676879; cursor:pointer;
	border-bottom:2px solid transparent; margin-bottom:-1px; transition:color .15s, border-color .15s;
}
.ec-subtab:hover{ color:#323338; }
.ec-subtab.is-active{ color:#0073ea; border-bottom-color:#0073ea; }
.ec-subpanel-grid{ display:grid; grid-template-columns:1fr 1fr; gap:0 20px; }
@media (max-width:600px){ .ec-subpanel-grid{ grid-template-columns:1fr; } }

/* Cases à cocher rendues en toggles, libellé à droite */
.ec-toggle-field{ display:flex; align-items:center; gap:10px; margin-bottom:20px; }
.ec-toggle-field label{ font-size:13.5px; font-weight:600; color:#4b5563; margin-bottom:0; order:2; }
.ec-toggle{ position:relative; display:inline-block; width:40px; height:22px; flex-shrink:0; order:1; }
.ec-toggle input{ opacity:0; width:0; height:0; }
.ec-toggle__track{
	position:absolute; inset:0; background:#d0d4e4; border-radius:22px; cursor:pointer; transition:background .15s;
}
.ec-toggle__track::before{
	content:""; position:absolute; width:16px; height:16px; left:3px; top:3px;
	background:#fff; border-radius:50%; transition:transform .15s;
}
.ec-toggle input:checked + .ec-toggle__track{ background:#0073ea; }
.ec-toggle input:checked + .ec-toggle__track::before{ transform:translateX(18px); }

/* Liste des factures (onglet Facturation du projet) */
.ec-invoice-row{
	display:flex; align-items:center; justify-content:space-between; gap:12px;
	padding:14px 16px; border:1px solid #e7e8ec; border-radius:8px; margin-bottom:10px;
}
.ec-invoice-row__name{ font-size:14px; font-weight:600; color:#323338; }
.ec-invoice-row__meta{ font-size:12.5px; color:#9699a6; margin-top:2px; }

/* Icône topbar (déconnexion) — même style que le CRM */
.topbar__btn{
	display:flex; align-items:center; justify-content:center; width:36px; height:36px;
	border-radius:6px; background:none; border:none; color:#676879; cursor:pointer; margin-left:8px;
}
.topbar__btn:hover{ background:#f0f1f6; color:#e2445c; }

/* Popup profil (Mes informations / Ma société) */
.ec-modal-overlay{
	position:fixed; inset:0; z-index:1000000; background:rgba(20,20,26,.5);
	display:flex; align-items:center; justify-content:center; padding:20px;
}
.ec-modal{
	background:#fff; border-radius:12px; width:100%; max-width:480px; max-height:88vh;
	overflow-y:auto; box-shadow:0 20px 60px rgba(0,0,0,.25);
}
.ec-modal__header{
	display:flex; align-items:center; justify-content:space-between;
	padding:18px 24px; border-bottom:1px solid #e7e8ec; position:sticky; top:0; background:#fff;
}
.ec-modal__header h2{ margin:0; font-size:17px; color:#323338; }
.ec-modal__close{ background:none; border:none; font-size:24px; line-height:1; color:#9699a6; cursor:pointer; }
.ec-modal__body{ padding:20px 24px 24px; }
.ec-modal__body .crm-auth-field{ margin-bottom:14px; }
.ec-modal__body .crm-auth-field label{ display:block; font-size:13px; font-weight:600; color:#4b5563; margin-bottom:6px; }
.ec-modal__body .crm-auth-field input{
	width:100%; box-sizing:border-box; padding:10px 12px; border:1px solid #d0d4e4; border-radius:6px; font-size:14px;
}
