:root { --fg: #1d2733; --muted: #5b6776; --bg: #f4f6f8; --card: #fff; --line: #d9dee4; --accent: #1f5fbf; }
* { box-sizing: border-box; }
body { margin: 0; font: 15px/1.45 system-ui, -apple-system, "Segoe UI", sans-serif; color: var(--fg); background: var(--bg); }
a { color: var(--accent); }
.topbar { display: flex; justify-content: space-between; align-items: center; padding: .6rem 1.2rem; background: #16202c; color: #fff; }
.topbar .brand { color: #fff; font-weight: 600; text-decoration: none; }
.userbox { display: flex; gap: 1rem; align-items: center; margin: 0; }
button.link { background: none; border: 0; color: #cfd8e3; text-decoration: underline; cursor: pointer; font: inherit; padding: 0; }
main { max-width: 78rem; margin: 1.2rem auto; padding: 0 1.2rem; }
h1 { font-size: 1.4rem; margin-top: 0; }
h2 { font-size: 1.1rem; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 6px; padding: 1rem 1.2rem; margin-bottom: 1rem; }
.card.narrow { max-width: 26rem; margin: 3rem auto; }
label { display: block; margin-bottom: .8rem; font-size: .9rem; color: var(--muted); }
input, select { display: block; width: 100%; margin-top: .2rem; padding: .45rem .5rem; border: 1px solid var(--line); border-radius: 4px; font: inherit; color: var(--fg); background: #fff; }
button { padding: .5rem 1rem; border: 0; border-radius: 4px; background: var(--accent); color: #fff; font: inherit; cursor: pointer; }
.alert { background: #fdecea; border: 1px solid #f1b9b3; color: #8a1f17; padding: .5rem .7rem; border-radius: 4px; }
.views { display: flex; gap: .5rem; flex-wrap: wrap; margin-bottom: 1rem; }
.views a { padding: .4rem .8rem; border: 1px solid var(--line); border-radius: 999px; background: var(--card); text-decoration: none; color: var(--fg); }
.views a.active { background: var(--accent); border-color: var(--accent); color: #fff; }
.views .count { font-weight: 600; margin-left: .2rem; }
.filters { display: grid; grid-template-columns: repeat(auto-fit, minmax(10rem, 1fr)); gap: .6rem; align-items: end; background: var(--card); border: 1px solid var(--line); border-radius: 6px; padding: .8rem; }
.filters label { margin: 0; }
.filters .reset { align-self: center; }
.summary { color: var(--muted); }
table.tickets { width: 100%; border-collapse: collapse; background: var(--card); border: 1px solid var(--line); }
.tickets th, .tickets td { text-align: left; padding: .5rem .6rem; border-bottom: 1px solid var(--line); vertical-align: top; }
.tickets th { background: #eef1f5; font-size: .85rem; color: var(--muted); }
.badge { display: inline-block; padding: .05rem .5rem; border-radius: 999px; font-size: .8rem; background: #e5e9ee; }
.badge.reply { background: #fff1cc; color: #7a5200; margin-left: .3rem; }
.badge.status-nouveau { background: #dbe8ff; }
.badge.status-en_cours { background: #d9f2e3; }
.badge.status-en_attente_client { background: #fff1cc; }
.badge.status-resolu { background: #e3dcf7; }
.pagination { display: flex; gap: 1rem; justify-content: center; margin: 1rem 0; }
.empty { color: var(--muted); font-style: italic; }
.facts { display: grid; grid-template-columns: 11rem 1fr; gap: .3rem 1rem; margin: 0; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; word-break: break-word; }
.text { white-space: pre-wrap; overflow-wrap: anywhere; }
.message { background: var(--card); border: 1px solid var(--line); border-left-width: 5px; border-radius: 6px; padding: .6rem .9rem; margin-bottom: .7rem; }
.message header { font-size: .85rem; color: var(--muted); margin-bottom: .3rem; }
.message.client { border-left-color: #6b7a8c; }
.message.agent { border-left-color: var(--accent); }
.message.internal { background: #fff8e1; border: 2px dashed #d99a00; border-left-width: 2px; }
.tag { display: inline-block; padding: .05rem .45rem; border-radius: 3px; font-weight: 600; font-size: .78rem; margin-right: .4rem; }
.tag.internal { background: #d99a00; color: #fff; }
.tag.public { background: var(--accent); color: #fff; }
.tag.client { background: #6b7a8c; color: #fff; }
.tag.phone { background: #5b4bb7; color: #fff; }
.history { list-style: none; padding: 0; margin: 0; font-size: .9rem; }
.history li { padding: .2rem 0; border-bottom: 1px dotted var(--line); }

.tickets td:first-child { white-space: nowrap; }
.mainnav { display: flex; gap: 1.2rem; flex: 1; margin-left: 2rem; }
.mainnav a { color: #cfd8e3; text-decoration: none; }
.mainnav a:hover { color: #fff; text-decoration: underline; }
.flash { padding: .6rem .9rem; border-radius: 4px; margin: 0 0 1rem; border: 1px solid; }
.flash.success { background: #e4f5ea; border-color: #a9d9b9; color: #14532d; }
.flash.error { background: #fdecea; border-color: #f1b9b3; color: #8a1f17; }
.alert ul { margin: 0; padding-left: 1.2rem; }
.actions { display: grid; grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr)); gap: 1rem; margin-bottom: 1rem; }
.action h2 { margin-top: 0; font-size: 1rem; }
.action form + form { margin-top: .6rem; }
textarea { display: block; width: 100%; margin-top: .2rem; padding: .45rem .5rem; border: 1px solid var(--line); border-radius: 4px; font: inherit; color: var(--fg); background: #fff; resize: vertical; }
button.secondary { background: #fff; color: var(--accent); border: 1px solid var(--accent); }
button.danger { background: #b3261e; }
button.internal { background: #b57f00; }
.compose-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(20rem, 1fr)); gap: 1rem; margin-bottom: 1rem; }
.compose { background: var(--card); border: 1px solid var(--line); border-left: 5px solid var(--accent); border-radius: 6px; padding: .8rem 1rem; }
.compose h2 { margin: 0 0 .5rem; font-size: 1rem; }
.compose button { margin-top: .6rem; }
.compose.internal { background: #fff8e1; border: 2px dashed #d99a00; }
.form-page { max-width: 40rem; }
.hint { color: var(--muted); }
.pagehead { display: flex; justify-content: space-between; align-items: center; }
.button { display: inline-block; padding: .5rem 1rem; border-radius: 4px; background: var(--accent); color: #fff; text-decoration: none; }
label.check { display: flex; gap: .5rem; align-items: flex-start; color: var(--fg); }
label.check input { width: auto; margin-top: .25rem; }
code.token { display: block; padding: .8rem 1rem; background: #16202c; color: #e8f0fa; border-radius: 4px; font-size: 1rem; word-break: break-all; user-select: all; }

.files { margin: .5rem 0 0; padding-left: 1.2rem; }
.files .meta { color: var(--muted, #52606d); font-size: .85em; }
.compose label.file { display: block; margin-top: .5rem; font-size: .9rem; }
.compose label.file small { display: block; color: var(--muted, #52606d); }

/* Échanges téléphoniques : trace interne, distincte d'une note (violet) */
.message.phone { background: #f3f1fd; border: 2px dashed #5b4bb7; border-left-width: 2px; }
.phone-meta { margin: .2rem 0 .5rem; color: var(--muted, #52606d); font-size: .92rem; }
.compose.phone { background: #f3f1fd; border: 2px dashed #5b4bb7; }
.compose.phone .phone-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(13rem, 1fr)); gap: .6rem 1rem; margin-bottom: .6rem; }
.compose.phone label { display: block; font-size: .9rem; }
.compose.phone label input, .compose.phone label select, .compose.phone label textarea { display: block; width: 100%; margin-top: .2rem; }
.compose button.phone { background: #5b4bb7; color: #fff; }
.message.phone.shared { background: #f3f1fd; border-style: solid; }
.compose.phone label.check { display: flex; gap: .5rem; align-items: flex-start; margin: .3rem 0 .2rem; }
.compose.phone label.check input { width: auto; margin-top: .25rem; flex: none; }
.compose.phone .phone-note { margin: 0 0 .2rem; font-size: .85rem; color: var(--muted, #52606d); }
.danger-zone { text-align: right; margin: 1rem 0; }
.danger-link { color: #b3261e; font-size: .9rem; }

/* ═══ Connexion et choix du mot de passe (18/11/2026, André : « plus UX ») — sans JavaScript (CSP : aucun script). ═══ */
.auth { max-width: 28rem; margin: 3.5rem auto 2rem; padding: 0 1rem; }
.auth-card { background: var(--card); border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 8px 28px rgba(29, 39, 51, .08); overflow: hidden; }
.auth-head { padding: 1.6rem 1.8rem 1rem; text-align: center; border-top: 4px solid var(--accent); }
.auth-logo { width: 48px; height: 48px; margin: 0 auto .7rem; border-radius: 12px; background: #e8f0fb; color: var(--accent); display: flex; align-items: center; justify-content: center; }
.auth-head h1 { margin: 0; font-size: 1.35rem; }
.auth-head p { margin: .35rem 0 0; color: var(--muted); font-size: .9rem; }
.auth-body { padding: .6rem 1.8rem 1.6rem; }
.auth-body label { color: var(--fg); font-weight: 600; font-size: .88rem; margin-bottom: 1rem; }
.auth-body input { padding: .65rem .75rem; border-radius: 8px; margin-top: .35rem; font-weight: 400; }
.auth-body input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(31, 95, 191, .18); }
.auth-body button[type=submit] { width: 100%; padding: .7rem 1rem; border-radius: 8px; font-weight: 600; margin-top: .3rem; }
.auth-body button[type=submit]:hover { filter: brightness(1.08); }
.auth .alert { margin: 0 0 1rem; padding: .6rem .8rem; border-radius: 8px; background: #fdecea; color: #8a1c14; border: 1px solid #f5c6c1; font-size: .9rem; }
.auth-account { margin: 0 0 1rem; padding: .55rem .8rem; border-radius: 8px; background: #f4f7fb; font-size: .9rem; }
.auth-help { margin: 1.2rem 0 0; padding-top: 1rem; border-top: 1px solid var(--line); color: var(--muted); font-size: .84rem; }
.auth-help p { margin: 0 0 .5rem; }
.auth-help p:last-child { margin-bottom: 0; }
.auth-foot { text-align: center; color: var(--muted); font-size: .8rem; margin-top: 1rem; }
/* Le style des champs (display: block) écrasait l attribut hidden : l adresse cachée de « Choisir mon mot de passe » s affichait. */
[hidden] { display: none !important; }

/* Bouton afficher / masquer le mot de passe (public/assets/password-toggle.js) */
.pw-field { position: relative; display: block; }
.pw-field input { padding-right: 5.2rem; }
.pw-toggle { position: absolute; top: 50%; right: .4rem; transform: translateY(-50%); margin: 0; padding: .25rem .55rem; border: 0; border-radius: 6px; background: transparent; color: var(--accent); font: inherit; font-size: .82rem; font-weight: 600; cursor: pointer; }
.pw-toggle:hover { background: #e8f0fb; filter: none; }
.pw-toggle:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
