:root {
    color-scheme: light;
    --brand-1: #e5383b;
    --brand-2: #b0101c;
    --brand-3: #7a0a14;
    --bg: #fff5f5;
    --card: #ffffff;
    --card-tint: #fff0f1;
    --heading: #2b0a0f;
    --text: #3d1a1f;
    --muted: #a8676d;
    --placeholder: #e5a3a8;
    --line: #f6d5d8;
    --accent: #e5383b;
    --accent-hover: #c81d25;
    --error-bg: #fde7e8;
    --error: #a4161a;
    --shadow: 0 30px 60px -20px rgba(60, 0, 8, .55);
}
* { box-sizing: border-box; }
body {
    margin: 0;
    font-family: "Lato", system-ui, -apple-system, "Segoe UI", sans-serif;
    background: var(--bg);
    color: var(--text);
}
.muted { color: var(--muted); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
button { cursor: pointer; font: inherit; }

/* ---------- Page de connexion ---------- */
.login-page {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 48px 16px;
    background: radial-gradient(circle at 20% 10%, var(--brand-1), var(--brand-2) 45%, var(--brand-3));
    overflow-x: hidden;
    position: relative;
}
.shapes span {
    position: absolute;
    border-radius: 18px;
    background: rgba(255, 255, 255, .12);
    transform: rotate(-12deg) skewX(-8deg);
    pointer-events: none;
}
.shapes span:nth-child(1) { width: 110px; height: 130px; top: 8%;  right: 4%; }
.shapes span:nth-child(2) { width: 120px; height: 150px; bottom: 6%; left: 2%; background: rgba(60, 0, 8, .25); }
.shapes span:nth-child(3) { width: 150px; height: 170px; bottom: -4%; right: 22%; }
.shapes span:nth-child(4) { width: 70px;  height: 80px;  top: 12%; left: 12%; background: rgba(60, 0, 8, .2); }

.login-card {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 960px;
    display: grid;
    grid-template-columns: 1.15fr 1fr;
    background: linear-gradient(180deg, var(--card) 55%, var(--card-tint));
    border-radius: 28px;
    box-shadow: var(--shadow);
    overflow: hidden;
}
.login-art { display: flex; align-items: center; justify-content: center; padding: 32px 16px 32px 32px; }
.art { width: 100%; height: auto; max-width: 520px; }
.float { animation: float 6s ease-in-out infinite; }
.f2 { animation-delay: -2s; }
.f3 { animation-delay: -4s; }
@keyframes float { 50% { transform: translateY(-6px); } }
@media (prefers-reduced-motion: reduce) { .float { animation: none; } }

.login-form { padding: 64px 56px 56px 24px; display: flex; flex-direction: column; justify-content: center; }
.login-form h1 {
    margin: 0 0 36px;
    font-size: 2.4rem;
    line-height: 1.15;
    font-weight: 900;
    color: var(--heading);
    letter-spacing: .01em;
}
.field { display: block; margin-bottom: 8px; }
.field input {
    width: 100%;
    padding: 14px 2px;
    font: inherit;
    font-size: .95rem;
    color: var(--text);
    background: transparent;
    border: 0;
    border-bottom: 1px solid var(--line);
    border-radius: 0;
    transition: border-color .2s;
}
.field input::placeholder { color: var(--placeholder); }
.field input:focus { outline: none; border-bottom-color: var(--accent); }

.remember {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    margin: 22px 0 22px;
    font-size: .92rem;
    color: var(--muted);
    cursor: pointer;
}
.remember input { width: 16px; height: 16px; margin: 0; accent-color: var(--accent); }

.btn-primary {
    padding: 14px;
    border: 0;
    border-radius: 6px;
    background: var(--accent);
    color: #fff;
    font-weight: 700;
    letter-spacing: .02em;
    box-shadow: 0 10px 20px -10px var(--accent);
    transition: background .2s, transform .1s;
}
.login-form .btn-primary { width: 100%; }
.btn-primary:hover { background: var(--accent-hover); }
.btn-primary:active { transform: translateY(1px); }
.btn-primary:focus-visible { outline: 2px solid var(--heading); outline-offset: 2px; }

.hint { margin: 26px 0 0; font-size: .9rem; color: var(--muted); }
.hint strong { color: var(--heading); }

.alert {
    background: var(--error-bg);
    color: var(--error);
    padding: 10px 12px;
    border-radius: 6px;
    font-size: .9rem;
    margin: -16px 0 16px;
}

@media (max-width: 820px) {
    .login-card { grid-template-columns: 1fr; max-width: 440px; }
    .login-art { display: none; }
    .login-form { padding: 40px 28px; }
    .login-form h1 { font-size: 2rem; }
}

/* ---------- Espace connecté ---------- */
.app { --sidebar-w: 264px; min-height: 100vh; }
.icon { width: 20px; height: 20px; flex-shrink: 0; }

.sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: var(--sidebar-w);
    display: flex;
    flex-direction: column;
    padding: 24px 16px 16px;
    color: #fff;
    background: radial-gradient(circle at 0% 0%, var(--brand-1), var(--brand-2) 50%, var(--brand-3));
    overflow: hidden;
    z-index: 20;
}
/* Formes translucides reprises de la page de connexion */
.sidebar::before, .sidebar::after {
    content: "";
    position: absolute;
    border-radius: 18px;
    transform: rotate(-12deg) skewX(-8deg);
    pointer-events: none;
}
.sidebar::before { width: 120px; height: 140px; right: -50px; top: 38%; background: rgba(255, 255, 255, .08); }
.sidebar::after  { width: 140px; height: 160px; left: -60px; bottom: 60px; background: rgba(60, 0, 8, .25); }
.sidebar > * { position: relative; z-index: 1; }

