/* Compléments propres à l'application réelle */
.connect-box { display: flex; gap: 8px; width: 100%; max-width: 520px; margin: 8px auto 0; }
.connect-box .input { flex: 1; min-width: 0; }
.loader-card { display: flex; flex-direction: column; align-items: center; gap: 14px; }
.spinner { width: 34px; height: 34px; border-radius: 50%; border: 3px solid var(--violet); border-right-color: transparent; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.banner { margin: 0 0 14px; padding: 10px 14px; border-radius: 12px; font-size: 13px; background: rgba(251, 191, 36, .08); border: 1px solid rgba(251, 191, 36, .35); color: #fcd34d; }
.banner.warn { background: rgba(248, 113, 113, .08); border-color: rgba(248, 113, 113, .4); color: #fca5a5; }
.banner .link-btn { color: inherit; font-weight: 600; }

.toggle-row { display: flex !important; flex-direction: row !important; align-items: flex-start; gap: 10px; padding: 10px 0; color: #d3d3d8; font-size: 13px; cursor: pointer; }
.toggle-row input { margin-top: 3px; accent-color: var(--violet); width: 16px; height: 16px; flex: none; }

.conn-list { display: flex; flex-direction: column; gap: 12px; margin-top: 6px; }
.conn { border: 1px solid var(--line); border-radius: 12px; padding: 14px; background: var(--bg2); display: flex; flex-direction: column; gap: 8px; }
.conn-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }
.conn-head b { font-size: 14px; }
.conn p { margin: 0; color: var(--muted); font-size: 12.5px; }
.conn .row2 { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 8px; }
.conn .actions { display: flex; gap: 8px; justify-content: flex-end; }
.state { font-size: 12px; font-weight: 600; padding: 3px 10px; border-radius: 99px; white-space: nowrap; }
.state.ok { color: var(--green); background: rgba(52, 211, 153, .1); border: 1px solid rgba(52, 211, 153, .35); }
.state.ko { color: var(--amber); background: rgba(251, 191, 36, .08); border: 1px solid rgba(251, 191, 36, .35); }
.state.opt { color: var(--muted); border: 1px solid var(--line); }

.detail-links { display: flex; gap: 14px; flex-wrap: wrap; font-size: 13px; margin: 2px 0 12px; }
.detail-links a { color: var(--violet2); }
.field-label { display: block; color: var(--muted); font-size: 12px; margin: 10px 0 4px; }
#detail .input { width: 100%; }
.message { width: 100%; }

.kanban { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.card .moves { display: flex; gap: 6px; margin-top: 8px; flex-wrap: wrap; }
.move { background: var(--violet-soft); color: var(--violet2); border: 1px solid rgba(255, 255, 255, .16); border-radius: 8px; padding: 4px 8px; font: inherit; font-size: 12px; cursor: pointer; }
.move.back { background: transparent; color: var(--muted); border-color: var(--line); }
.card small { display: block; color: var(--muted); font-size: 11.5px; margin-top: 2px; }
.card-signal { display: inline-block; margin-top: 6px; color: var(--green); font-size: 11px; font-style: normal; }
.card-chat, .crm-chat { margin-top: 7px; }
.crm-source { display: block; color: var(--green); font-size: 10px; margin-top: 3px; }
.results-volt { grid-column: 1 / -1; }
.volt-activity { list-style: none; margin: 12px 0 0; padding: 0; display: grid; gap: 7px; max-height: 220px; overflow: auto; }
.volt-activity li { display: flex; justify-content: space-between; gap: 14px; padding: 8px 0; border-top: 1px dashed var(--line); font-size: 12px; }
.volt-activity li span { color: var(--muted); text-align: right; }

.settings-stack { display: flex; flex-direction: column; gap: 16px; max-width: 860px; }
.ex-add { display: flex; gap: 8px; margin-bottom: 10px; }
.ex-add .input { flex: 1; min-width: 0; }
.ex-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; max-height: 320px; overflow: auto; }
.ex-list li { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 8px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--bg2); }
.ex-list li span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ex-list li small { color: var(--muted); margin-left: 6px; }
.ex-list button { background: none; border: 0; color: var(--muted); cursor: pointer; font: inherit; font-size: 12px; }
.ex-list button:hover { color: var(--red); }

.test-result { font-size: 12.5px; color: var(--muted); white-space: pre-line; }

@media (max-width: 1100px) { .kanban { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 820px) {
  .kanban { grid-template-columns: minmax(0, 1fr); }
  .conn .row2 { grid-template-columns: minmax(0, 1fr); }
  .connect-box { flex-direction: column; }
  .topbar-actions { flex-wrap: wrap; }
}
.card .moves .move { width: auto; margin: 0; flex: 1; text-align: center; }
.card .moves .move.back { flex: 0 0 34px; }

/* Connexion / inscription */
.auth-card { max-width: 460px; width: 100%; }
.auth-tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; padding: 4px; border: 1px solid var(--line); border-radius: 12px; background: var(--bg2); margin: 6px 0 14px; }
.auth-tab { background: none; border: 0; color: var(--muted); font: inherit; font-weight: 600; padding: 8px; border-radius: 9px; cursor: pointer; }
.auth-tab.active { background: var(--violet-soft); color: var(--text); }
.auth-form { display: flex; flex-direction: column; gap: 12px; text-align: left; }
.auth-form label { display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: #d3d3d8; }
.auth-form label small { color: var(--muted); font-weight: 400; }
.auth-form .btn { justify-content: center; width: 100%; }
.auth-info { margin: 12px 0 0; padding: 10px 12px; border-radius: 10px; font-size: 13px; color: var(--green); background: rgba(52, 211, 153, .08); border: 1px solid rgba(52, 211, 153, .3); text-align: left; }

/* Envoi des emails */
.mode-card { display: flex !important; flex-direction: row !important; gap: 12px; align-items: flex-start; border: 1px solid var(--line); border-radius: 12px; padding: 14px; background: var(--bg2); cursor: pointer; transition: .15s; }
.mode-card > div { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.mode-card input[type="radio"] { margin-top: 3px; accent-color: var(--violet); width: 16px; height: 16px; flex: none; }
.mode-card.active { border-color: rgba(122, 162, 255, .42); background: rgba(255, 255, 255, .03); }
.mode-card p { margin: 0; color: var(--muted); font-size: 12.5px; }
.smtp-form { display: flex; flex-direction: column; gap: 10px; margin-top: 8px; cursor: default; }
.smtp-form label { display: flex; flex-direction: column; gap: 5px; font-size: 12.5px; color: #d3d3d8; }
.smtp-form label small { color: var(--muted); font-weight: 400; }
.smtp-form .row2 { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 8px; }
.smtp-form .input { width: 100%; }
.hint { margin: 0; font-size: 12px; color: var(--muted); }
.hint a { color: var(--violet2); }
.mail-actions { display: flex; gap: 10px; justify-content: flex-end; align-items: center; margin-top: 12px; flex-wrap: wrap; }
.mail-actions .test-result { flex: 1; min-width: 0; }
.row-actions { display: flex; gap: 8px; margin-top: 12px; }

/* Canal email / LinkedIn */
.channel-tabs { display: inline-grid; grid-template-columns: 1fr 1fr; gap: 4px; padding: 4px; border: 1px solid var(--line); border-radius: 12px; background: var(--bg2); margin: 4px 0 6px; }
.ch-tab { background: none; border: 0; color: var(--muted); font: inherit; font-weight: 600; font-size: 13px; padding: 7px 16px; border-radius: 9px; cursor: pointer; }
.ch-tab.active { background: var(--violet-soft); color: var(--text); }
.li-box { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; background: var(--bg2); margin-top: 10px; }
.li-box div { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.li-box small, .li-box span { color: var(--muted); font-size: 12px; }
.li-steps { margin: 10px 0 0; padding-left: 20px; color: var(--muted); font-size: 12.5px; display: flex; flex-direction: column; gap: 3px; }
.detail-actions { flex-wrap: wrap; }
@media (max-width: 820px) { .smtp-form .row2 { grid-template-columns: minmax(0, 1fr); } }
.source-note { margin: 12px 2px 0; font-size: 11.5px; color: var(--muted); }
.mode-chips { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 6px 0 14px; }
.mode-chips .chip { display: flex; flex-direction: column; align-items: flex-start; gap: 3px; text-align: left; padding: 12px 14px; border-radius: 12px; white-space: normal; }
.mode-chips .chip small { color: var(--muted); font-weight: 400; font-size: 12px; }
.mode-block { display: flex; flex-direction: column; gap: 10px; }
.mode-block.hidden { display: none; }
@media (max-width: 820px) { .mode-chips { grid-template-columns: 1fr; } }
.li-state { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.li-none { font-size: 12.5px; color: var(--amber); }
.client-form { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.client-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.client-row { border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; background: var(--bg2); display: flex; flex-direction: column; gap: 8px; }
.client-row small { display: block; color: var(--muted); font-size: 12px; margin-top: 2px; }
.client-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.client-out { font-size: 12.5px; color: var(--muted); }
.link-box { display: flex; gap: 8px; margin-bottom: 4px; }
.link-box .input { flex: 1; min-width: 0; font-size: 12px; }
@media (max-width: 820px) { .client-form { grid-template-columns: minmax(0, 1fr); } }
.rq-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px 16px; font-size: 13px; }
.rq-grid small { display: block; color: var(--muted); font-size: 11.5px; margin: 0; }
@media (max-width: 820px) { .rq-grid { grid-template-columns: minmax(0, 1fr); } }
.pricing-grid { display: flex; flex-direction: column; gap: 6px; margin: 8px 0 12px; }
.pg-head, .pg-row { display: grid; grid-template-columns: 90px 1fr 1fr 2fr; gap: 8px; align-items: center; }
.pg-head span { font-size: 11.5px; color: var(--muted); }
.pg-row .input { width: 100%; }
@media (max-width: 820px) { .pg-head { display: none; } .pg-row { grid-template-columns: 1fr 1fr; } }

/* Espace administrateur sécurisé */
.mfa-card { text-align: center; }
.mfa-ico { display: inline-grid; place-items: center; width: 64px; height: 64px; border-radius: 50%; font-size: 26px; margin-bottom: 12px; background: radial-gradient(circle at 50% 40%, rgba(255, 255, 255, .16), rgba(255, 255, 255, .06)); border: 1px solid rgba(255, 255, 255, .16); }
.mfa-steps { text-align: left; margin: 0 0 16px; padding-left: 20px; color: #d3d3d8; font-size: 14px; line-height: 1.7; }
.mfa-qr { display: inline-block; padding: 12px; background: #fff; border-radius: 14px; margin-bottom: 12px; }
.mfa-qr img { display: block; width: 180px; height: 180px; }
.mfa-secret { display: flex; gap: 8px; align-items: center; justify-content: center; margin: 6px 0 18px; }
.mfa-secret code { font-size: 13px; letter-spacing: .08em; padding: 7px 10px; border-radius: 8px; background: var(--bg2); border: 1px solid var(--line); word-break: break-all; }
.mfa-code { text-align: center; font-size: 22px !important; letter-spacing: .3em; font-weight: 700; }
.sec-list { list-style: none; margin: 0 0 14px; padding: 0; }
.sec-list li { display: flex; justify-content: space-between; gap: 12px; padding: 9px 0; border-bottom: 1px solid var(--line); font-size: 13px; }
.sec-list li span { color: var(--muted); }
.sec-ok { color: var(--green); font-size: 12px; font-weight: 600; }
body.admin-page #screen-connect .auth-card h1::before { content: "\1F512  "; }

/* Pilotage */
.pilot-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.pilot-kpis { grid-template-columns: repeat(4, 1fr); }
.pilot-kpis .kpi b { font-size: 28px; }
.kpi .delta { display: inline-block; margin-left: 4px; font-weight: 600; color: var(--text); }
.pilot-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 12px; }
.pilot-todo { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.pilot-todo li { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border-radius: 10px; background: var(--bg2); border: 1px solid var(--line); font-size: 13px; cursor: pointer; }
.pilot-todo li:hover { border-color: #444548; }
.pilot-todo li.empty { cursor: default; color: var(--muted); }
.lvl { flex: 0 0 auto; display: inline-flex; align-items: center; gap: 5px; font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 99px; white-space: nowrap; }
.lvl-bad { background: rgba(248,113,113,.14); color: #fca5a5; }
.lvl-warn { background: rgba(251,191,36,.14); color: #fcd34d; }
.lvl-info, .lvl-idle { background: rgba(255, 255, 255, .07); color: #d3d3d8; }
.lvl-ok { background: rgba(52,211,153,.14); color: #6ee7b7; }
.pilot-funnel { display: grid; gap: 10px; }
.funnel-row { display: grid; grid-template-columns: 120px 1fr 36px; gap: 10px; align-items: center; font-size: 13px; }
.funnel-row span { color: var(--muted); }
.funnel-track { height: 10px; border-radius: 99px; background: rgba(255, 255, 255, .06); overflow: hidden; }
.funnel-fill { height: 100%; border-radius: 99px; background: #7aa2ff; min-width: 2px; }
.funnel-row b { text-align: right; }
.pilot-chart { position: relative; }
.pilot-chart svg { display: block; width: 100%; height: 170px; overflow: visible; }
.pilot-chart .tip { position: absolute; pointer-events: none; transform: translate(-50%, -100%); background: #121213; border: 1px solid var(--line); border-radius: 8px; padding: 6px 9px; font-size: 12px; white-space: nowrap; box-shadow: 0 8px 24px rgba(0,0,0,.4); }
.pilot-chart .tip b { display: block; font-size: 14px; }
.pilot-chart details { margin-top: 6px; font-size: 12px; color: var(--muted); }
.pilot-chart details table { width: 100%; border-collapse: collapse; margin-top: 6px; }
.pilot-chart details td { padding: 3px 0; border-bottom: 1px solid var(--line); }
.pilot-table-wrap { overflow-x: auto; }
.pilot-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.pilot-table th { text-align: left; color: var(--muted); font-weight: 500; font-size: 12px; padding: 8px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.pilot-table td { padding: 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.pilot-table td.num { text-align: right; font-variant-numeric: tabular-nums; }
.pilot-table th.num { text-align: right; }
.pilot-table small { display: block; color: var(--muted); }
.pilot-table .off { color: var(--muted); }
@media (max-width: 900px) { .pilot-kpis { grid-template-columns: repeat(2, 1fr); } .pilot-grid { grid-template-columns: 1fr; } }

/* LinkedIn */
.li-steps { margin: 0 0 12px; padding-left: 20px; line-height: 1.8; color: #d3d3d8; }
.li-steps code { background: var(--bg2); border: 1px solid var(--line); border-radius: 6px; padding: 1px 6px; }
.li-bar { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; margin-bottom: 12px; }
.li-auto { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.li-auto small { display: block; color: var(--muted); font-size: 12px; }
.li-limit { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--muted); }
.li-limit .input { width: 70px; }
.li-bar-actions { display: flex; gap: 8px; }
.switch { position: relative; width: 42px; height: 24px; flex: 0 0 auto; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch span { position: absolute; inset: 0; border-radius: 99px; background: var(--line); transition: .2s; cursor: pointer; }
.switch span::after { content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; transition: .2s; }
.switch input:checked + span { background: var(--violet); }
.switch input:checked + span::after { transform: translateX(18px); }
.switch input:focus-visible + span { outline: 2px solid var(--violet2); outline-offset: 2px; }
.li-inbox { display: grid; grid-template-columns: 320px 1fr; height: 620px; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; margin-bottom: 12px; }
.li-list { border-right: 1px solid var(--line); overflow-y: auto; }
.li-list ul { list-style: none; margin: 0; padding: 0; }
.li-chat { display: flex; gap: 10px; align-items: center; padding: 12px 14px; border-bottom: 1px solid var(--line); cursor: pointer; }
.li-chat:hover { background: var(--bg2); }
.li-chat.on { background: var(--violet-soft); }
.li-av { width: 38px; height: 38px; border-radius: 50%; flex: 0 0 auto; background: var(--card2) center/cover; display: grid; place-items: center; font-weight: 700; color: var(--violet2); }
.li-chat > div:nth-child(2) { flex: 1; min-width: 0; }
.li-chat b { display: block; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.li-chat small { display: block; color: var(--muted); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.li-chat .badge { position: static; }
.li-chat.unread b { color: #fff; }
.li-thread { display: flex; flex-direction: column; min-width: 0; }
.li-empty { margin: auto; color: var(--muted); }
.li-head { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-bottom: 1px solid var(--line); }
.li-head div { min-width: 0; flex: 1; }
.li-head b, .li-head small { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.li-head small { color: var(--muted); font-size: 12px; }
.li-back { display: none; }
.li-msgs { flex: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 8px; }
.li-msg { max-width: 78%; padding: 9px 12px; border-radius: 14px; font-size: 14px; line-height: 1.45; white-space: pre-wrap; word-wrap: break-word; background: var(--bg2); border: 1px solid var(--line); align-self: flex-start; }
.li-msg.mine { align-self: flex-end; background: rgba(255, 255, 255, .09); border-color: rgba(255, 255, 255, .16); }
.li-msg small { display: block; margin-top: 4px; font-size: 11px; color: var(--muted); }
.li-compose { border-top: 1px solid var(--line); padding: 12px; display: grid; gap: 8px; }
.li-compose textarea { width: 100%; resize: vertical; min-height: 70px; }
.li-compose .row-actions { justify-content: space-between; margin: 0; }
.li-log { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.li-log li { font-size: 13px; padding: 9px 12px; border-radius: 10px; background: var(--bg2); border: 1px solid var(--line); }
.li-log li small { display: block; color: var(--muted); margin-top: 2px; }
@media (max-width: 800px) {
  .li-inbox { grid-template-columns: 1fr; height: 560px; }
  .li-inbox.reading .li-list { display: none; }
  .li-inbox:not(.reading) .li-thread { display: none; }
  .li-back { display: inline-flex; }
  .li-limit .input { width: 60px; }
}

.li-error { margin-bottom: 12px; border-color: rgba(248,113,113,.4); background: rgba(248,113,113,.08); color: #fecaca; }
.li-diag { list-style: none; margin: 0 0 12px; padding: 0; display: grid; gap: 8px; }
.li-diag li { display: flex; gap: 10px; align-items: flex-start; font-size: 13px; padding: 9px 12px; border-radius: 10px; background: var(--bg2); border: 1px solid var(--line); }
.li-diag li small { display: block; color: var(--muted); margin-top: 2px; word-break: break-word; }
.li-adopt { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 10px; border: 1px solid rgba(122, 162, 255, .32); background: var(--violet-soft); margin-bottom: 8px; font-size: 13px; }
#view-linkedin > .panel { margin-bottom: 12px; }

/* Prospection 100 % LinkedIn */
.li-only-badge { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; padding: 4px 10px; border-radius: 99px; background: rgba(10,102,194,.16); color: #93c5fd; border: 1px solid rgba(10,102,194,.4); margin-bottom: 10px; }
.li-flow { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 12px 0; }
.li-flow div { background: var(--bg2); border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; font-size: 12px; color: var(--muted); }
.li-flow b { display: block; color: var(--text); font-size: 13px; margin-bottom: 2px; }
#chSetupNote { padding: 14px; border-radius: 12px; border: 1px solid rgba(10,102,194,.4); background: rgba(10,102,194,.08); line-height: 1.6; }
@media (max-width: 700px) { .li-flow { grid-template-columns: 1fr; } }

.target-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.target-row #settingsTarget { color: var(--muted); }
.li-warn { margin-bottom: 12px; border-color: rgba(251,191,36,.4); background: rgba(251,191,36,.08); color: #fde68a; }
.setup-cta { text-align: center; }

/* Messagerie LinkedIn plein écran : chaque zone défile seule, la saisie reste visible */
.li-inbox { grid-template-columns: 320px minmax(0, 1fr); grid-template-rows: minmax(0, 1fr); height: 640px; min-height: 420px; margin-bottom: 0; }
.li-list { display: flex; flex-direction: column; min-height: 0; overflow: hidden; }
.li-list-head { flex-shrink: 0; padding: 10px; border-bottom: 1px solid var(--line); }
.li-list-head .input { width: 100%; padding: 8px 12px; font-size: 13px; }
.li-search-status { display: block; padding: 6px 2px 0; font-size: 11px; color: var(--muted); }
.li-list ul { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; }
.li-list #liMore { flex-shrink: 0; margin: 8px; }
.li-thread { min-height: 0; overflow: hidden; position: relative; }
.li-head { flex-shrink: 0; min-height: 64px; }
.li-msgs { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 16px 18px; }
.li-list ul, .li-msgs { scrollbar-width: thin; scrollbar-color: #444548 transparent; }
.li-list ul::-webkit-scrollbar, .li-msgs::-webkit-scrollbar { width: 6px; }
.li-list ul::-webkit-scrollbar-thumb, .li-msgs::-webkit-scrollbar-thumb { background: #444548; border-radius: 6px; }
.li-day { align-self: center; font-size: 11px; color: var(--muted); padding: 3px 10px; border-radius: 99px; background: var(--bg2); border: 1px solid var(--line); margin: 6px 0; }
.li-msg small .tick { margin-left: 6px; color: var(--violet2); }
.li-msg.sending { opacity: .6; }
.li-new { position: absolute; left: 50%; transform: translateX(-50%); bottom: 150px; z-index: 2; padding: 6px 14px; border-radius: 99px; border: 1px solid rgba(122, 162, 255, .35); background: #212223; color: var(--text); font: inherit; font-size: 12px; font-weight: 600; cursor: pointer; box-shadow: 0 8px 24px rgba(0,0,0,.4); }
.li-compose { flex-shrink: 0; background: var(--card); padding: 12px 14px; gap: 8px; }
.li-compose textarea { resize: none; min-height: 46px; max-height: 200px; overflow-y: auto; line-height: 1.45; }
.li-compose .row-actions { align-items: center; }
.li-compose .li-hint { font-size: 11px; color: var(--muted); }
.li-compose .li-ai-note { font-size: 12px; color: var(--violet2); }
.li-status { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; padding: 4px 10px; border-radius: 99px; border: 1px solid var(--line); color: var(--muted); }
.li-status i { width: 7px; height: 7px; border-radius: 50%; background: #717173; }
.li-status.on { color: #6ee7b7; border-color: rgba(52,211,153,.35); }
.li-status.on i { background: #34d399; box-shadow: 0 0 0 3px rgba(52,211,153,.15); }
.li-status.off { color: #fcd34d; border-color: rgba(251,191,36,.35); }
.li-status.off i { background: #fbbf24; }
.li-bar-actions { flex-wrap: wrap; align-items: center; }
.li-log-panel { margin-bottom: 12px; max-height: 260px; overflow-y: auto; }
.skel { background: linear-gradient(90deg, rgba(255,255,255,.04), rgba(255,255,255,.09), rgba(255,255,255,.04)); background-size: 200% 100%; animation: skel 1.2s ease-in-out infinite; border-radius: 8px; }
@keyframes skel { from { background-position: 200% 0; } to { background-position: -200% 0; } }
.li-chat.skel-row .li-av { background: none; }
.skel-line { height: 10px; margin: 5px 0; }
.skel-bubble { height: 38px; border-radius: 14px; }
@media (prefers-reduced-motion: reduce) { .skel { animation: none; } }
@media (max-width: 800px) {
  .li-inbox { grid-template-columns: minmax(0, 1fr); }
  .li-new { bottom: 140px; }
}
/* Mobile : la conversation ouverte occupe tout l'écran, façon messagerie */
@media (max-width: 800px) {
  .li-inbox.reading { position: fixed; inset: 0; z-index: 60; height: 100vh !important; height: 100dvh !important; border-radius: 0; border: 0; margin: 0; }
  body.li-reading { overflow: hidden; }
  .li-inbox.reading .li-compose { padding-bottom: max(12px, env(safe-area-inset-bottom)); }
  .li-compose .li-hint { display: none; }
}
.li-compose .row-actions { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: nowrap; }
.li-compose .row-actions > div { display: flex; align-items: center; gap: 10px; min-width: 0; }
.li-compose .row-actions > div:first-child { flex: 1; }
.li-compose .li-ai-note, .li-compose .li-hint { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.li-compose .row-actions .btn { flex-shrink: 0; }
@media (max-width: 1200px) { .li-compose .li-hint { display: none; } }

/* Assistant d'écriture et statut de lecture */
.li-compose .row-actions > div:first-child { gap: 8px; }
.li-undo { font-size: 12px; flex-shrink: 0; }
.li-msg .tick.seen { display: inline-flex; align-items: center; gap: 4px; color: #93c5fd; }
.li-seen-av { width: 14px; height: 14px; border-radius: 50%; object-fit: cover; }
.li-msg.failed { border-color: rgba(248,113,113,.55); background: rgba(248,113,113,.08); }
.li-msg.failed .tick { color: #fca5a5; }
.li-msg.failed .link-btn { font-size: 11px; }
.li-compose .li-send-wrap { flex: 0 0 auto; }
.li-compose .row-actions > div:first-child { overflow: hidden; }
.li-compose { grid-template-columns: minmax(0, 1fr); }
.li-compose .row-actions > div:first-child { flex: 1 1 auto; min-width: 0; }
.li-compose .li-ai-note { flex: 1 1 auto; min-width: 0; }
@media (max-width: 800px) {
  .li-compose .row-actions { flex-wrap: wrap; }
  .li-compose .row-actions > div:first-child { flex-basis: 100%; }
  .li-compose .li-send-wrap { margin-left: auto; }
}

/* Autopilote */
.ap-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.ap-switch { display: flex; align-items: center; gap: 12px; }
.ap-switch small { display: block; color: var(--muted); font-size: 12px; }
.ap-kpis { grid-template-columns: repeat(6, 1fr); }
.ap-kpis .kpi b { font-size: 26px; }
.ap-kpis .kpi.accent b { font-size: 30px; }
.ap-slots, .ap-leads, .ap-log { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.ap-slots li, .ap-leads li, .ap-log li { display: flex; gap: 10px; align-items: flex-start; justify-content: space-between; padding: 9px 12px; border-radius: 10px; background: var(--bg2); border: 1px solid var(--line); font-size: 13px; }
.ap-log li { display: block; }
.ap-log li small, .ap-leads li small { display: block; color: var(--muted); margin-top: 2px; word-break: break-word; }
.ap-log { max-height: 460px; overflow-y: auto; }
.ap-leads { max-height: 460px; overflow-y: auto; }
.ap-preview { margin-top: 10px; padding: 12px; border-radius: 10px; border: 1px solid rgba(255, 255, 255, .16); background: var(--violet-soft); white-space: pre-wrap; font-size: 13px; line-height: 1.55; }
.ap-form { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.ap-truth { display: flex; flex-direction: column; gap: 6px; margin-top: 10px; font-size: 13px; color: #d3d3d8; }
.ap-truth small { color: var(--muted); }
@media (max-width: 1100px) { .ap-kpis { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 700px) { .ap-kpis { grid-template-columns: repeat(2, 1fr); } .ap-form { grid-template-columns: 1fr; } }

/* Multicanal, validation et espace client */
.ch-switch { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 12px; }
.ch-switch button { display: inline-flex; align-items: center; gap: 8px; padding: 8px 14px; border-radius: 99px; border: 1px solid var(--line); background: var(--card); color: var(--muted); font: inherit; font-weight: 600; cursor: pointer; }
.ch-switch button.on { color: var(--text); border-color: rgba(122, 162, 255, .39); background: var(--violet-soft); }
.ch-switch button i { width: 7px; height: 7px; border-radius: 50%; background: #717173; }
.ch-switch button.connected i { background: #34d399; }
body.client-mode .admin-tool { display: none !important; }
.ap-target { margin-bottom: 12px; display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }
.ap-target .ap-feats { display: flex; gap: 12px; flex-wrap: wrap; font-size: 13px; }
.ap-target label { display: inline-flex; gap: 6px; align-items: center; }
.ap-drafts { border-color: rgba(251,191,36,.45); }
.ap-draft-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.ap-draft-list li { padding: 12px; border-radius: 12px; background: var(--bg2); border: 1px solid var(--line); display: grid; gap: 8px; }
.ap-draft-list .ap-draft-head { display: flex; justify-content: space-between; gap: 10px; align-items: center; font-size: 13px; flex-wrap: wrap; }
.ap-draft-list textarea { width: 100%; min-height: 80px; resize: vertical; }
.ap-draft-list .row-actions { justify-content: flex-end; margin: 0; }
.ch-badge { font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 99px; background: rgba(255, 255, 255, .08); color: #d9d9dd; }
.ch-badge.whatsapp { background: rgba(52,211,153,.14); color: #6ee7b7; }
.ch-badge.instagram { background: rgba(236,72,153,.14); color: #f9a8d4; }
.ap-channels { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin-bottom: 8px; }
.ap-channels > div { padding: 12px; border-radius: 12px; background: var(--bg2); border: 1px solid var(--line); display: grid; gap: 8px; }
.ap-channels b { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.ap-channels select { width: 100%; }
@media (max-width: 800px) { .ap-channels { grid-template-columns: 1fr; } }

.ap-run { margin: 0 0 8px; padding: 8px 12px; border-radius: 10px; background: var(--bg2); border: 1px solid var(--line); font-size: 13px; }
.ap-run.ok { border-color: rgba(52,211,153,.4); color: #6ee7b7; }
.ap-run.bad { border-color: rgba(248,113,113,.4); color: #fca5a5; }
#apDiagPanel { margin-bottom: 12px; }

/* Fluidité : listes longues rendues à la demande, zone de saisie qui grandit sans script */
.ap-log li, .ap-leads li, .li-log li { content-visibility: auto; contain-intrinsic-size: auto 58px; }
.li-chat { content-visibility: auto; contain-intrinsic-size: auto 64px; }
.li-msgs .li-msg { content-visibility: auto; contain-intrinsic-size: auto 60px; }
.li-compose textarea { field-sizing: content; }
.skel { will-change: background-position; }

/* Commandes de l'agent (administrateur) : menu, toast en haut d'écran, journal escamotable */
.agc { position: relative; }
.agc-main { gap: 7px; border-color: rgba(122, 162, 255, .32); background: var(--violet-soft); }
.agc-main:hover { border-color: var(--violet); }
.agc-main.running { color: var(--violet2); }
.agc-ico { display: inline-flex; width: 15px; height: 15px; align-items: center; justify-content: center; color: var(--violet2); }
.agc-spin { width: 13px; height: 13px; border-radius: 50%; border: 2px solid var(--violet2); border-right-color: transparent; animation: spin .8s linear infinite; }
.agc-menu { position: absolute; right: 0; top: calc(100% + 8px); z-index: 60; width: 320px; padding: 6px; border: 1px solid var(--line); border-radius: 14px; background: var(--card); box-shadow: 0 18px 50px rgba(0, 0, 0, .45); display: flex; flex-direction: column; gap: 2px; }
.agc-head { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; padding: 8px 10px 6px; font-size: 12px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.agc-head small { font-weight: 500; text-transform: none; letter-spacing: 0; color: var(--violet2); text-align: right; }
.agc-item { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; width: 100%; text-align: left; padding: 10px 12px; border: 0; border-radius: 10px; background: none; color: var(--text); font: inherit; cursor: pointer; min-height: 48px; }
.agc-item:hover:not(:disabled), .agc-item:focus-visible { background: var(--card2); outline: none; }
.agc-item b { font-size: 13.5px; font-weight: 600; }
.agc-item small { font-size: 12px; color: var(--muted); }
.agc-item:disabled { opacity: .45; cursor: not-allowed; }
.agc-journal { border-top: 1px solid var(--line); border-radius: 0 0 10px 10px; margin-top: 4px; }
.agc-backdrop { display: none; }

.agt { position: fixed; top: 16px; left: 50%; transform: translateX(-50%); z-index: 90; width: min(460px, calc(100% - 32px)); padding: 12px 16px; border-radius: 12px; border: 1px solid var(--line); background: var(--card); box-shadow: 0 16px 40px rgba(0, 0, 0, .45); display: flex; flex-direction: column; gap: 2px; cursor: pointer; animation: agt-in .22s ease-out; }
.agt b { font-size: 13.5px; }
.agt span { font-size: 13px; color: var(--text); }
.agt small { font-size: 11.5px; color: var(--muted); margin-top: 2px; }
.agt-ok { border-left: 3px solid var(--green); }
.agt-info { border-left: 3px solid var(--violet); }
.agt-error { border-left: 3px solid var(--red); }
@keyframes agt-in { from { opacity: 0; transform: translate(-50%, -8px); } }

.agd { position: fixed; inset: 0; z-index: 85; }
.agd-backdrop { position: absolute; inset: 0; background: rgba(0, 0, 0, .55); }
.agd-panel { position: absolute; top: 0; right: 0; bottom: 0; width: min(440px, 100%); background: var(--bg2); border-left: 1px solid var(--line); display: flex; flex-direction: column; animation: agd-in .22s ease-out; }
.agd-panel header { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 16px 18px; border-bottom: 1px solid var(--line); }
.agd-panel header small { display: block; color: var(--muted); font-size: 12px; }
.agd-close { border: 0; background: none; color: var(--muted); cursor: pointer; padding: 8px; border-radius: 8px; display: inline-flex; }
.agd-close:hover { background: var(--card2); color: var(--text); }
.agd-body { overflow-y: auto; padding: 12px 14px 24px; display: flex; flex-direction: column; gap: 10px; overscroll-behavior: contain; }
.agd-run { border: 1px solid var(--line); border-radius: 12px; background: var(--card); }
.agd-run summary { list-style: none; cursor: pointer; padding: 12px 14px; display: grid; grid-template-columns: auto minmax(0, 1fr) auto; column-gap: 8px; row-gap: 3px; align-items: center; }
.agd-run summary::-webkit-details-marker { display: none; }
.agd-run summary small { color: var(--muted); font-size: 12px; }
.agd-sum { grid-column: 2 / 4; font-size: 12.5px; color: var(--muted); }
.agd-events, .agd-notes { list-style: none; margin: 0; padding: 0 14px 12px; display: flex; flex-direction: column; gap: 8px; }
.agd-ev { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 8px; align-items: start; padding-top: 8px; border-top: 1px solid var(--line); }
.agd-ev b { font-size: 13px; }
.agd-ev small { color: var(--muted); font-size: 11.5px; }
.agd-ev p { margin: 2px 0 0; font-size: 12.5px; color: var(--muted); overflow-wrap: anywhere; }
.agd-ev.err p { color: var(--red); }
.agd-notes li { font-size: 12px; color: var(--amber); }
.agd-dot { width: 8px; height: 8px; border-radius: 50%; margin-top: 6px; background: var(--muted); }
.agd-run summary .agd-dot { margin-top: 0; }
.agd-dot.ok { background: var(--green); }
.agd-dot.err { background: var(--red); }
.agd-dot.skip { background: var(--muted); }
.agd-dot.run { background: var(--violet2); animation: agd-pulse 1.2s ease-in-out infinite; }
@keyframes agd-in { from { transform: translateX(24px); opacity: 0; } }
@keyframes agd-pulse { 50% { opacity: .35; } }
body.agd-open { overflow: hidden; }

@media (max-width: 820px) {
  .agc-backdrop { display: block; position: fixed; inset: 0; z-index: 59; background: rgba(0, 0, 0, .55); }
  .agc-backdrop.hidden { display: none; }
  .agc-menu { position: fixed; left: 12px; right: 12px; top: auto; bottom: calc(12px + env(safe-area-inset-bottom)); width: auto; padding: 8px; border-radius: 16px; }
  .agc-item { min-height: 54px; }
  .agd-panel { top: auto; left: 0; width: 100%; max-height: 82vh; border-left: 0; border-top: 1px solid var(--line); border-radius: 18px 18px 0 0; padding-bottom: env(safe-area-inset-bottom); animation-name: agd-up; }
  @keyframes agd-up { from { transform: translateY(24px); opacity: 0; } }
}
@media (prefers-reduced-motion: reduce) { .agt, .agd-panel { animation: none; } .agc-spin, .agd-dot.run { animation-duration: 2.4s; } }
/* Conversations en attente à confier à l'agent */
.agd-pending { border: 1px solid var(--line); border-radius: 12px; background: var(--card); padding: 12px 14px; display: flex; flex-direction: column; gap: 10px; }
.agd-p-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.agd-p-head small { display: block; color: var(--muted); font-size: 12px; }
.agd-warn { margin: 0; color: var(--amber); }
.agd-err { margin: 0; color: var(--red); }
.agd-plist { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; max-height: 46vh; overflow-y: auto; }
.agd-plist label { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 10px; align-items: start; padding: 8px; border-radius: 10px; cursor: pointer; }
.agd-plist label:hover { background: var(--card2); }
.agd-plist input { margin-top: 3px; width: 17px; height: 17px; accent-color: var(--violet); }
.agd-plist small { color: var(--muted); font-size: 11.5px; }
.agd-plist em { display: block; font-style: normal; font-size: 12.5px; color: var(--muted); overflow-wrap: anywhere; }
.agd-p-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.li-track.on { border-color: rgba(52, 211, 153, .5); color: var(--green); }
/* Menu Agent : vues intégrées (conversations en attente, journal), sans panneau latéral */
.agc-menu { max-height: min(78vh, 680px); overflow: hidden; }
.agc-menu.wide { width: 420px; }
.agc-view { display: flex; flex-direction: column; gap: 2px; min-height: 0; }
.agc-view.hidden { display: none; }
#agcSubView { flex: 1; }
.agc-subhead { display: flex; align-items: center; gap: 10px; padding: 4px 4px 8px; border-bottom: 1px solid var(--line); margin-bottom: 8px; }
.agc-subhead b { font-size: 14px; }
.agc-back { display: inline-flex; align-items: center; gap: 4px; border: 0; background: none; color: var(--muted); font: inherit; font-size: 12.5px; font-weight: 600; padding: 6px 8px; border-radius: 8px; cursor: pointer; }
.agc-back svg { transform: rotate(90deg); }
.agc-back:hover { background: var(--card2); color: var(--text); }
.agc-body { overflow-y: auto; overscroll-behavior: contain; display: flex; flex-direction: column; gap: 8px; padding: 0 2px 4px; min-height: 0; max-height: calc(min(78vh, 680px) - 70px); }
.agc-body .agd-pending { border: 0; padding: 0; background: none; }
.agc-body .agd-plist { max-height: none; overflow: visible; }
.agc-body .agd-p-actions { position: sticky; bottom: 0; background: var(--card); padding-top: 8px; }
@media (max-width: 820px) {
  .agc-menu.wide { width: auto; }
  .agc-menu { max-height: 82vh; }
  .agc-body { max-height: calc(82vh - 70px); }
}

/* Prospects : tableau et agenda */
.crm-bar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 12px; }
.crm-tabs { display: inline-grid; grid-template-columns: 1fr 1fr; gap: 4px; padding: 4px; border: 1px solid var(--line); border-radius: 12px; background: var(--bg2); }
.crm-tab { background: none; border: 0; color: var(--muted); font: inherit; font-weight: 600; font-size: 13px; padding: 7px 16px; border-radius: 9px; cursor: pointer; }
.crm-tab.on { background: var(--violet-soft); color: var(--text); }
.crm-search { flex: 1 1 260px; min-width: 0; }
.crm-tools { display: flex; gap: 6px; flex-wrap: wrap; }
.crm-tools label { cursor: pointer; }
.crm-filters { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 12px; }
.crm-chip { border: 1px solid var(--line); background: var(--card); color: var(--muted); font: inherit; font-size: 12.5px; font-weight: 600; padding: 6px 11px; border-radius: 999px; cursor: pointer; }
.crm-chip span { color: var(--text); margin-left: 3px; }
.crm-chip.on { border-color: var(--violet); color: var(--text); background: var(--violet-soft); }
.crm-table { border: 1px solid var(--line); border-radius: 14px; background: var(--card); overflow: hidden; }
.crm-row { display: grid; grid-template-columns: 1.3fr 1.4fr 1.4fr .9fr 1.4fr .6fr; gap: 12px; align-items: center; padding: 11px 14px; border-top: 1px solid var(--line); cursor: pointer; content-visibility: auto; contain-intrinsic-size: auto 58px; }
.crm-row:hover, .crm-row.open { background: var(--card2); }
.crm-head { border-top: 0; cursor: default; font-size: 11.5px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; background: var(--bg2); }
.crm-head:hover { background: var(--bg2); }
.crm-row > span { min-width: 0; overflow-wrap: anywhere; font-size: 13px; }
.crm-row b { display: flex; align-items: center; gap: 6px; font-weight: 600; }
.crm-row small { display: block; color: var(--muted); font-size: 12px; }
.crm-c3 { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; }
.crm-c3 a:not(.btn) { color: var(--text); text-decoration: none; font-size: 12.5px; }
.crm-in { display: inline-grid; place-items: center; width: 18px; height: 18px; border-radius: 4px; background: #0a66c2; color: #fff !important; font-size: 11px; font-weight: 800; text-decoration: none; flex: none; }
.crm-ok { margin-left: 6px; font-size: 10.5px; font-weight: 700; color: var(--green); border: 1px solid rgba(52, 211, 153, .45); border-radius: 999px; padding: 0 6px; }
.crm-call { padding: 3px 9px; font-size: 12px; }
.crm-pill { font-style: normal; font-size: 11.5px; font-weight: 700; padding: 3px 9px; border-radius: 999px; white-space: nowrap; border: 1px solid var(--line); color: var(--muted); }
.crm-pill.st-contacte, .crm-chip.st-contacte.on { color: var(--violet2); border-color: rgba(122, 162, 255, .35); }
.crm-pill.st-vu, .crm-chip.st-vu.on { color: var(--amber); border-color: rgba(251, 191, 36, .5); }
.crm-pill.st-discussion, .crm-chip.st-discussion.on { color: #60a5fa; border-color: rgba(96, 165, 250, .5); }
.crm-pill.st-rdv, .crm-chip.st-rdv.on { color: var(--green); border-color: rgba(52, 211, 153, .5); }
.crm-pill.st-non, .crm-chip.st-non.on { color: var(--red); border-color: rgba(248, 113, 113, .5); }
.crm-c6 a { color: var(--violet2); font-weight: 600; font-size: 12.5px; }
.crm-edit { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; padding: 12px 14px 16px; background: var(--card2); border-top: 1px dashed var(--line); }
.crm-edit label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--muted); }
.crm-edit .wide { grid-column: span 2; }
.crm-edit-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; grid-column: 1 / -1 !important; }
.crm-pager { display: flex; justify-content: center; align-items: center; gap: 12px; padding: 12px; color: var(--muted); font-size: 12.5px; }
.cal-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 12px; flex-wrap: wrap; }
.cal-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 8px; }
.cal-day { border: 1px solid var(--line); border-radius: 12px; background: var(--card); padding: 10px; min-height: 140px; }
.cal-day.today { border-color: var(--violet); }
.cal-day h4 { margin: 0 0 8px; font-size: 13px; text-transform: capitalize; }
.cal-day h4 small { color: var(--muted); font-weight: 500; }
.cal-day ul, .cal-undated ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.cal-item { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; padding: 8px; border-radius: 10px; background: var(--bg2); border: 1px solid var(--line); }
.cal-item > span { flex: 1 1 100px; min-width: 0; font-size: 12.5px; font-weight: 600; }
.cal-item small { display: block; font-weight: 400; color: var(--muted); }
.cal-item > b { color: var(--green); font-size: 12.5px; }
.cal-undated { margin-top: 12px; }
.cal-undated h4 { margin: 0 0 10px; }
@media (max-width: 1100px) { .cal-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } .cal-day.empty { min-height: 0; } }
@media (max-width: 820px) {
  .crm-head { display: none; }
  .crm-row { grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "c1 c4" "c2 c2" "c3 c3" "c5 c6"; row-gap: 6px; }
  .crm-c1 { grid-area: c1; } .crm-c2 { grid-area: c2; } .crm-c3 { grid-area: c3; } .crm-c4 { grid-area: c4; } .crm-c5 { grid-area: c5; color: var(--muted); } .crm-c6 { grid-area: c6; }
  .crm-edit { grid-template-columns: minmax(0, 1fr); } .crm-edit .wide { grid-column: auto; }
  .cal-grid { grid-template-columns: minmax(0, 1fr); }
  .crm-search { flex-basis: 100%; }
}

/* ===== Direction artistique : sombre, violet, glassmorphism ===== */
:root {
  --bg: #0d0d0e;
  --bg2: #19191a;
  --card: rgba(0, 0, 0, .6);
  --card2: rgba(0, 0, 0, .6);
  --line: rgba(255, 255, 255, .1);
  --text: #fbfbff;
  --muted: #b0b0b4;
  --violet: #7aa2ff;
  --violet2: #a9c4ff;
  --violet-soft: rgba(255, 255, 255, .08);
  --radius: 16px;
}

body {
  background:
    radial-gradient(900px 520px at 72% -8%, rgba(255, 255, 255, .14), transparent 62%),
    radial-gradient(700px 420px at 12% 96%, rgba(255, 255, 255, .09), transparent 65%),
    var(--bg);
}

.app { grid-template-columns: 248px minmax(0, 1fr); }
/* Téléphone : barre de navigation en haut, contenu sur toute la largeur */
@media (max-width: 820px) { .app { grid-template-columns: minmax(0, 1fr); } .sidebar { padding: 10px 12px; } }
.sidebar {
  background: linear-gradient(180deg, rgba(0, 0, 0, .6), rgba(0, 0, 0, .6));
  border-right-color: rgba(255, 255, 255, .07);
  padding: 24px 16px;
}
.brand img { margin-bottom: 28px; }
.nav-item { padding: 11px 13px; border: 1px solid transparent; }
.nav-item:hover { background: rgba(255, 255, 255, .05); border-color: rgba(255, 255, 255, .08); }
.nav-item.active {
  background: linear-gradient(100deg, rgba(122, 162, 255, .57), rgba(122, 162, 255, .41));
  border-color: rgba(255, 255, 255, .14);
  box-shadow: 0 10px 28px rgba(255, 255, 255, .14), inset 0 1px rgba(255, 255, 255, .16);
}
.nav-item.active .ico { color: #fff; }
.client { background: rgba(0, 0, 0, .6); border-color: rgba(255, 255, 255, .08); }

.main { max-width: 1500px; width: 100%; padding: 28px 34px 48px; }
.topbar { margin-bottom: 24px; }
.topbar h2 { font-size: clamp(22px, 2.2vw, 29px); letter-spacing: -.03em; }
.topbar-actions .btn, #runBtn { box-shadow: 0 8px 26px rgba(255, 255, 255, .11); }

.kpis { gap: 14px; margin-bottom: 18px; }
.kpi, .panel, .col, .crm-table, .cal-day {
  background: linear-gradient(145deg, rgba(0, 0, 0, .6), rgba(0, 0, 0, .6));
  border-color: rgba(255, 255, 255, .09);
  box-shadow: 0 14px 34px rgba(0, 0, 0, .18), inset 0 1px rgba(255, 255, 255, .035);
}
.kpi { padding: 18px; min-height: 124px; }
.kpi b { font-size: 32px; }
.kpi.accent { background: linear-gradient(145deg, rgba(255, 255, 255, .16), rgba(0, 0, 0, .6) 72%); border-color: rgba(255, 255, 255, .16); }
.panel { padding: 18px; }
.signal { background: rgba(0, 0, 0, .52); border-color: rgba(255, 255, 255, .07); }
.signal.active { background: linear-gradient(100deg, rgba(255, 255, 255, .11), rgba(0, 0, 0, .6)); border-color: rgba(122, 162, 255, .49); }

.li-brief-box { margin: 12px 0; padding: 16px; border: 1px solid rgba(255, 255, 255, .12); border-radius: 14px; background: rgba(0, 0, 0, .6); max-height: 52vh; overflow: auto; }
.li-brief-box h3 { margin: 0; }
.li-brief-meta { color: var(--muted); font-size: 12px; margin-bottom: 12px; }
.li-brief-verdict { padding: 12px; border-radius: 10px; background: rgba(255, 255, 255, .07); border: 1px solid rgba(255, 255, 255, .1); }
.li-brief-error { color: #ff9b9b; padding: 12px; border-radius: 10px; background: rgba(238, 84, 84, .1); border: 1px solid rgba(255, 120, 120, .25); }
.li-brief-demo { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 0 0 14px; padding: 12px; border-radius: 12px; background: linear-gradient(100deg, rgba(52, 211, 153, .12), rgba(255, 255, 255, .06)); border: 1px solid rgba(52, 211, 153, .3); }
.li-brief-demo small { display: block; color: var(--muted); margin-top: 3px; }
.li-brief-warning { display: grid; gap: 3px; margin: 0 0 14px; padding: 11px 12px; border-radius: 12px; color: #7a4b00; background: rgba(251, 191, 36, .11); border: 1px solid rgba(251, 191, 36, .35); font-size: 13px; }
.li-brief-warning span { color: var(--muted); }
.li-brief-section { margin-top: 14px; }
.li-brief-section p { margin: 6px 0 0; }
.li-brief-section ul, .li-brief-section ol { margin: 7px 0 0; padding-left: 21px; }
.li-brief-section li { margin: 5px 0; }
.li-brief-section li span { display: block; color: var(--muted); font-size: 12px; margin-top: 3px; }
.li-head { flex-wrap: wrap; }

@media (max-width: 1100px) {
  .main { padding-left: 24px; padding-right: 24px; }
}
@media (max-width: 820px) {
  .sidebar { padding: 10px 12px; }
  .main { padding: 20px 16px 36px; }
}

/* Accueil : lecture immédiate de l'état de l'agent et de la prochaine action. */
.today-brief {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 20px 26px;
  align-items: center;
  margin: 0 0 18px;
  padding: 22px 24px 18px;
  border: 1px solid rgba(255, 255, 255, .14);
  border-radius: 17px;
  background: linear-gradient(112deg, rgba(255, 255, 255, .16), rgba(0, 0, 0, .6) 65%, rgba(0, 0, 0, .6));
  box-shadow: 0 18px 44px rgba(0, 0, 0, .23), inset 0 1px rgba(255, 255, 255, .06);
  overflow: hidden;
  position: relative;
}
.today-brief::after { content: ""; position: absolute; width: 260px; height: 260px; right: -90px; top: -150px; border-radius: 50%; background: rgba(255, 255, 255, .07); filter: blur(2px); pointer-events: none; }
.today-brief-copy, .today-brief-side, .today-flow { position: relative; z-index: 1; }
.today-kicker { color: #dcdce0; font-size: 10px; font-weight: 800; letter-spacing: .14em; }
.today-brief h3 { margin: 7px 0 6px; font-size: clamp(20px, 2.2vw, 27px); letter-spacing: -.04em; }
.today-brief-copy > p { max-width: 620px; margin: 0; color: #c5c5c9; font-size: 13px; }
.today-brief-actions { display: flex; gap: 8px; margin-top: 17px; flex-wrap: wrap; }
.today-brief-actions .btn-ghost { color: #e0e0e4; border-color: rgba(255, 255, 255, .12); background: rgba(255,255,255,.04); }
.today-brief-side { display: flex; align-items: center; gap: 11px; min-width: 215px; padding: 12px 14px; border: 1px solid rgba(52, 211, 153, .23); border-radius: 12px; background: rgba(0, 0, 0, .38); }
.today-orb { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 11px; color: #fff; background: linear-gradient(135deg, #34d399, #147a60); box-shadow: 0 6px 18px rgba(52, 211, 153, .18); }
.today-brief-side b, .today-brief-side small { display: block; }.today-brief-side b { font-size: 12px; }.today-brief-side small { margin-top: 3px; color: #afafb2; font-size: 10px; line-height: 1.35; }
.today-flow { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; padding-top: 15px; border-top: 1px solid rgba(255, 255, 255, .07); }
.today-flow span { display: grid; grid-template-columns: 23px 1fr; column-gap: 8px; align-items: center; }.today-flow i { grid-row: span 2; display: grid; place-items: center; width: 23px; height: 23px; border-radius: 8px; color: #fff; background: rgba(255, 255, 255, .16); font-size: 10px; font-style: normal; font-weight: 800; }.today-flow b { font-size: 11px; }.today-flow small { color: #afafb2; font-size: 10px; }
#view-today .kpi { position: relative; overflow: hidden; }.kpi::after { content: ""; position: absolute; right: -23px; bottom: -32px; width: 86px; height: 86px; border-radius: 50%; background: rgba(255, 255, 255, .04); pointer-events: none; }.kpi.accent::after { background: rgba(255,255,255,.08); }
#view-today .kpi small { color: #afafb2; font-weight: 600; }.kpi b { letter-spacing: -.045em; }.kpi span { display: flex; align-items: center; gap: 5px; }.kpi span::before { content: ""; width: 5px; height: 5px; border-radius: 50%; background: rgba(122, 162, 255, .49); }
#view-today .panel-head { margin-bottom: 15px; }.panel-head h3 { letter-spacing: -.025em; }.today-grid .panel { min-height: 100%; }
#view-today .signal { transition: transform .15s ease, border-color .15s ease, background .15s ease; }.signal:hover { transform: translateY(-1px); border-color: rgba(255, 255, 255, .16); }.signal.active { box-shadow: inset 3px 0 var(--violet2), 0 8px 24px rgba(0, 0, 0, .16); }
#view-today .detail-head h3 { font-size: 21px; }.detail-links { margin-top: 3px; }.detail-actions .btn-primary { min-width: 145px; justify-content: center; }
.today-brief .btn-primary { background: #a9c4ff; color: #252527; box-shadow: 0 7px 22px rgba(255, 255, 255, .11); }.today-brief .btn-primary:hover { background: #d9d9dd; }
.brand-agent { display: block; margin: -22px 4px 22px; color: #afafb2; font-size: 10px; font-weight: 700; letter-spacing: .03em; }
@media (max-width: 820px) {
  .today-brief { grid-template-columns: 1fr; padding: 19px; gap: 16px; }
  .today-brief-side { min-width: 0; }.today-flow { grid-template-columns: 1fr; gap: 9px; }
  .today-flow span { padding: 5px 0; }.today-brief-actions .btn { flex: 1; justify-content: center; }
  .brand-agent { margin: -8px 8px 0 0; white-space: nowrap; }
}

.cal-sum { flex-basis: 100%; margin: 0; font-size: 12px; color: var(--muted); line-height: 1.4; }

/* Adresses d'envoi des emails */
.ap-senders { display: flex; flex-direction: column; gap: 8px; border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; background: var(--bg2); margin: 12px 0; }
.ap-senders > small { color: var(--muted); font-size: 12px; line-height: 1.45; }
.ap-sender-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.ap-sender-list li { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.ap-sender-list small { display: block; color: var(--muted); font-size: 12px; }
.ap-sender-form { display: grid; grid-template-columns: 1.2fr 1fr 1fr auto; gap: 8px; }
@media (max-width: 820px) { .ap-sender-form { grid-template-columns: minmax(0, 1fr); } }

/* Espaces clients (multi-clients) */
.ws-panel .panel-head { align-items: flex-start; gap: 12px; flex-wrap: wrap; }
.ws-sub { margin: 4px 0 0; font-size: 13px; }
.ws-iso { font-size: 12px; font-weight: 600; padding: 6px 10px; border-radius: 999px; border: 1px solid var(--line); color: var(--muted); white-space: nowrap; }
.ws-iso-ok { color: var(--green); border-color: rgba(52, 211, 153, .35); background: rgba(52, 211, 153, .08); }
.ws-iso-bad { color: var(--red); border-color: rgba(248, 113, 113, .35); background: rgba(248, 113, 113, .08); }
.ws-iso-off { white-space: normal; }
.ws-stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin: 14px 0 16px; }
.ws-stat { background: var(--bg2); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; display: flex; flex-direction: column; gap: 2px; }
.ws-stat b { font-size: 22px; font-variant-numeric: tabular-nums; color: var(--text); }
.ws-stat span { font-size: 12px; color: var(--muted); }
.ws-grid { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 12px; }
.ws-card { background: var(--card2); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; display: flex; flex-direction: column; gap: 12px; transition: border-color .15s; }
.ws-card:hover { border-color: rgba(122, 162, 255, .32); }
.ws-card-head { display: flex; align-items: center; gap: 12px; min-width: 0; }
.ws-avatar { flex: none; width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center; font-weight: 700; color: #fff; background: linear-gradient(135deg, var(--violet), var(--violet2)); }
.ws-id { min-width: 0; flex: 1; }
.ws-id b { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ws-id small { display: block; color: var(--muted); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ws-chip { flex: none; font-size: 11px; font-weight: 700; padding: 4px 9px; border-radius: 999px; border: 1px solid var(--line); color: var(--muted); }
.ws-chip.ws-on { color: var(--green); border-color: rgba(52, 211, 153, .35); background: rgba(52, 211, 153, .08); }
.ws-chip.ws-warn { color: var(--amber); border-color: rgba(251, 191, 36, .35); background: rgba(251, 191, 36, .08); }
.ws-steps { display: flex; flex-wrap: wrap; gap: 6px; }
.ws-step { font-size: 11px; padding: 3px 8px; border-radius: 999px; background: var(--bg2); border: 1px solid var(--line); color: var(--muted); }
.ws-step.ok { color: var(--text); border-color: rgba(255, 255, 255, .16); background: var(--violet-soft); }
.ws-metrics { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; padding: 10px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.ws-metrics div { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.ws-metrics b { font-size: 15px; font-variant-numeric: tabular-nums; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ws-metrics span { font-size: 11px; color: var(--muted); }
.ws-empty { grid-column: 1 / -1; display: flex; flex-direction: column; gap: 4px; padding: 22px; border: 1px dashed var(--line); border-radius: var(--radius); color: var(--muted); }
.ws-empty b { color: var(--text); }
@media (max-width: 640px) {
  .ws-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ws-grid { grid-template-columns: 1fr; }
  .ws-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
.ws-card, .ws-stat { min-width: 0; }
.ws-panel .panel-head > div { min-width: 0; flex: 1 1 260px; }
.ws-iso { max-width: 100%; }
.row-actions { flex-wrap: wrap; }
.btn-danger { color: var(--red); border-color: rgba(248, 113, 113, .35); background: rgba(248, 113, 113, .06); }
.btn-danger:hover { border-color: var(--red); background: rgba(248, 113, 113, .12); }
