/* Plan : 1. Base · 2. Mise en page · 3. Composants · 4. Écrans · 5. Responsive (toujours en dernier) */

/* ================================================================ 1. Base */
:root {
    --bg: #f4f5f7;
    --surface: #ffffff;
    --surface-2: #f8f9fa;
    --border: #e3e6ea;
    --text: #1d232b;
    --muted: #6b7480;
    --primary: #14213d;
    --primary-ink: #ffffff;
    --accent: #e8590c;
    --accent-soft: #fff1e8;
    --danger: #c92a2a;
    --warn: #b7791f;
    --success: #2b8a3e;
    --internal: #fff8db;
    --internal-border: #f0d77a;
    --radius: 10px;
    --shadow: 0 1px 2px rgba(16, 24, 40, .05), 0 1px 3px rgba(16, 24, 40, .06);
    color-scheme: light;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
a { color: #1c5bd9; text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 1.55rem; margin: 0 0 .25rem; line-height: 1.25; }
h2 { font-size: 1.1rem; margin: 0 0 .9rem; }
h3 { font-size: .95rem; margin: 0 0 .75rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
h1 small, h2 small { font-weight: 400; font-size: .8em; }
p { margin: 0 0 .75rem; }
.muted { color: var(--muted); }
.mt-sm { margin-top: 12px; }
.pad { padding: 16px 20px; }
.small { font-size: .85rem; }
.nowrap { white-space: nowrap; }
.text-warn { color: var(--warn); }
.text-danger { color: var(--danger); }
.text-accent { color: var(--accent); }
.icon { flex: none; vertical-align: -3px; }

/* ================================================================ 2. Mise en page */

/* Barre du haut */
.topbar { background: var(--primary); color: var(--primary-ink); position: sticky; top: 0; z-index: 10; }
.topbar-inner { max-width: 1240px; margin: 0 auto; padding: 0 16px; height: 58px; display: flex; align-items: center; gap: 24px; }
.brand { display: flex; align-items: center; gap: 10px; color: inherit; font-size: 1.02rem; white-space: nowrap; }
.brand:hover { text-decoration: none; }
.brand-mark { display: inline-grid; place-items: center; width: 30px; height: 30px; border-radius: 8px; background: var(--accent); color: #fff; font-weight: 800; }
.brand-tag { font-size: .7rem; text-transform: uppercase; letter-spacing: .06em; background: rgba(255,255,255,.14); padding: 2px 8px; border-radius: 99px; }
.nav { display: flex; gap: 4px; flex: 1; overflow-x: auto; }
.nav a { color: rgba(255,255,255,.75); padding: 8px 12px; border-radius: 8px; white-space: nowrap; }
.nav a:hover { color: #fff; background: rgba(255,255,255,.08); text-decoration: none; }
.nav a.active { color: #fff; background: rgba(255,255,255,.14); }
.doc-link { display: inline-grid; place-items: center; width: 36px; height: 36px; margin-left: auto; margin-right: -12px; border-radius: 50%; color: rgba(255,255,255,.8); background: rgba(255,255,255,.08); }
.doc-link:hover, .doc-link.active { color: #fff; background: rgba(255,255,255,.18); text-decoration: none; }
.doc-link .icon { width: 18px; height: 18px; vertical-align: 0; }

/* Menu du profil */
.usermenu { position: relative; }
.usermenu summary { list-style: none; cursor: pointer; }
.usermenu summary::-webkit-details-marker { display: none; }
.usermenu-panel { position: absolute; right: 0; top: calc(100% + 10px); min-width: 230px; background: var(--surface); color: var(--text); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: 0 8px 24px rgba(16, 24, 40, .14); padding: 6px; z-index: 20; }
.usermenu-head { padding: 10px 12px 12px; border-bottom: 1px solid var(--border); margin-bottom: 6px; }
.usermenu-head strong, .usermenu-head small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.usermenu-head small { color: var(--muted); }
.usermenu-panel a, .usermenu-panel button { display: block; width: 100%; text-align: left; padding: 9px 12px; border: 0; background: none; border-radius: 7px; color: var(--text); font: inherit; cursor: pointer; }
.usermenu-panel a:hover, .usermenu-panel button:hover { background: var(--surface-2); text-decoration: none; }
.usermenu-panel form { margin: 0; }

/* Page */
.container { max-width: 1240px; margin: 0 auto; padding: 24px 16px 64px; }
.page-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.page-head > div { min-width: 0; }
.head-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.back { display: inline-block; font-size: .85rem; color: var(--muted); margin-bottom: 4px; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px; margin-bottom: 16px; }
.card pre { background: var(--surface-2); border: 1px solid var(--border); border-radius: 6px; padding: 8px 12px; overflow-x: auto; font-size: .85rem; margin: 6px 0 0; }
.stack > .card:last-child { margin-bottom: 0; }
.narrow { max-width: 760px; }
.grid-2, .grid-3 { display: grid; gap: 0 16px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.empty { text-align: center; padding: 48px 20px; }
.empty-code { font-size: 3rem; font-weight: 800; color: #d0d5dc; }

/* ================================================================ 3. Composants */

/* Badges et étiquettes */
.badge { display: inline-block; padding: 2px 9px; border-radius: 99px; font-size: .75rem; font-weight: 600; line-height: 1.6; white-space: nowrap; background: #eef0f3; color: #3d4652; vertical-align: middle; }
.badge.pole { background: color-mix(in srgb, var(--pole) 12%, white); color: var(--pole); }
.st-nouveau { background: #e7f0ff; color: #1c5bd9; }
.st-en_cours { background: #fff4d6; color: #8a5a00; }
.st-attente_client { background: #f1e8ff; color: #6b3fb8; }
.st-resolu { background: #e3f6e8; color: #237a36; }
.st-ferme { background: #eceef1; color: #5b6470; }
.pr-basse { background: #f1f3f5; color: #6b7480; }
.pr-normale { background: #eef0f3; color: #3d4652; }
.pr-haute { background: #ffe8d9; color: #b54708; }
.pr-urgente { background: #ffe0e0; color: var(--danger); }
.prio { font-weight: 600; font-size: .88rem; } /* priorité en texte coloré (vue client) */
.prio::before { content: ''; display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: currentColor; margin-right: 6px; vertical-align: 1px; }
.prio-basse { color: #6b7480; }
.prio-normale { color: #1c5bd9; }
.prio-haute { color: #d9480f; }
.prio-urgente { color: var(--danger); font-weight: 700; }
.tag { display: inline-block; font-size: .7rem; text-transform: uppercase; letter-spacing: .04em; font-weight: 700; padding: 1px 7px; border-radius: 5px; background: #eef0f3; color: var(--muted); margin-left: 6px; vertical-align: middle; }
.tag-internal { background: var(--internal-border); color: #6b5300; }
.tag-warn { background: #fff4d6; color: #8a5a00; }
.ref { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .85em; color: var(--muted); font-weight: 600; }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); margin-left: 4px; }

/* Boutons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 9px 16px; border-radius: 8px; border: 1px solid #cfd4da; background: #fff; color: var(--text); font: inherit; font-weight: 600; cursor: pointer; white-space: nowrap; }
.btn:hover { background: var(--surface-2); text-decoration: none; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:hover { background: #d24f08; }
.btn-danger { color: var(--danger); border-color: #ffc9c9; }
.btn-danger:hover { background: #fff5f5; }
.btn-sm { padding: 5px 10px; font-size: .85rem; }
.btn-block { width: 100%; }
.linklike { background: none; border: 0; padding: 0; font: inherit; color: #1c5bd9; cursor: pointer; }
.linklike:hover { text-decoration: underline; }
.linklike:disabled { color: var(--muted); cursor: not-allowed; text-decoration: none; }
.icon-btn { display: inline-grid; place-items: center; width: 30px; height: 30px; padding: 0; border: 1px solid var(--border); border-radius: 7px; background: #fff; color: var(--muted); cursor: pointer; vertical-align: middle; }
.icon-btn:hover { color: var(--text); border-color: #c8cdd4; background: var(--surface-2); }
.icon-btn.danger:hover { color: var(--danger); border-color: #ffc9c9; background: #fff5f5; }
.icon-btn.off { color: var(--success); }
.inline-form { display: inline; }

/* Alertes */
.alert { padding: 12px 16px; border-radius: 8px; margin-bottom: 16px; border: 1px solid; }
.alert ul { margin: 0; padding-left: 18px; }
.alert-success { background: #ebfbee; border-color: #b2f2bb; color: #1e6b2f; }
.alert-error { background: #fff5f5; border-color: #ffc9c9; color: #a61e1e; }
.alert-warning { background: var(--accent-soft); border-color: #ffd0b0; color: #8a3a06; }

/* Photos de profil */
/* Avatars à initiales : 12 teintes, choisies d'après le nom (stables d'une page à l'autre) */
.av-hue-0 { background: hsl(0 55% 88%); color: hsl(0 45% 28%); }
.av-hue-1 { background: hsl(30 55% 88%); color: hsl(30 45% 28%); }
.av-hue-2 { background: hsl(60 55% 88%); color: hsl(60 45% 28%); }
.av-hue-3 { background: hsl(90 55% 88%); color: hsl(90 45% 28%); }
.av-hue-4 { background: hsl(120 55% 88%); color: hsl(120 45% 28%); }
.av-hue-5 { background: hsl(150 55% 88%); color: hsl(150 45% 28%); }
.av-hue-6 { background: hsl(180 55% 88%); color: hsl(180 45% 28%); }
.av-hue-7 { background: hsl(210 55% 88%); color: hsl(210 45% 28%); }
.av-hue-8 { background: hsl(240 55% 88%); color: hsl(240 45% 28%); }
.av-hue-9 { background: hsl(270 55% 88%); color: hsl(270 45% 28%); }
.av-hue-10 { background: hsl(300 55% 88%); color: hsl(300 45% 28%); }
.av-hue-11 { background: hsl(330 55% 88%); color: hsl(330 45% 28%); }
.avatar-pending { background: var(--accent-soft); color: var(--accent); }
.avatar-img { display: inline-flex; align-items: center; justify-content: center; flex: none; border-radius: 50%; object-fit: cover; vertical-align: middle; font-weight: 700; line-height: 1; overflow: hidden; background: #e9ecef; }
.av-xs { width: 22px; height: 22px; font-size: .6rem; }
.av-sm { width: 28px; height: 28px; font-size: .68rem; }
.av-md { width: 36px; height: 36px; font-size: .8rem; }
.av-lg { width: 88px; height: 88px; font-size: 1.8rem; }
.avatar-link { display: inline-flex; border-radius: 50%; box-shadow: 0 0 0 2px rgba(255,255,255,.25); }
.avatar-link:hover { box-shadow: 0 0 0 2px rgba(255,255,255,.6); }
.person { display: inline-flex; align-items: center; gap: 8px; }
.interlocutor { display: flex; align-items: center; gap: 12px; }
.interlocutor small { display: block; color: var(--muted); }

/* Listes */
.list { display: flex; flex-direction: column; }
.card.list { padding: 0; overflow: hidden; }
.row-link { display: flex; align-items: center; gap: 16px; justify-content: space-between; padding: 14px 20px; border-top: 1px solid var(--border); color: inherit; }
.card .list .row-link { padding-left: 0; padding-right: 0; }
.card.list .row-link { padding: 14px 20px; }
.row-link:first-child { border-top: 0; }
.row-link:hover { background: var(--surface-2); text-decoration: none; }
.row-attention { box-shadow: inset 3px 0 0 var(--accent); }
.row-main { min-width: 0; }
.row-title { font-weight: 600; overflow: hidden; text-overflow: ellipsis; }
.row-meta { color: var(--muted); font-size: .85rem; margin-top: 4px; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.row-side { display: flex; gap: 6px; flex: none; }
.row-inactive { opacity: .55; }
.mini-list { list-style: none; margin: 0; padding: 0; }
.mini-list li { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 7px 0; border-top: 1px solid var(--border); font-size: .9rem; }
.mini-list li:first-child { border-top: 0; }
.mini-list li a { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.facts { display: grid; grid-template-columns: 1fr auto; gap: 8px 12px; margin: 0; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; font-weight: 600; text-align: right; }

/* Tableaux */
.table-wrap { padding: 0; overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.table th { text-align: left; font-size: .75rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 600; padding: 12px 14px; border-bottom: 1px solid var(--border); background: var(--surface-2); white-space: nowrap; }
.table td { padding: 12px 14px; border-bottom: 1px solid var(--border); vertical-align: top; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr[data-href] { cursor: pointer; }
.table tbody tr:hover { background: var(--surface-2); }
.table td a { color: var(--text); font-weight: 500; }
.row-actions { text-align: right; }
.row-actions .inline-form + .inline-form { margin-left: 4px; }

/* Onglets et pagination */
.tabs { display: flex; gap: 4px; margin-bottom: 12px; border-bottom: 1px solid var(--border); }
.tabs a { padding: 8px 14px; color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tabs a.active { color: var(--text); border-color: var(--accent); font-weight: 600; }
.tabs a:hover { text-decoration: none; color: var(--text); }
.tabs .count { display: inline-block; min-width: 20px; padding: 0 6px; margin-left: 4px; border-radius: 99px; background: #eef0f3; font-size: .75rem; text-align: center; }
.pager { display: flex; gap: 12px; align-items: center; justify-content: center; }

/* Formulaires */
.form label { display: block; font-weight: 600; font-size: .88rem; margin-bottom: 14px; }
.form label small { font-weight: 400; }
.form input:not([type=checkbox]):not([type=radio]):not([type=file]), .form select, .form textarea, .filters input, .filters select {
    display: block; width: 100%; margin-top: 6px; padding: 9px 11px; font: inherit; font-weight: 400; color: var(--text);
    background: #fff; border: 1px solid #cfd4da; border-radius: 8px;
}
.form textarea { resize: vertical; min-height: 110px; }
.form input:focus, .form select:focus, .form textarea:focus, .filters input:focus, .filters select:focus { outline: 2px solid color-mix(in srgb, var(--accent) 35%, transparent); border-color: var(--accent); }
.form.compact label { margin-bottom: 10px; }
.form.compact select, .form.compact input:not([type=checkbox]):not([type=radio]) { padding: 7px 9px; }
.form label.checkbox, .form label.radio { display: flex; align-items: center; gap: 8px; font-weight: 400; margin-bottom: 8px; }
.form label.inline { display: flex; align-items: center; gap: 8px; margin: 0; font-weight: 400; color: var(--muted); }
.form label.inline select { margin: 0; width: auto; }
.form h2 { margin-top: 8px; }
.field-group { margin-bottom: 14px; }
.field-group .label { display: block; font-weight: 600; font-size: .88rem; margin-bottom: 8px; }
.form-actions { display: flex; justify-content: flex-end; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 6px; }
.inline-field { display: flex; align-items: center; gap: 6px; font-size: .88rem; color: var(--muted); white-space: nowrap; }
.inline-field input { margin: 0 !important; }
.file-drop { display: block; border: 1px dashed #b9c0c9; border-radius: 8px; padding: 12px 14px; background: var(--surface-2); cursor: pointer; font-weight: 400 !important; }
.file-drop input { display: block; margin-bottom: 6px; max-width: 100%; }
.file-drop-text small { color: var(--muted); }
.file-list { display: block; font-size: .85rem; color: var(--muted); }
.file-list .err { color: var(--danger); }
.photo-field { display: flex; align-items: center; gap: 18px; margin-bottom: 16px; flex-wrap: wrap; }
.photo-field .photo-actions { display: flex; flex-direction: column; gap: 6px; }
.photo-field input[type=file] { font-size: .85rem; }
.add-contact { margin-top: 12px; }
.add-contact summary { list-style: none; display: inline-block; }
.add-contact summary::-webkit-details-marker { display: none; }
.add-contact[open] summary { margin-bottom: 14px; }

/* Barres de filtres (une grille par écran) */
.filters { display: grid; grid-template-columns: 2fr repeat(5, minmax(0, 1fr)); gap: 10px; padding: 12px; }
.filters input, .filters select { margin: 0; }
.filters-compact { grid-template-columns: 2fr 1fr; }
.filters-security { grid-template-columns: 2fr 1fr 1.4fr; }
.filters-satisfaction { grid-template-columns: auto auto 1.4fr 1fr 1fr auto; align-items: center; }

/* Indicateurs chiffrés et barres */
.kpis { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 12px; margin-bottom: 20px; }
.kpis-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.kpi { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px 18px; color: inherit; display: flex; flex-direction: column; }
.kpi:hover { text-decoration: none; border-color: #c8cdd4; }
.kpi-value { font-size: 1.9rem; font-weight: 700; line-height: 1.1; font-variant-numeric: tabular-nums; }
.kpi-label { color: var(--muted); font-size: .85rem; margin-top: 4px; }
.bar-row { display: grid; grid-template-columns: 1fr 90px 28px; gap: 10px; align-items: center; padding: 6px 0; color: inherit; font-size: .9rem; }
.bar-row:hover { text-decoration: none; }
.bar { display: block; width: 100%; height: 8px; background: #eef0f3; border-radius: 99px; overflow: hidden; }
.bar rect { fill: var(--pole, var(--accent)); }
.bar-value { text-align: right; font-weight: 700; font-variant-numeric: tabular-nums; }

/* Avis de satisfaction (badge, visages) */
.rating-badge { display: inline-block; padding: 2px 10px; border-radius: 99px; font-weight: 600; font-size: .85rem; color: var(--rating); background: color-mix(in srgb, var(--rating) 12%, white); white-space: nowrap; }
.rating-face-sm { font-size: 1.35rem; line-height: 1; text-decoration: none !important; }
.rating-faces { display: flex; gap: 10px; flex-wrap: wrap; }
.rating-face { display: inline-flex; flex-direction: column; align-items: center; gap: 4px; min-width: 96px; padding: 10px 14px; border: 2px solid color-mix(in srgb, var(--rating) 35%, white); border-radius: 12px; background: #fff; color: var(--rating); font: inherit; font-weight: 600; cursor: pointer; }
.rating-face .face { font-size: 1.8rem; line-height: 1; }
.rating-face:hover, .rating-face.is-selected { border-color: var(--rating); background: color-mix(in srgb, var(--rating) 10%, white); }

/* ================================================================ 4. Écrans */

/* Connexion, code de vérification */
body.auth { background: radial-gradient(circle at 20% 0%, #1e3260, var(--primary) 60%); min-height: 100vh; }
.auth-wrap { max-width: 420px; margin: 0 auto; padding: 8vh 16px 32px; }
.auth-brand { display: flex; align-items: center; justify-content: center; gap: 10px; color: #fff; font-size: 1.2rem; margin-bottom: 20px; }
.auth-card { padding: 28px; }
.auth-links { margin-top: 14px; text-align: center; font-size: .9rem; }
.auth-foot { text-align: center; color: rgba(255,255,255,.55); font-size: .8rem; margin-top: 20px; }
.auth-doc { text-align: center; margin: 12px 0 0; font-size: .9rem; }
.auth-doc .icon { vertical-align: -3px; margin-right: 4px; }
.code-input { font-size: 1.5rem !important; letter-spacing: .35em; text-align: center; font-variant-numeric: tabular-nums; }
.verify-links { display: flex; justify-content: space-between; align-items: center; margin: 14px 0; }

/* Tableau de bord */
.dash-grid { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 20px; align-items: start; }

/* Ticket : fil de discussion, réponse, avis */
.ticket-layout { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 20px; align-items: start; }
.ticket-layout.single { grid-template-columns: minmax(0, 860px); }
.sidebar { position: sticky; top: 78px; }
.timeline { display: flex; flex-direction: column; gap: 12px; margin-bottom: 16px; }
.msg { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 14px 18px; }
.msg header { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; flex-wrap: wrap; }
.msg header .tag { margin-left: 0; }
.msg header time { margin-left: auto; color: var(--muted); font-size: .8rem; }
.msg-staff { border-left: 3px solid var(--primary); }
.msg-client { border-left: 3px solid var(--accent); }
.msg-internal { background: var(--internal); border-color: var(--internal-border); border-left-color: #d9a400; }
.msg-body { overflow-wrap: anywhere; }
.attachments { list-style: none; margin: 12px 0 0; padding: 10px 0 0; border-top: 1px dashed var(--border); display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: .88rem; }
.event { text-align: center; font-size: .8rem; color: var(--muted); }
.event span { background: var(--bg); padding: 0 10px; }
.reply-mode { display: flex; gap: 20px; flex-wrap: wrap; margin-bottom: 10px; }
.reply.is-internal { background: var(--internal); border-color: var(--internal-border); }
.rating-card h3 { margin-bottom: 6px; }
.rating-card p { margin-bottom: 10px; }
.rating-comment { margin-top: 12px; }
.rating-comment textarea { display: block; width: 100%; margin: 8px 0; padding: 8px 10px; font: inherit; border: 1px solid #cfd4da; border-radius: 8px; }
.rating-choice { text-align: center; font-size: 1.2rem; margin: 18px 0; }
.rating-change a { margin-left: 8px; }

/* Ticket : tâches Asana (fiche et formulaire de création) */
.asana-tasks { list-style: none; margin: 0 0 12px; padding: 0; }
.asana-tasks li { padding: 8px 0; border-top: 1px solid var(--border); font-size: .9rem; }
.asana-tasks li:first-child { border-top: 0; padding-top: 0; }
.asana-tasks a { font-weight: 600; margin-right: 6px; }
.asana-tasks small { display: block; margin-top: 3px; }
.asana-note { margin-top: -6px; }
.asana-box { border: 1px solid var(--border); border-radius: 8px; padding: 12px 14px; margin: 4px 0 14px; background: var(--surface-2); }
.asana-box > label.checkbox { margin: 0; }
.asana-fields { margin-top: 12px; }
.asana-fields[hidden] { display: none; }
.asana-files { align-self: end; }

/* Étoile « Client embarqué » (liste et fiche client) */
.star { display: inline-grid; place-items: center; padding: 2px; border: 0; background: none; color: #1d232b; line-height: 0; vertical-align: middle; }
.star svg { fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linejoin: round; }
.star.is-on { color: #e0a800; }
.star.is-on svg { fill: #fcc419; stroke: #e0a800; }
button.star { cursor: pointer; border-radius: 6px; }
button.star:hover { background: var(--surface-2); }
.star-col { width: 1%; padding-right: 4px !important; }
.star-col .inline-form + .small, .star-col .star + .small { margin-left: 2px; }
.org-title { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.org-title .star svg { width: 22px; height: 22px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* Fiche client : projets (liens production / préproduction) */
.card-head { display: flex; align-items: center; gap: 8px; margin-bottom: .9rem; }
.card-head h2 { margin: 0; }
.icon-btn-sm { width: 24px; height: 24px; border-radius: 6px; }
.icon-btn-sm .icon { width: 14px; height: 14px; vertical-align: 0; }
.icon-btn[aria-expanded="true"] { color: var(--accent); border-color: var(--accent); }
.project-add { margin-bottom: 14px; padding: 12px 14px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface-2); }
.project-add[hidden] { display: none; }
.projects { list-style: none; margin: 0 0 12px; padding: 0; }
.project { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 16px; padding: 10px 0; border-top: 1px solid var(--border); }
.project:first-child { border-top: 0; padding-top: 0; }
.project-main { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; min-width: 0; }
.project-links { display: inline-flex; flex-wrap: wrap; gap: 6px; }
.btn-prod { border-color: var(--accent); color: var(--accent); }
.project-edit { display: inline-block; margin-left: 4px; }
.project-edit summary { list-style: none; }
.project-edit summary::-webkit-details-marker { display: none; }
.project-edit[open] { display: block; flex-basis: 100%; }
.project-edit[open] form { margin-top: 10px; text-align: left; }
.project:has(.project-edit[open]) .row-actions { flex-basis: 100%; text-align: left; }
.project-mini { margin: 0 0 8px; }
.project-mini .project-links { margin-top: 4px; }

/* Import Evoliz */
.evoliz-toolbar, .evoliz-submit { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 12px 16px; }
.evoliz-submit { justify-content: space-between; }
.evoliz-submit label.checkbox { display: flex; align-items: center; gap: 8px; margin: 0; }
.evoliz-table select { width: 100%; min-width: 170px; padding: 6px 8px; font: inherit; font-size: .88rem; border: 1px solid #cfd4da; border-radius: 6px; background: #fff; }
.match { display: inline-block; font-size: .7rem; font-weight: 700; text-transform: uppercase; letter-spacing: .03em; padding: 1px 6px; border-radius: 4px; margin-right: 4px; }
.match-strong { background: #e3f6e8; color: #237a36; }
.match-weak { background: #fff4d6; color: #8a5a00; }
.steps { padding-left: 20px; margin: 0; }
.steps li { margin-bottom: 10px; }
.steps pre { background: var(--surface-2); border: 1px solid var(--border); border-radius: 6px; padding: 8px 12px; overflow-x: auto; font-size: .85rem; margin: 6px 0 0; }

/* Journal de sécurité */
.security-table td { vertical-align: middle; }
.lvl-badge-info { background: #eef0f3; color: #3d4652; }
.lvl-badge-warning { background: #fff4d6; color: #8a5a00; }
.lvl-badge-alert { background: #ffe0e0; color: var(--danger); }
tr.lvl-alert { background: #fff8f8; }

/* Connexions aux services */
.connections { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.connection { margin: 0; display: flex; flex-direction: column; gap: 10px; }
.connection header { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.connection h2 { margin: 0; }
.connection p { margin: 0; }
.connection form { margin-top: auto; }
.connection-error { background: #fff5f5; border-left: 3px solid var(--danger); padding: 8px 12px; border-radius: 6px; overflow-wrap: anywhere; }

/* Satisfaction (vue équipe) */
.sat-score { font-size: 2.4rem; font-weight: 700; line-height: 1; color: var(--rating, inherit); }
.sat-bar { display: block; width: 100%; height: 12px; border-radius: 99px; overflow: hidden; background: #eef0f3; margin: 10px 0 6px; }
.sat-bar rect { fill: var(--rating); }

/* Documentation */
.doc-layout { display: grid; grid-template-columns: 240px minmax(0, 1fr); gap: 20px; align-items: start; }
.doc-toc { position: sticky; top: 78px; }
.doc-toc ol { margin: 0; padding-left: 20px; }
.doc-toc li { margin: 6px 0; font-size: .92rem; }
.doc { max-width: 860px; padding: 28px 32px; line-height: 1.65; }
.doc section { padding-top: 8px; margin-top: 18px; border-top: 1px solid var(--border); scroll-margin-top: 80px; }
.doc h2 { font-size: 1.2rem; margin: 14px 0 10px; }
.doc h3 { text-transform: none; letter-spacing: 0; font-size: 1rem; color: var(--text); margin: 16px 0 6px; }
.doc ul, .doc ol { padding-left: 22px; margin: 0 0 12px; }
.doc li { margin: 4px 0; }
.doc-intro { font-size: 1.05rem; }
.doc-tip { background: var(--accent-soft); border-left: 3px solid var(--accent); padding: 10px 14px; border-radius: 6px; font-size: .92rem; }
.doc-table { margin: 6px 0 14px; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; }
.doc-table td { vertical-align: middle; }
.doc-toc-group { margin-top: 16px; }
.doc-part { margin-top: 36px; padding: 16px 18px; border-radius: 8px; background: var(--accent-soft); border-left: 3px solid var(--accent); }
.doc-part + section { border-top: 0; }
.doc-part-label { margin: 0 0 4px; font-size: .78rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--accent); }
.doc-part .doc-intro { margin: 0; }
.doc code { font-size: .88em; background: var(--surface-2); padding: 1px 5px; border-radius: 4px; }

/* Fenêtres modales */
.modal { width: min(520px, calc(100vw - 32px)); padding: 0; border: 1px solid var(--border); border-radius: var(--radius); box-shadow: 0 16px 48px rgba(16, 24, 40, .25); color: var(--text); background: var(--surface); }
.modal::backdrop { background: rgba(20, 33, 61, .45); }
.modal > form { padding: 18px 20px; }
.modal-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 8px; }
.modal-head h2 { margin: 0; }
.modal-list { max-height: 50vh; overflow-y: auto; margin: 12px 0; padding: 4px 10px; border: 1px solid var(--border); border-radius: 8px; }
.modal-list label.checkbox { margin: 6px 0; }
.modal-list small { display: block; }
.connection-head-actions { display: inline-flex; align-items: center; gap: 8px; }

/* Planning de production : semaine de travail en largeur, week-end étroit et grisé, jours fériés grisés */
.planning-toolbar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.planning-heading { font-size: 1.1rem; min-width: 11em; text-align: center; }
.planning-spacer { flex: 1; }
.planning-views { display: inline-flex; border: 1px solid #cfd4da; border-radius: 8px; overflow: hidden; }
.planning-views a { padding: 5px 12px; color: var(--muted); font-size: .85rem; }
.planning-views a.active { background: var(--primary); color: var(--primary-ink); }
.planning-views a:hover { text-decoration: none; }
.planning { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)) repeat(2, minmax(0, .45fr)); gap: 4px; margin-bottom: 10px; }
.planning-weekday { font-size: .75rem; color: var(--muted); text-transform: uppercase; letter-spacing: .03em; padding: 0 4px; }
.planning-day { position: relative; min-height: 96px; padding: 4px; background: var(--surface); border: 1px solid var(--border); border-radius: 8px; display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.planning-week .planning-day { min-height: 260px; }
.planning-day.is-weekend, .planning-day.is-holiday, .planning-weekday.is-weekend { background: #eceef1; }
.planning-weekday.is-weekend { background: none; }
.planning-day.is-other-month { opacity: .55; }
.planning-day.is-today { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.planning-add { position: absolute; inset: 0; border-radius: 8px; }
.planning-add:hover { background: rgba(232, 89, 12, .06); }
.planning-daynum { position: relative; pointer-events: none; font-size: .8rem; font-weight: 600; color: var(--muted); }
.planning-daynum small { display: block; font-weight: 400; font-size: .7rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.planning-event { position: relative; display: block; padding: 2px 5px; border-radius: 5px; font-size: .75rem; line-height: 1.35; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.planning-week .planning-event { white-space: normal; }
.planning-event small { display: block; opacity: .85; }
.planning-event:hover { text-decoration: none; filter: brightness(.96); }
.planning-event-stage { opacity: .75; }
.stage-preprod { background: #e7efff; color: #1c4fb8; }
.stage-prod { background: #e3f6e8; color: #237a36; }
.kind-security { background: #ffe8d4; color: #b4500b; }
.planning-event.is-late, .planning-late-badge { background: #ffe0e0; color: var(--danger); }
.planning-event.is-done { text-decoration: line-through; opacity: .65; }
.planning-legend { margin: 0 0 20px; }
.planning-list { display: flex; flex-direction: column; }
.planning-row { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--border); }
.planning-row:last-child { border-bottom: 0; }
.planning-row.is-late .planning-when { color: var(--danger); font-weight: 600; }
.planning-when { min-width: 8.5em; font-size: .85rem; color: var(--muted); white-space: nowrap; }
.planning-row-main { flex: 1; min-width: 0; color: var(--text); }
.planning-row-main:hover { text-decoration: none; color: var(--accent); }
.planning-comment { display: block; }
.planning-stages { border: 0; padding: 0; margin: 0 0 12px; display: flex; align-items: center; flex-wrap: wrap; gap: 6px 20px; }
.planning-kind { font-weight: 600; }
.form .planning-stages label.checkbox { margin: 0; }
.planning-stages legend { font-weight: 600; margin-bottom: 6px; padding: 0; }
.planning-history { margin: 0; padding-left: 18px; }
.planning-note { background: var(--internal); border: 1px solid var(--internal-border); border-radius: 8px; padding: 10px 12px 2px; margin-bottom: 12px; }
.planning-note .tag { margin-bottom: 6px; }
.planning-visible { display: inline-flex; vertical-align: -2px; margin-right: 3px; color: inherit; }
.planning-visible .icon { width: 13px; height: 13px; }
.form label.checkbox.is-disabled { color: var(--muted); }
.client-deadlines h2 { margin-bottom: 8px; }
.client-deadlines-list { list-style: none; margin: 0; padding: 0; }
.client-deadlines-list li { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 10px; padding: 7px 0; border-bottom: 1px solid var(--border); }
.client-deadlines-list li:last-child { border-bottom: 0; }
.client-deadline-date { min-width: 9em; font-weight: 600; }
.security-table td { vertical-align: top; }
.security-check > summary { list-style: none; cursor: pointer; }
.security-check > summary::-webkit-details-marker { display: none; }
.security-check[open] { min-width: 300px; }
.security-check form { margin-top: 10px; }
.security-history { list-style: none; margin: 0; padding: 0; }
.security-actions { white-space: nowrap; }
.security-actions > * { vertical-align: top; }
.security-check { display: inline-block; }
.security-history li { padding: 10px 0; border-bottom: 1px solid var(--border); }
.security-history li:last-child { border-bottom: 0; }
.security-history .planning-note { margin: 6px 0 0; padding: 8px 10px; }
.project-security { display: block; color: var(--muted); }
.project-security.security-late { color: var(--danger); font-weight: 600; }
.planning-history li { margin-bottom: 4px; }
.card-head-link { font-size: .85rem; font-weight: 400; }
.planning-block-head { justify-content: space-between; }
.planning-block-actions { display: inline-flex; align-items: center; gap: 10px; }
@media (max-width: 720px) {
    .planning { grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 2px; }
    .planning-day { min-height: 56px; padding: 2px; }
    .planning-event { font-size: 0; padding: 0; height: 6px; }
    .planning-week .planning-event { font-size: .7rem; height: auto; padding: 2px 3px; }
    .planning-daynum small { display: none; }
    .planning-row { flex-wrap: wrap; }
}

/* Opportunités */
.quick-add { display: inline-flex; align-items: center; gap: 5px; margin-left: auto; padding: 6px 12px; border-radius: 99px; font-size: .85rem; font-weight: 600; color: #fff; background: var(--accent); }
.quick-add:hover { text-decoration: none; filter: brightness(1.08); }
.quick-add + .doc-link { margin-left: 8px; }
.opp-detected { background: #eef0f3; color: #3d4652; }
.opp-discussion { background: #e7efff; color: #1c4fb8; }
.opp-quote { background: #fff4d6; color: #8a5a00; }
.opp-won { background: #e3f6e8; color: #237a36; }
.opp-lost { background: #ffe0e0; color: var(--danger); }
.opp-table td { vertical-align: top; }
.opp-description { max-width: 28em; }
.opp-status-form { display: flex; gap: 6px; flex-wrap: wrap; }
.opp-feed { list-style: none; margin: 14px 0 0; padding: 0; }
.opp-feed li { padding: 8px 0; border-top: 1px solid var(--border); }
.opp-feed li.is-note div { background: var(--internal); border: 1px solid var(--internal-border); border-radius: 8px; padding: 8px 10px; margin-top: 3px; }
.opp-feed li.is-event div { color: var(--muted); font-size: .9rem; }

/* Environnement technique */
.section-title { margin: 24px 0 10px; font-size: 1.05rem; }
.tech-table td { vertical-align: top; }
.tech-table td:first-child { width: 20%; }
.tech-table td:nth-child(2), .tech-table td:nth-child(3) { width: 26%; }
.tech-banner { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.tech-banner form { margin: 0; }
.tech-banner .btn-close { border: 0; background: none; font-size: 1.3rem; line-height: 1; color: inherit; cursor: pointer; padding: 0 4px; }

/* Historique des e-mails (Brevo) */
.mail-ok { background: #e3f6e8; color: #237a36; }
.mail-info { background: #eef1f6; color: #5a6b85; }
.mail-read { background: #2b8a3e; color: #ffffff; }
.mail-warn { background: #fff4d6; color: #8a5a00; }
.mail-bad { background: #ffe0e0; color: var(--danger); }
tr.mail-problem { background: #fff8f8; }
.mail-table td { vertical-align: top; }
.mail-subject { margin-bottom: 4px; }
.mail-date { display: inline-block; min-width: 6.4em; } /* heures alignées, date seulement en début de journée */
.mail-state { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 6px; }
.mail-alert a { margin-left: 6px; font-weight: 600; }
.card-head-padded { justify-content: space-between; padding: 16px 20px 0; }
.card-pad { padding: 0 20px 16px; }

/* Temps de développement (Clockify) */
.clockify-card > summary { display: flex; align-items: center; justify-content: space-between; gap: 8px; list-style: none; cursor: pointer; }
.clockify-card > summary::-webkit-details-marker { display: none; }
.clockify-card > summary h3 { margin: 0; }
.clockify-card > summary h3::before { content: "▸ "; }
.clockify-card[open] > summary { margin-bottom: .75rem; }
.clockify-card[open] > summary h3::before { content: "▾ "; }
.clockify-summary { font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
.clockify-total { margin: 0 0 10px; font-size: 1.15rem; }
.clockify-card .facts { margin-bottom: 12px; }
.time-table th.num, .time-table td.num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.time-link { display: flex; gap: 6px; align-items: center; margin-top: 6px; }
.time-link select { max-width: 240px; padding: 4px 6px; font: inherit; font-size: .85rem; border: 1px solid #cfd4da; border-radius: 6px; background: #fff; }
.time-table tfoot th { border-top: 2px solid var(--border); color: var(--text); font-size: .9rem; text-transform: none; letter-spacing: 0; background: var(--surface); }

/* ================================================================ 5. Responsive */
@media (max-width: 1080px) {
    .filters { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .filters input[type=search] { grid-column: 1 / -1; }
    .filters-security, .filters-satisfaction { grid-template-columns: minmax(0, 1fr); }
    .kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .kpis-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .dash-grid, .ticket-layout { grid-template-columns: minmax(0, 1fr); }
    .sidebar { position: static; }
}
@media (max-width: 900px) {
    .doc-layout { grid-template-columns: minmax(0, 1fr); }
    .doc-toc { position: static; }
    .doc { padding: 20px; }
}
@media (max-width: 720px) {
    .topbar-inner { gap: 12px; height: auto; min-height: 56px; flex-wrap: wrap; padding-top: 8px; padding-bottom: 8px; }
    .brand-tag { display: none; }
    .nav { order: 3; flex-basis: 100%; }
    .doc-link { margin-left: auto; margin-right: -4px; }
    .grid-2, .grid-3 { grid-template-columns: minmax(0, 1fr); }
    .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .filters { grid-template-columns: minmax(0, 1fr); }
    .connections { grid-template-columns: minmax(0, 1fr); }
    .row-link { flex-direction: column; align-items: flex-start; gap: 8px; }
    h1 { font-size: 1.3rem; }
    .card { padding: 16px; }
    .table th:nth-child(n+5), .table td:nth-child(n+5) { display: none; }
}