.brand { display: flex; align-items: center; gap: 12px; padding: 0 8px 28px; color: #fff; text-decoration: none; font-weight: 900; font-size: 1.3rem; }
.brand-mark { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 10px; background: #fff; color: var(--brand-1); }

.nav { display: flex; flex-direction: column; gap: 4px; flex: 1; overflow-y: auto; }
.nav-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 11px 12px;
    border-radius: 10px;
    color: rgba(255, 255, 255, .85);
    text-decoration: none;
    font-size: .95rem;
    transition: background .15s, color .15s;
}
.nav-link:hover { background: rgba(255, 255, 255, .12); color: #fff; }
.nav-link.is-active { background: #fff; color: var(--brand-2); font-weight: 700; box-shadow: 0 10px 20px -12px rgba(0, 0, 0, .5); }
.nav-link.is-disabled { color: rgba(255, 255, 255, .5); cursor: default; }
.nav-link.is-disabled:hover { background: none; }
.nav-link em { margin-left: auto; font-style: normal; font-size: .68rem; text-transform: uppercase; letter-spacing: .06em; padding: 2px 7px; border-radius: 99px; background: rgba(255, 255, 255, .14); }

.sidebar-user { display: flex; align-items: center; gap: 10px; padding: 12px; margin-top: 12px; border-radius: 12px; background: rgba(0, 0, 0, .18); }
.avatar { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 50%; background: #fff; color: var(--brand-2); font-weight: 900; font-size: .85rem; flex-shrink: 0; }
.who { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.who strong { font-size: .9rem; }
.who small { font-size: .75rem; opacity: .75; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sidebar-user form { margin: 0; }
.icon-btn { display: grid; place-items: center; width: 36px; height: 36px; border: 0; border-radius: 8px; background: transparent; color: inherit; cursor: pointer; }
.icon-btn:hover { background: rgba(255, 255, 255, .15); }

.main { margin-left: var(--sidebar-w); min-height: 100vh; background: var(--bg); }
.page { padding: 32px; max-width: 1200px; margin: 0 auto; }
.mobile-bar, .nav-backdrop { display: none; }

.hero {
    display: grid;
    grid-template-columns: 1.2fr 1fr;
    align-items: center;
    gap: 24px;
    padding: 36px 40px;
    border-radius: 24px;
    background: linear-gradient(180deg, var(--card) 55%, var(--card-tint));
    box-shadow: 0 20px 40px -24px rgba(120, 10, 20, .35);
    overflow: hidden;
}
.eyebrow { margin: 0 0 8px; color: var(--accent); font-weight: 700; font-size: .8rem; text-transform: uppercase; letter-spacing: .08em; }
.hero h1 { margin: 0 0 14px; color: var(--heading); font-weight: 900; font-size: 2rem; line-height: 1.2; }
.hero p { margin: 0; color: var(--muted); line-height: 1.6; }
.hero-art .art { max-width: 340px; display: block; margin-left: auto; }

.card { margin-top: 24px; padding: 24px 28px; border-radius: 20px; background: var(--card); box-shadow: 0 20px 40px -28px rgba(120, 10, 20, .35); }
.card h2 { margin: 0 0 16px; color: var(--heading); font-size: 1.1rem; font-weight: 900; }

@media (max-width: 960px) {
    .sidebar { transform: translateX(-100%); transition: transform .25s ease; box-shadow: 0 0 40px rgba(0, 0, 0, .35); }
    .nav-toggle:checked ~ .sidebar { transform: none; }
    .nav-toggle:checked ~ .nav-backdrop { display: block; position: fixed; inset: 0; z-index: 10; background: rgba(20, 0, 4, .45); }
    .main { margin-left: 0; }
    .mobile-bar { display: flex; align-items: center; gap: 12px; padding: 12px 16px; color: #fff; background: linear-gradient(90deg, var(--brand-1), var(--brand-2)); position: sticky; top: 0; z-index: 5; }
    .page { padding: 20px 16px; }
    .hero { grid-template-columns: 1fr; padding: 28px 24px; }
    .hero-art { display: none; }
    .hero h1 { font-size: 1.6rem; }
}

/* ---------- Composants de l'application ---------- */
.small { font-size: .82rem; }
.spacer { flex: 1; }
a { color: var(--accent); }
.hide-sm, .hide-md { }

.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    padding: 10px 16px; border-radius: 8px; border: 0;
    font-weight: 700; font-size: .92rem; text-decoration: none; white-space: nowrap;
}
.btn .icon { width: 18px; height: 18px; }
.btn.btn-primary { padding: 10px 16px; }
.btn-soft { background: var(--card-tint); color: var(--heading); border: 1px solid var(--line); }
.btn-soft:hover { border-color: var(--accent); color: var(--accent); }
.btn-danger { background: transparent; color: var(--error); border: 1px solid currentColor; }
.btn-danger:hover { background: var(--error-bg); }
.btn.sm { padding: 6px 10px; font-size: .82rem; }
.icon-btn.sm { width: 30px; height: 30px; font-size: .7rem; color: var(--muted); }
.icon-btn.sm:hover { background: var(--card-tint); color: var(--accent); }
.icon-btn:disabled { opacity: .3; cursor: default; }
.icon-btn.danger:hover { color: var(--error); }

.btn-new {
    display: flex; align-items: center; justify-content: center; gap: 8px;
    margin: 0 4px 20px; padding: 12px; border-radius: 10px;
    background: rgba(255, 255, 255, .16); color: #fff; font-weight: 700; text-decoration: none;
    border: 1px dashed rgba(255, 255, 255, .45);
    transition: background .15s;
}
.btn-new:hover { background: rgba(255, 255, 255, .26); }
.nav-link .count { margin-left: auto; font-style: normal; font-size: .72rem; font-weight: 900; min-width: 22px; text-align: center; padding: 2px 7px; border-radius: 99px; background: #fff; color: var(--brand-2); }
.nav-link.is-active .count { background: var(--brand-2); color: #fff; }
.sidebar-profile { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 0; color: inherit; text-decoration: none; }
.mobile-bell { margin-left: auto; position: relative; color: #fff; }
.mobile-bell i { position: absolute; top: 7px; right: 8px; width: 8px; height: 8px; border-radius: 50%; background: #fff; }

.avatar.sm { width: 32px; height: 32px; font-size: .75rem; background: var(--card-tint); color: var(--accent); }
.avatar.xs { width: 26px; height: 26px; font-size: .65rem; background: var(--card-tint); color: var(--accent); }

.flash { padding: 12px 16px; border-radius: 10px; margin-bottom: 16px; font-size: .92rem; background: #e7f6ec; color: #1e6b3a; }
.flash-error { background: var(--error-bg); color: var(--error); }

.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 8px; }
.page-head h1 { margin: 4px 0; color: var(--heading); font-weight: 900; font-size: 1.8rem; line-height: 1.2; }
.page-head p { margin: 0; }
.back { display: inline-flex; align-items: center; gap: 4px; color: var(--muted); text-decoration: none; font-size: .88rem; }
.back:hover { color: var(--accent); }
.back .icon { width: 16px; height: 16px; }
.ref { color: var(--muted); font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
.head-badges { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-top: 8px !important; }

/* Badges : texte en ton foncé sur fond clair, lisibles dans les deux thèmes */
.badge { display: inline-block; padding: 3px 10px; border-radius: 99px; font-size: .75rem; font-weight: 700; white-space: nowrap; }
.tone-blue  { background: #e6effd; color: #1d4ed8; }
.tone-red   { background: #fde7e8; color: #b0101c; }
.tone-amber { background: #fdf1dc; color: #9a5b00; }
.tone-green { background: #e3f5ea; color: #1e6b3a; }
.tone-grey  { background: #eef0f2; color: #555d66; }
.tone-dark  { background: #2b2f36; color: #fff; }
.chip { display: inline-block; padding: 3px 10px; border-radius: 6px; background: var(--card-tint); color: var(--text); font-size: .78rem; }

/* Formulaires */
.form label, .filters label { display: block; }
.form label { margin-bottom: 14px; font-size: .85rem; font-weight: 700; color: var(--heading); }
.form input[type=text], .form input[type=email], .form input[type=password], .form textarea, .form select,
.filters input, .filters select, .inline-add input, .rename input, .reply-box textarea {
    display: block; width: 100%; margin-top: 6px; padding: 10px 12px;
    font: inherit; font-weight: 400; font-size: .95rem; color: var(--text);
    background: var(--bg); border: 1px solid var(--line); border-radius: 8px;
}
.form input:focus, .form textarea:focus, .form select:focus, .filters input:focus, .filters select:focus,
.inline-add input:focus, .rename input:focus, .reply-box textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 18%, transparent); }
.form textarea, .reply-box textarea { resize: vertical; min-height: 100px; line-height: 1.5; }
.form input[type=file] { margin-top: 6px; font-weight: 400; }
.form small { display: block; margin-top: 4px; font-weight: 400; }
.form fieldset { border: 0; padding: 0; margin: 0 0 12px; }
.form legend { padding: 0; margin-bottom: 12px; color: var(--accent); font-weight: 900; font-size: .8rem; text-transform: uppercase; letter-spacing: .08em; }
.form .check { display: flex; align-items: center; gap: 8px; font-weight: 400; }
.form .check input { accent-color: var(--accent); width: 16px; height: 16px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
.form-actions { display: flex; gap: 10px; justify-content: flex-end; align-items: center; flex-wrap: wrap; }
.form-actions.start { justify-content: flex-start; }

/* Filtres et tableaux */
.filters { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; padding: 16px; }
.filters select, .filters input { margin: 0; width: auto; }
.filters .search { position: relative; flex: 1 1 240px; }
.filters .search .icon { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); color: var(--muted); width: 18px; }
.filters .search input { width: 100%; padding-left: 36px; }
.table-card { padding: 0; overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: .92rem; }
.table th { text-align: left; padding: 14px 16px; font-size: .75rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); border-bottom: 1px solid var(--line); }
.table td { padding: 14px 16px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table td small { display: block; margin-top: 2px; }
.row-link { cursor: pointer; transition: background .12s; }
.row-link:hover { background: var(--card-tint); }
.subject { color: var(--heading); font-weight: 700; text-decoration: none; }
.pager { display: flex; justify-content: center; align-items: center; gap: 16px; margin-top: 20px; }
.empty { text-align: center; padding: 40px; }
.empty p { margin: 4px 0; }

/* Fiche ticket */
.ticket-layout { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 24px; align-items: start; }
.ticket-side { position: sticky; top: 24px; }
.message header { display: flex; gap: 12px; align-items: center; margin-bottom: 12px; }
.message header > div { display: flex; flex-direction: column; }
.message header strong { color: var(--heading); }
.message-body { line-height: 1.6; overflow-wrap: anywhere; }
.message-origin { border-top: 4px solid var(--accent); }
.message-note { background: #fff8e6; border: 1px dashed #e0b44a; box-shadow: none; }
.tag-note { display: inline-flex; align-items: center; gap: 4px; font-size: .75rem; font-weight: 700; color: #9a5b00; }
.tag-note .icon { width: 14px; height: 14px; }
.edit-ticket { margin-top: 16px; border-top: 1px solid var(--line); padding-top: 12px; }
.edit-ticket summary { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; color: var(--muted); font-size: .88rem; }
.edit-ticket summary .icon { width: 16px; height: 16px; }
.edit-ticket .form { margin-top: 16px; }

.timeline { list-style: none; margin: 0; padding: 0; }
.timeline > li > .card { margin-top: 16px; }
.timeline .event { display: flex; justify-content: space-between; gap: 12px; padding: 12px 8px 0 20px; font-size: .85rem; color: var(--muted); position: relative; }
.timeline .event::before { content: ""; position: absolute; left: 6px; top: 18px; width: 6px; height: 6px; border-radius: 50%; background: var(--placeholder); }
.timeline .event strong { color: var(--text); }
.timeline .event time { white-space: nowrap; }

.attachments { list-style: none; margin: 14px 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 10px; }
.attachments a { display: flex; align-items: center; gap: 8px; padding: 8px 12px; border-radius: 10px; background: var(--card-tint); border: 1px solid var(--line); text-decoration: none; color: var(--text); font-size: .85rem; max-width: 280px; }
.attachments a:hover { border-color: var(--accent); }
.attachments img { width: 44px; height: 44px; object-fit: cover; border-radius: 6px; }
.attachments span { display: flex; flex-direction: column; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.attachments small { color: var(--muted); }

.reply-box { margin-top: 24px; }
.segmented { display: inline-flex; padding: 4px; border-radius: 10px; background: var(--card-tint); margin-bottom: 12px; flex-wrap: wrap; }
.segmented label { cursor: pointer; }
.segmented input { position: absolute; opacity: 0; pointer-events: none; }
.segmented span { display: inline-flex; align-items: center; gap: 6px; padding: 8px 14px; border-radius: 8px; font-size: .88rem; font-weight: 700; color: var(--muted); }
.segmented span .icon { width: 16px; height: 16px; }
.segmented input:checked + span { background: var(--card); color: var(--accent); box-shadow: 0 2px 6px rgba(120, 10, 20, .12); }
.segmented input:focus-visible + span { outline: 2px solid var(--accent); }
.reply-box:has(input[value=note]:checked) textarea { background: #fff8e6; border-color: #e0b44a; }
.reply-actions { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-top: 12px; flex-wrap: wrap; }
.file-btn { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-size: .88rem; cursor: pointer; max-width: 60%; }
.file-btn span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-btn:hover { color: var(--accent); }
.file-btn input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.file-btn:focus-within { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }

.side-form { margin-top: 0; }
.side-form .btn { width: 100%; }
.details dl { margin: 0; display: grid; grid-template-columns: auto 1fr; gap: 8px 12px; font-size: .88rem; }
.details dt { color: var(--muted); }
.details dd { margin: 0; overflow-wrap: anywhere; }
.danger-zone { margin-top: 16px; }
.danger-zone .btn { width: 100%; }

/* Tableau de bord */
.hero-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 20px; }
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 16px; margin-top: 24px; }
.tiles-4 { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }
.tile { display: flex; flex-direction: column; gap: 4px; padding: 20px; border-radius: 16px; background: var(--card); text-decoration: none; box-shadow: 0 20px 40px -28px rgba(120, 10, 20, .35); border: 1px solid transparent; transition: border-color .15s, transform .15s; }
a.tile:hover { border-color: var(--accent); transform: translateY(-2px); }
.tile-value { font-size: 2rem; font-weight: 900; color: var(--heading); font-variant-numeric: tabular-nums; line-height: 1.1; }
.tile-label { font-size: .85rem; color: var(--muted); }
.dash-grid { display: grid; grid-template-columns: 1.3fr 1fr; gap: 0 24px; }
.card-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 12px; }
.card-head h2 { margin: 0; }
.card-head a { font-size: .88rem; text-decoration: none; }
.ticket-list, .activity { list-style: none; margin: 0; padding: 0; }
.ticket-list a { display: flex; align-items: center; gap: 12px; padding: 12px 8px; border-radius: 10px; text-decoration: none; color: var(--text); }
.ticket-list a:hover { background: var(--card-tint); }
.tl-main { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.tl-main strong { color: var(--heading); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tl-badges { display: flex; gap: 6px; flex-shrink: 0; }
.activity li { display: flex; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--line); font-size: .88rem; line-height: 1.5; }
.activity li:last-child { border-bottom: 0; }
.activity a { text-decoration: none; font-weight: 700; }
.activity small { display: block; }

/* Rapports : barres d'une seule teinte, valeurs écrites en encre de texte */
.period-switch { display: inline-flex; padding: 4px; border-radius: 10px; background: var(--card); box-shadow: 0 10px 30px -20px rgba(120, 10, 20, .35); flex-wrap: wrap; }
.period-switch button { border: 0; background: none; padding: 8px 12px; border-radius: 8px; color: var(--muted); font-weight: 700; font-size: .85rem; }
.period-switch button.is-active { background: var(--accent); color: #fff; }
.report-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 0 24px; }
.bars { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.bars li { display: grid; grid-template-columns: minmax(90px, 40%) 1fr 36px; gap: 10px; align-items: center; font-size: .88rem; }
.bar-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar-track { height: 10px; border-radius: 4px; background: var(--card-tint); overflow: hidden; }
.bar-fill { display: block; height: 100%; border-radius: 0 4px 4px 0; background: var(--accent); }
.bars li:hover .bar-fill { background: var(--accent-hover); }
.bar-value { text-align: right; font-weight: 700; font-variant-numeric: tabular-nums; color: var(--heading); }
.columns { display: flex; align-items: flex-end; gap: 8px; height: 200px; padding: 28px 0 0; border-bottom: 1px solid var(--line); }
.col { flex: 1; height: 100%; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; position: relative; outline: none; }
.col-bar { width: 100%; max-width: 36px; background: var(--accent); border-radius: 4px 4px 0 0; transition: background .12s; }
.col-label { position: absolute; bottom: -22px; font-size: .7rem; color: var(--muted); white-space: nowrap; }
.col-tip { position: absolute; bottom: calc(100% + 4px); left: 50%; transform: translateX(-50%); padding: 6px 10px; border-radius: 6px; background: var(--heading); color: var(--card); font-size: .78rem; white-space: nowrap; pointer-events: none; opacity: 0; transition: opacity .1s; z-index: 2; }
.col:hover .col-tip, .col:focus .col-tip { opacity: 1; }
.col:hover .col-bar, .col:focus .col-bar { background: var(--accent-hover); }
.col:first-child .col-tip { left: 0; transform: none; }
.col:last-child .col-tip { left: auto; right: 0; transform: none; }
.data-table { margin-top: 36px; }
.data-table summary { cursor: pointer; color: var(--muted); font-size: .85rem; }

/* Base de connaissances */
.kb-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 0 20px; }
.kb-card { display: flex; flex-direction: column; text-decoration: none; color: var(--text); border: 1px solid transparent; transition: border-color .15s; }
.kb-card:hover { border-color: var(--accent); }
.kb-card h2 { margin-bottom: 8px; }
.kb-card p { flex: 1; margin: 0 0 16px; font-size: .9rem; line-height: 1.5; }
.kb-card footer { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.prose { line-height: 1.7; max-width: 820px; }
.prose h2 { font-size: 1.3rem; margin: 24px 0 8px; }
.prose h3 { color: var(--heading); font-size: 1.05rem; margin: 20px 0 6px; }
.prose > :first-child { margin-top: 0; }
.prose code, .form code { background: var(--card-tint); padding: 1px 6px; border-radius: 4px; font-size: .88em; }

/* Paramètres */
.tabs { display: flex; gap: 4px; margin-top: 16px; border-bottom: 1px solid var(--line); overflow-x: auto; }
.tabs a { padding: 10px 16px; text-decoration: none; color: var(--muted); font-weight: 700; border-bottom: 3px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tabs a.is-active { color: var(--accent); border-bottom-color: var(--accent); }
.inline-add { display: flex; gap: 10px; margin-bottom: 16px; }
.inline-add input { margin: 0; }
.settings-list, .user-list { list-style: none; margin: 0; padding: 0; }
.settings-list li { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.settings-list li.is-off .rename input { opacity: .55; text-decoration: line-through; }
.settings-list form { margin: 0; }
.order { display: flex; flex-direction: column; }
.rename { display: flex; gap: 8px; align-items: center; flex: 1 1 260px; }
.rename input { margin: 0; }
.user-list li { border-bottom: 1px solid var(--line); }
.user-list li.is-off summary { opacity: .6; }
.user-list summary { display: flex; align-items: center; gap: 12px; padding: 12px 0; cursor: pointer; list-style: none; flex-wrap: wrap; }
.user-list summary::-webkit-details-marker { display: none; }
.who-row { display: flex; flex-direction: column; flex: 1; min-width: 160px; }
.who-row strong { color: var(--heading); }
.user-list .form { padding: 8px 0 16px 44px; }
.grid-user { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 0 14px; align-items: end; }
.grid-user .btn { margin-bottom: 14px; }

/* Profil et notifications */
.profile-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 0 24px; align-items: start; }
.profile-grid #push { grid-column: 1 / -1; }
.push-status { font-weight: 700; color: var(--heading); }
.notif-list { list-style: none; padding: 8px; }
.notif-list a { display: flex; gap: 12px; align-items: flex-start; padding: 14px 12px; border-radius: 10px; text-decoration: none; color: var(--text); }
.notif-list a:hover { background: var(--card-tint); }
.notif-list .dot { width: 8px; height: 8px; margin-top: 7px; border-radius: 50%; flex-shrink: 0; }
.notif-list .is-unread .dot { background: var(--accent); }
.notif-list .is-unread strong { color: var(--heading); }
.notif-main { display: flex; flex-direction: column; flex: 1; min-width: 0; font-size: .92rem; }
.notif-list:not(:has(.is-unread)) strong, .notif-list li:not(.is-unread) strong { font-weight: 400; }
.notif-list time { white-space: nowrap; }
.offline-card { max-width: 440px; grid-template-columns: 1fr; }
.offline-card .login-form { padding: 48px 36px; }

@media (max-width: 1100px) {
    .ticket-layout { grid-template-columns: 1fr; }
    .ticket-side { position: static; }
    .dash-grid { grid-template-columns: 1fr; }
    .hide-md { display: none; }
}
@media (max-width: 960px) {
    .page-head h1 { font-size: 1.5rem; }
    .card { padding: 20px 16px; }
}
@media (max-width: 640px) {
    .hide-sm { display: none; }
    .grid-2 { grid-template-columns: 1fr; }
    .filters select { flex: 1 1 45%; }
    .table td, .table th { padding: 12px 10px; }
    .tl-badges { display: none; }
    .user-list .form { padding-left: 0; }
    .columns { gap: 3px; }
    .col-label { display: none; }
    .page-head .btn { width: 100%; }
}

/* ---------- iPhone / application installée : zones de sécurité (encoche, Dynamic Island, barre d'accueil) ---------- */
@media (max-width: 960px) {
    .mobile-bar {
        padding-top: calc(10px + env(safe-area-inset-top));
        padding-left: max(16px, env(safe-area-inset-left));
        padding-right: max(16px, env(safe-area-inset-right));
    }
    .mobile-bar .icon-btn { width: 44px; height: 44px; }
    .sidebar {
        padding-top: calc(24px + env(safe-area-inset-top));
        padding-bottom: calc(16px + env(safe-area-inset-bottom));
        padding-left: max(16px, env(safe-area-inset-left));
        width: min(300px, 85vw);
    }
    .page {
        padding-left: max(16px, env(safe-area-inset-left));
        padding-right: max(16px, env(safe-area-inset-right));
        padding-bottom: calc(24px + env(safe-area-inset-bottom));
    }
}
.login-page {
    padding-top: calc(48px + env(safe-area-inset-top));
    padding-bottom: calc(48px + env(safe-area-inset-bottom));
}
.push-row { display: flex; align-items: center; gap: 12px; padding: 12px 0; flex-wrap: wrap; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0 16px; }
@media (max-width: 640px) { .grid-3 { grid-template-columns: 1fr; } }
.table th.sortable a { display: inline-flex; align-items: center; gap: 4px; color: inherit; text-decoration: none; white-space: nowrap; }
.table th.sortable a:hover { color: var(--accent); }
.sort-arrow { font-size: .7rem; opacity: .35; }
.table th.is-sorted { color: var(--accent); }
.table th.is-sorted .sort-arrow { opacity: 1; }
