/* ==========================================================================
   Maya — design system
   Palette héritée du logo Coup de Poing : violet profond (encre, constant
   quel que soit le thème choisi), accent variable selon la préférence de
   l'utilisateur (Mon profil > Apparence), touche ambre du point du logo.
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Bricolage+Grotesque:opsz,wght@12..96,500..700&family=Inter:wght@400;500;600;700&display=swap');

:root {
    --dk-purple: #2e1452;
    --dk-purple-light: #4a2a7a;
    --dk-purple-lighter: #6d47a3;
    --dk-blue: #379dc8;
    --dk-indigo: #3836bf;
    --dk-ember: #f4923a;

    /* Accent — the one hue that changes with the user's chosen color theme
       (see [data-theme-color] below, set from users.theme_color). Kept under
       the historical "teal" name since ~70 rules already reference it; the
       values here are only the *default* (theme "maya"), so nothing breaks
       if data-theme-color is ever absent from the page. */
    --dk-teal: #2bd6d9;
    --dk-teal-dark: #049a9d;

    --dk-font-heading: 'Bricolage Grotesque', 'Inter', system-ui, sans-serif;
    --dk-font-body: 'Inter', system-ui, -apple-system, sans-serif;

    --dk-radius-sm: 0.5rem;
    --dk-radius: 0.9rem;
    --dk-radius-lg: 1.25rem;
    --dk-shadow: 0 2px 14px rgba(46, 20, 82, 0.08);
    --dk-shadow-lg: 0 10px 30px rgba(46, 20, 82, 0.14);
}

/* ---- Color themes (user-selectable) -------------------------------------
   Only the accent changes between themes; ink and neutrals stay put so
   Maya reads as the same product regardless of which one is picked. */
[data-theme-color="ambre"] {
    --dk-teal: #f0a355;
    --dk-teal-dark: #b8570f;
}
[data-theme-color="ardoise"] {
    --dk-teal: #86abc9;
    --dk-teal-dark: #35597a;
}
[data-theme-color="braise"] {
    --dk-teal: #f18e00;
    --dk-teal-dark: #c96f00;
}

/* ---- "Braise" (Coup de Poing rebrand) — the one theme where neutrals also
   change, not just the accent ------------------------------------------
   Every other theme above only swaps --dk-teal/--dk-teal-dark; ink and page
   neutrals stay fixed so Maya still reads as the same product. Braise is a
   deliberate exception: the new brand's background is genuine black, not a
   tint of the existing purple ink, so --dk-purple/--dk-indigo (used directly
   by the sidebar, dashboard banner and login panel gradients) and the
   Bootstrap neutral tokens are overridden too, scoped to this theme only. */
[data-theme-color="braise"][data-bs-theme="dark"] {
    --dk-purple: #0a0a0a;
    --dk-indigo: #1a092d;
    --bs-body-bg: #0a0a0a;
    --bs-body-color: #f5f3f0;
    --bs-secondary-bg: #161316;
    --bs-tertiary-bg: #131113;
    --bs-border-color: #2a262d;
    --bs-emphasis-color: #ffffff;
    --dk-field-bg: #1c191b;
}
[data-theme-color="braise"][data-bs-theme="light"] {
    --dk-purple: #15130f;
    --dk-indigo: #2a2118;
    --bs-body-bg: #fbfaf8;
    --bs-body-color: #15130f;
    --bs-secondary-bg: #f6f4f1;
    --bs-tertiary-bg: #f2efea;
    --bs-border-color: #e8e4de;
    --dk-field-bg: #efece6;
}
[data-theme-color="braise"] .app-sidebar {
    background: linear-gradient(180deg, var(--dk-purple) 0%, #050505 100%);
}

/* ---- Light theme tokens ------------------------------------------------ */
[data-bs-theme="light"] {
    --bs-body-bg: #f6f5fa;
    --bs-body-color: #2b2233;
    --bs-secondary-bg: #eeecf5;
    --bs-tertiary-bg: #f0eef8;
    --bs-border-color: #e2ddec;
    --bs-emphasis-color: var(--dk-purple);
    --bs-link-color: var(--dk-teal-dark);
    --bs-link-hover-color: var(--dk-purple);
    --bs-focus-ring-color: color-mix(in srgb, var(--dk-teal) 35%, transparent);
    --dk-field-bg: #eceaf5;
    color-scheme: light;
}

/* ---- Dark theme tokens -------------------------------------------------- */
[data-bs-theme="dark"] {
    --bs-body-bg: #150a26;
    --bs-body-color: #ece7f5;
    --bs-secondary-bg: #21123b;
    --bs-tertiary-bg: #1c0f33;
    --bs-border-color: #34204f;
    --bs-emphasis-color: #ffffff;
    --bs-link-color: var(--dk-teal);
    --bs-link-hover-color: var(--dk-teal);
    --bs-focus-ring-color: color-mix(in srgb, var(--dk-teal) 40%, transparent);
    --dk-field-bg: #271a44;
    color-scheme: dark;
}

body {
    font-family: var(--dk-font-body);
}

/* Bootstrap's own `a` rule renders via a hardcoded --bs-link-color-rgb triple
   (not --bs-link-color itself), so it never picked up theme/accent changes —
   overridden directly here instead of trying to keep an RGB shadow variable
   in sync with --bs-link-color by hand for three color themes. */
a { color: var(--bs-link-color); }
a:hover { color: var(--bs-link-hover-color); }

h1, h2, h3, h4, h5, h6 {
    font-family: var(--dk-font-heading);
    font-weight: 600;
    letter-spacing: -0.01em;
}

[data-bs-theme="light"] h1, [data-bs-theme="light"] h2, [data-bs-theme="light"] h3 {
    color: var(--dk-purple);
}

/* ---- Brand "primary" recolor (teal) ------------------------------------
   Bootstrap 5.3 bakes fixed hex values into .btn-primary/.text-bg-primary/etc,
   so retinting the brand accent means overriding those rules directly rather
   than relying on the --bs-primary custom property alone. */
[data-bs-theme="light"] .btn-primary {
    --bs-btn-bg: var(--dk-teal-dark);
    --bs-btn-border-color: var(--dk-teal-dark);
    --bs-btn-hover-bg: #007578;
    --bs-btn-hover-border-color: #007578;
    --bs-btn-active-bg: #006265;
    --bs-btn-active-border-color: #006265;
    --bs-btn-disabled-bg: var(--dk-teal-dark);
    --bs-btn-disabled-border-color: var(--dk-teal-dark);
}
[data-bs-theme="dark"] .btn-primary {
    --bs-btn-bg: var(--dk-teal);
    --bs-btn-border-color: var(--dk-teal);
    --bs-btn-color: #0b2c2d;
    --bs-btn-hover-bg: #58e0e2;
    --bs-btn-hover-border-color: #58e0e2;
    --bs-btn-hover-color: #0b2c2d;
    --bs-btn-active-bg: #58e0e2;
    --bs-btn-active-border-color: #58e0e2;
    --bs-btn-active-color: #0b2c2d;
}
[data-bs-theme="light"] .btn-outline-primary {
    --bs-btn-color: var(--dk-teal-dark);
    --bs-btn-border-color: var(--dk-teal-dark);
    --bs-btn-hover-bg: var(--dk-teal-dark);
    --bs-btn-hover-border-color: var(--dk-teal-dark);
    --bs-btn-active-bg: var(--dk-teal-dark);
    --bs-btn-active-border-color: var(--dk-teal-dark);
}
[data-bs-theme="dark"] .btn-outline-primary {
    --bs-btn-color: var(--dk-teal);
    --bs-btn-border-color: var(--dk-teal);
    --bs-btn-hover-bg: var(--dk-teal);
    --bs-btn-hover-border-color: var(--dk-teal);
    --bs-btn-hover-color: #0b2c2d;
    --bs-btn-active-bg: var(--dk-teal);
    --bs-btn-active-color: #0b2c2d;
}
[data-bs-theme="light"] .text-primary { color: var(--dk-teal-dark) !important; }
[data-bs-theme="dark"] .text-primary { color: var(--dk-teal) !important; }
[data-bs-theme="light"] .text-bg-primary, [data-bs-theme="light"] .bg-primary {
    background-color: var(--dk-teal-dark) !important;
    color: #fff !important;
}
[data-bs-theme="dark"] .text-bg-primary, [data-bs-theme="dark"] .bg-primary {
    background-color: var(--dk-teal) !important;
    color: #0b2c2d !important;
}
[data-bs-theme="light"] .border-primary { border-color: var(--dk-teal-dark) !important; }
[data-bs-theme="dark"] .border-primary { border-color: var(--dk-teal) !important; }

/* ---- Extra badge color: "pink" (workflow status "À recetter", priority
   "Critique") — not one of Bootstrap's default semantic colors. ---- */
.text-bg-pink { background-color: #d6336c !important; color: #fff !important; }
.text-pink { color: #d6336c !important; }
.border-pink { border-color: #d6336c !important; }

/* ---- Form fields: give inputs/selects/checkboxes their own visible surface ----
   Bootstrap 5.3 defaults form-control/form-select/form-check backgrounds to
   var(--bs-body-bg) — the *same* color as the page canvas here in both themes,
   so fields were nearly invisible against cards/panels. --dk-field-bg is a
   step lighter (light theme) / lighter-than-body (dark theme) for contrast. */
.form-control, .form-select {
    background-color: var(--dk-field-bg);
    border-color: var(--bs-border-color);
}
.form-control:focus, .form-select:focus {
    background-color: var(--dk-field-bg);
    border-color: var(--dk-teal-dark);
}
[data-bs-theme="dark"] .form-control:focus, [data-bs-theme="dark"] .form-select:focus {
    border-color: var(--dk-teal);
}
.form-control:disabled, .form-select:disabled {
    background-color: var(--bs-secondary-bg);
}
.form-check-input {
    background-color: var(--dk-field-bg);
    border-color: var(--bs-border-color);
}
.form-check-input:checked {
    background-color: var(--dk-teal-dark);
    border-color: var(--dk-teal-dark);
}
[data-bs-theme="dark"] .form-check-input:checked {
    background-color: var(--dk-teal);
    border-color: var(--dk-teal);
}
.form-check-input:focus {
    border-color: var(--dk-teal-dark);
    box-shadow: 0 0 0 0.25rem var(--bs-focus-ring-color);
}
[data-bs-theme="dark"] .form-check-input:focus {
    border-color: var(--dk-teal);
}

/* ---- Surfaces: cards, tables, list groups ------------------------------ */
.card {
    border-radius: var(--dk-radius);
    border: 1px solid var(--bs-border-color);
    box-shadow: var(--dk-shadow);
}
/* Bootstrap's card background defaults to var(--bs-body-bg) — same as the
   page canvas, so cards would otherwise be indistinguishable except for the
   border. Give them a touch of contrast in both themes. */
[data-bs-theme="light"] .card { background-color: #ffffff; }
[data-bs-theme="dark"] .card { background-color: var(--bs-tertiary-bg); }

.card:hover {
    box-shadow: var(--dk-shadow-lg);
}

.table {
    --bs-table-border-color: var(--bs-border-color);
}

.list-group-item {
    border-color: var(--bs-border-color);
}

.badge {
    font-weight: 600;
    letter-spacing: 0.01em;
    border-radius: 50rem;
    padding-inline: 0.65em;
}

.btn {
    border-radius: 0.6rem;
    font-weight: 500;
}

.btn-sm {
    border-radius: 0.5rem;
}

.alert {
    border-radius: var(--dk-radius-sm);
    border: none;
}

/* ---- Sidebar --------------------------------------------------------------
   Kept a fixed ink-purple bar in both themes so Maya's identity stays
   recognizable regardless of the reader's chosen theme; only the page
   canvas switches light/dark.

   Structure: body.has-sidebar is the flex row (sidebar + content). The
   sidebar's own width is driven by body.sidebar-collapsed, persisted in
   localStorage by initSidebarToggle() in app.js, exactly like the existing
   light/dark toggle already was. Below the lg breakpoint the sidebar instead
   becomes a fixed off-canvas drawer (data-sidebar-open/-close in app.js). */
:root {
    --sidebar-width: 15.5rem;
    --sidebar-width-collapsed: 4.5rem;
}

body.has-sidebar {
    display: flex;
    align-items: stretch;
    min-height: 100vh;
}

.app-content {
    flex: 1 1 auto;
    min-width: 0;
    padding: 1rem 1.5rem 2rem;
}

/* ---- Ticket detail: title bar stays visible while scrolling — easier to
   jump back up to Statut/Assigné/Modifier from deep in a long comment
   thread, and keeps the ticket ref always in view for tracking. */
.ticket-header-sticky {
    position: sticky;
    top: 0;
    z-index: 5;
    background: var(--bs-body-bg);
    padding: 0.75rem 0 0.5rem;
    margin-left: -1.5rem;
    margin-right: -1.5rem;
    padding-left: 1.5rem;
    padding-right: 1.5rem;
    border-bottom: 1px solid var(--bs-border-color);
}

/* ---- Ticket tabs — browser-style strip of recently-viewed tickets -------- */
.ticket-tabs {
    display: flex;
    align-items: stretch;
    gap: 0.25rem;
    overflow-x: auto;
    margin: -1rem -1.5rem 1rem;
    padding: 0.5rem 1.5rem 0;
    border-bottom: 1px solid var(--bs-border-color);
}
.ticket-tab {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    flex-shrink: 0;
    max-width: 16rem;
    padding: 0.4rem 0.5rem 0.4rem 0.75rem;
    border-radius: var(--dk-radius-sm) var(--dk-radius-sm) 0 0;
    background: var(--bs-tertiary-bg);
    color: var(--bs-secondary-color);
    text-decoration: none;
    font-size: 0.82rem;
    border: 1px solid transparent;
    border-bottom: none;
}
.ticket-tab:hover { color: var(--bs-emphasis-color); background: var(--bs-secondary-bg); }
.ticket-tab.active {
    background: var(--bs-body-bg);
    color: var(--bs-emphasis-color);
    border-color: var(--bs-border-color);
    position: relative;
}
.ticket-tab.active::after {
    content: "";
    position: absolute;
    left: 0; right: 0; bottom: -1px;
    height: 1px;
    background: var(--bs-body-bg);
}
.ticket-tab-key { font-weight: 600; flex-shrink: 0; }
.ticket-tab-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ticket-tab-close {
    flex-shrink: 0;
    border: none;
    background: none;
    color: inherit;
    opacity: 0.6;
    line-height: 1;
    padding: 0.1rem;
    border-radius: 50%;
}
.ticket-tab-close:hover { opacity: 1; background: rgba(128, 128, 128, 0.2); }

.app-sidebar {
    flex: 0 0 var(--sidebar-width);
    width: var(--sidebar-width);
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    padding: 0.9rem 0.6rem;
    background: linear-gradient(180deg, var(--dk-purple) 0%, #200d3d 100%);
    color: rgba(255, 255, 255, 0.85);
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
    overflow-x: hidden;
    transition: flex-basis .18s ease, width .18s ease;
}

body.sidebar-collapsed .app-sidebar {
    flex-basis: var(--sidebar-width-collapsed);
    width: var(--sidebar-width-collapsed);
}

body.sidebar-collapsed .sidebar-label,
body.sidebar-collapsed .sidebar-section,
body.sidebar-collapsed .sidebar-badge {
    display: none;
}

body.sidebar-collapsed .sidebar-collapse-icon {
    transform: rotate(180deg);
}

.sidebar-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.3rem 0.5rem 0.7rem;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: #fff;
    font-family: var(--dk-font-heading);
    font-weight: 700;
    letter-spacing: -0.01em;
    text-decoration: none;
}

.sidebar-brand-mark svg { height: 1.5rem; width: auto; }
.sidebar-mobile-close { background: none; border: none; color: #fff; font-size: 1.1rem; }

.sidebar-top-bell {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.9rem;
    height: 1.9rem;
    border-radius: 50%;
    color: rgba(255, 255, 255, 0.85);
    flex-shrink: 0;
}
.sidebar-top-bell:hover { background: rgba(255, 255, 255, 0.08); color: #fff; }
.sidebar-top-bell-badge {
    position: absolute;
    top: -0.2rem;
    right: -0.2rem;
    font-size: 0.6rem;
    padding: 0.15rem 0.35rem;
    border-radius: 50rem;
}
body.sidebar-collapsed .sidebar-top { flex-wrap: wrap; justify-content: center; gap: 0.4rem; }

.sidebar-search {
    position: relative;
    margin: 0 0.5rem 0.8rem;
}
.sidebar-search .bi-search {
    position: absolute;
    left: 0.7rem;
    top: 50%;
    transform: translateY(-50%);
    color: rgba(255, 255, 255, 0.55);
    font-size: 0.85rem;
}
.sidebar-search input {
    width: 100%;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 50rem;
    color: #fff;
    padding: 0.4rem 0.75rem 0.4rem 2rem;
    font-size: 0.85rem;
}
.sidebar-search input::placeholder { color: rgba(255, 255, 255, 0.5); }
.sidebar-search input:focus {
    outline: none;
    border-color: var(--dk-teal);
    background: rgba(255, 255, 255, 0.12);
}
body.sidebar-collapsed .sidebar-search { display: none; }

.sidebar-section { padding: 0.6rem 0.5rem 0.2rem; }
.sidebar-section-title {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: rgba(255, 255, 255, 0.45);
    padding: 0 0.25rem 0.35rem;
}

.sidebar-recent-ticket {
    display: block;
    padding: 0.3rem 0.5rem;
    border-radius: var(--dk-radius-sm);
    color: rgba(255, 255, 255, 0.75);
    text-decoration: none;
    font-size: 0.8rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.sidebar-recent-ticket:hover { background: rgba(255, 255, 255, 0.08); color: #fff; }
.sidebar-recent-key { font-weight: 600; margin-right: 0.35rem; }
.sidebar-recent-title { color: rgba(255, 255, 255, 0.55); }

.sidebar-nav { display: flex; flex-direction: column; gap: 0.1rem; }

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 0.7rem;
    padding: 0.5rem 0.6rem;
    border-radius: var(--dk-radius-sm);
    color: rgba(255, 255, 255, 0.78);
    text-decoration: none;
    font-weight: 500;
    font-size: 0.9rem;
    white-space: nowrap;
}
.sidebar-link i { font-size: 1.05rem; width: 1.2rem; text-align: center; flex-shrink: 0; }
.sidebar-link:hover { background: rgba(255, 255, 255, 0.08); color: #fff; }
.sidebar-link.active { background: rgba(255, 255, 255, 0.12); color: #fff; }

.sidebar-badge { margin-left: auto; }

.sidebar-spacer { flex: 1 1 auto; }

.sidebar-time-badge i { color: var(--bs-success, #2fb380) !important; }

.sidebar-user { margin-top: 0.2rem; }
.sidebar-user .dropdown-menu { min-width: 12rem; }

[data-theme-toggle] .bi-sun-fill { display: none; }
[data-bs-theme="dark"] [data-theme-toggle] .bi-sun-fill { display: inline; }
[data-bs-theme="dark"] [data-theme-toggle] .bi-moon-stars-fill { display: none; }

.sidebar-mobile-toggle {
    display: none;
    position: fixed;
    top: 0.75rem;
    left: 0.75rem;
    z-index: 1040;
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 50%;
    border: none;
    background: var(--dk-purple);
    color: #fff;
    box-shadow: var(--dk-shadow);
}
.sidebar-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    z-index: 1035;
}

@media (max-width: 991.98px) {
    body.has-sidebar { display: block; }
    .app-content { padding: 3.5rem 1rem 2rem; }
    .ticket-tabs { margin: -0.5rem -1rem 1rem; padding: 0.5rem 1rem 0; }
    .app-sidebar {
        position: fixed;
        top: 0;
        left: 0;
        z-index: 1045;
        width: var(--sidebar-width);
        flex-basis: var(--sidebar-width);
        transform: translateX(-100%);
        transition: transform .2s ease;
    }
    body.sidebar-mobile-open .app-sidebar { transform: translateX(0); }
    body.sidebar-mobile-open .sidebar-backdrop { display: block; }
    .sidebar-mobile-toggle { display: inline-flex; align-items: center; justify-content: center; }
    body.sidebar-mobile-open .sidebar-mobile-toggle { display: none; }
    /* Collapsed state only applies on desktop — mobile is always full-width when open. */
    body.sidebar-collapsed .app-sidebar { width: var(--sidebar-width); flex-basis: var(--sidebar-width); }
    body.sidebar-collapsed .sidebar-label,
    body.sidebar-collapsed .sidebar-section,
    body.sidebar-collapsed .sidebar-search,
    body.sidebar-collapsed .sidebar-badge { display: revert; }
    body.sidebar-collapsed .sidebar-collapse-icon { transform: none; }
    [data-sidebar-toggle] { display: none; }
}
@media (min-width: 992px) {
    .sidebar-mobile-close, .sidebar-backdrop, .sidebar-mobile-toggle { display: none !important; }
}

/* ---- Avatars ------------------------------------------------------------ */
.avatar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    border-radius: 50%;
    background: var(--dk-purple);
    color: #fff;
    font-family: var(--dk-font-heading);
    font-weight: 600;
    font-size: 0.8rem;
    flex-shrink: 0;
}
[data-bs-theme="dark"] .avatar {
    background: var(--dk-teal);
    color: #0b2c2d;
}
.avatar-sm { width: 1.5rem; height: 1.5rem; font-size: 0.65rem; }

/* ---- Stat tiles (dashboards) -------------------------------------------- */
.stat-tile {
    border-radius: var(--dk-radius);
    border: 1px solid var(--bs-border-color);
    background: var(--bs-tertiary-bg);
    padding: 0.9rem 1.1rem;
    min-width: 140px;
}
.stat-tile .stat-value {
    font-family: var(--dk-font-heading);
    font-size: 1.75rem;
    font-weight: 700;
    line-height: 1;
}
.stat-tile .stat-label {
    font-size: 0.8rem;
    color: var(--bs-secondary-color);
}

/* ---- Hero / greeting banner --------------------------------------------- */
.hero-banner {
    background: linear-gradient(120deg, var(--dk-purple) 0%, var(--dk-indigo) 100%);
    color: #fff;
    border-radius: var(--dk-radius-lg);
    padding: 1.75rem 2rem;
    margin-bottom: 1.5rem;
}
.hero-banner h1 { color: #fff; }
.hero-banner .text-muted { color: rgba(255,255,255,0.7) !important; }

/* ---- Dashboard news slider ---------------------------------------------- */
.hero-banner-compact {
    background: linear-gradient(120deg, var(--dk-purple) 0%, var(--dk-indigo) 100%);
    color: #fff;
    border-radius: var(--dk-radius-lg);
    padding: 0.85rem 1.25rem;
    margin-bottom: 1rem;
}
.hero-banner-compact .text-muted { color: rgba(255,255,255,0.7) !important; }

.news-carousel .carousel-item {
    border: 1px solid var(--bs-border-color);
    border-left: 4px solid var(--dk-teal-dark);
    border-radius: var(--dk-radius-lg);
    overflow: hidden;
}
.news-slide {
    display: flex;
    min-height: 160px;
    background: var(--bs-tertiary-bg);
}
.news-slide-img {
    width: 220px;
    flex-shrink: 0;
    object-fit: cover;
}
.news-slide-body {
    padding: 1.25rem 1.5rem;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 0.4rem;
}
@media (max-width: 767.98px) {
    .news-slide-img { display: none; }
}
.news-carousel .carousel-control-prev-icon,
.news-carousel .carousel-control-next-icon {
    background-color: rgba(0, 0, 0, 0.35);
    border-radius: 50%;
    padding: 1.1rem;
    background-size: 50%;
}
.news-carousel .carousel-indicators [data-bs-target] { opacity: 0.4; }
.news-carousel .carousel-indicators [data-bs-target].active { opacity: 1; }

/* ---- Agile board -------------------------------------------------------- */
.board-column {
    min-width: 280px;
    background: var(--bs-tertiary-bg);
    border: 1px solid var(--bs-border-color);
    border-top: 3px solid var(--dk-teal-dark);
    border-radius: var(--dk-radius);
    padding: 0.75rem;
}
[data-bs-theme="dark"] .board-column {
    border-top-color: var(--dk-teal);
}

.board-columns {
    display: flex;
    gap: 0.9rem;
    overflow-x: auto;
    padding-bottom: 1rem;
}

/* ---- Dashboard due-date calendar ----------------------------------------- */
.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 1px;
    background: var(--bs-border-color);
    border: 1px solid var(--bs-border-color);
    border-radius: var(--dk-radius-sm);
    overflow: hidden;
}
.calendar-dow {
    background: var(--bs-tertiary-bg);
    text-align: center;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--bs-secondary-color);
    padding: 0.4rem 0;
}
.calendar-day {
    background: var(--bs-body-bg);
    min-height: 5.5rem;
    /* A grid item's default min-width:auto lets a long chip's content force this whole
       column wider than its 1fr share — min-width:0 restores equal-width columns and lets
       the chip's own overflow:hidden (below) actually truncate instead of stretching the
       track. Deliberately NOT overflow:hidden here too: a chip's dropdown menu needs to
       render outside this cell's bounds, and this element being a plain block (not the
       overflow:hidden one) is what lets it do that. */
    min-width: 0;
    padding: 0.35rem;
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}
.calendar-day-empty { background: var(--bs-tertiary-bg); }
.calendar-day-number { font-size: 0.78rem; color: var(--bs-secondary-color); }
.calendar-day-today .calendar-day-number {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.3rem;
    height: 1.3rem;
    border-radius: 50%;
    background: var(--dk-teal);
    color: #0b2c2d;
    font-weight: 700;
}
.calendar-ticket-chip {
    display: block;
    max-width: 100%;
    text-align: left;
    font-weight: 500;
    text-decoration: none;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.calendar-ticket-chip:hover { text-decoration: underline; }
.calendar-ticket-more { font-size: 0.68rem; color: var(--bs-secondary-color); }

/* A Daily/rendez-vous chip that opens a dropdown of actions (join, add to
   calendar, participate, delete) instead of cramming several tiny inline
   icon-links onto one badge — each action gets a full-width, easy-to-tap row. */
.calendar-chip-dropdown { max-width: 100%; }
.calendar-chip-dropdown > .calendar-ticket-chip {
    width: 100%;
    cursor: pointer;
}
.calendar-chip-dropdown .dropdown-menu { min-width: 12rem; font-size: 0.85rem; }
.calendar-chip-dropdown .dropdown-item i { width: 1.1rem; text-align: center; }

@media (max-width: 767.98px) {
    .calendar-dow:nth-child(n+6), .calendar-day-number { font-size: 0.68rem; }
    .calendar-day { min-height: 3.5rem; padding: 0.2rem; }
}

.ticket-card {
    cursor: grab;
    border-radius: var(--dk-radius-sm);
    transition: transform .1s ease, box-shadow .1s ease;
}

.ticket-card:hover {
    transform: translateY(-1px);
}

.ticket-card.dragging {
    opacity: 0.4;
}

.board-column.drag-over {
    outline: 2px dashed var(--dk-teal-dark);
    outline-offset: 2px;
}
[data-bs-theme="dark"] .board-column.drag-over {
    outline-color: var(--dk-teal);
}

/* ---- Login page ---------------------------------------------------------*/
.auth-shell {
    min-height: 100vh;
    display: flex;
}
.auth-brand-panel {
    background: linear-gradient(160deg, var(--dk-purple) 0%, var(--dk-indigo) 55%, var(--dk-teal-dark) 130%);
    color: #fff;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 3rem;
}
.auth-brand-panel h1 {
    color: #fff;
    font-size: 2.25rem;
}
.auth-form-panel {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
}

/* ---- Tiptap rich-text editor (description / comments) -------------------
   Replaces Trix — see assets-src/rich-editor-tiptap.js. .trix-content below
   is intentionally kept as-is: it styles read-only rendering of stored HTML
   (ticket/comment/article/news display) regardless of which editor produced
   it, and is also applied to the live editing surface itself (see
   views/partials/_rich_editor.php's mount <div>) so list/quote/code/image
   styling doesn't have to be duplicated between the two. */
.rich-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.15rem;
    background: var(--bs-tertiary-bg);
    border: 1px solid var(--bs-border-color);
    border-bottom: none;
    border-radius: var(--dk-radius-sm) var(--dk-radius-sm) 0 0;
    padding: 0.4rem 0.5rem;
}
.rich-toolbar-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    padding: 0;
    background: none;
    border: 1px solid transparent;
    border-radius: var(--dk-radius-sm);
    color: var(--bs-body-color);
    cursor: pointer;
}
.rich-toolbar-button:hover {
    background: var(--bs-secondary-bg);
}
.rich-toolbar-button.active {
    background: var(--dk-teal-dark);
    color: #fff;
}
[data-bs-theme="dark"] .rich-toolbar-button.active {
    background: var(--dk-teal);
    color: #0b2c2d;
}
.rich-toolbar-sep {
    width: 1px;
    align-self: stretch;
    background: var(--bs-border-color);
    margin: 0.2rem 0.15rem;
}
.trix-color-group {
    position: relative;
}
/* The [hidden] guard matters: without it, this rule's own `display: grid`
   (an author-stylesheet rule) wins over the UA stylesheet's `[hidden] {
   display: none }`, so the menu would render open — as a full-width bar
   pushed into the toolbar's normal flow — the instant it's created, and
   stay that way regardless of the `hidden` attribute JS toggles. */
.trix-color-menu[hidden] {
    display: none;
}
.trix-color-menu {
    position: absolute;
    top: 100%;
    left: 0;
    z-index: 20;
    display: grid;
    grid-template-columns: repeat(10, 1fr);
    gap: 0.25rem;
    padding: 0.5rem;
    width: 15.5rem;
    background: var(--bs-body-bg);
    border: 1px solid var(--bs-border-color);
    border-radius: var(--dk-radius-sm);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}
.trix-color-menu-none {
    grid-column: 1 / -1;
    display: flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.2rem 0.3rem;
    background: none;
    border: 1px solid transparent;
    border-radius: var(--dk-radius-sm);
    color: var(--bs-body-color);
    font-size: 0.78rem;
    cursor: pointer;
}
.trix-color-menu-none:hover {
    background: var(--bs-tertiary-bg);
}
.trix-color-swatch {
    width: 1.3rem;
    height: 1.3rem;
    padding: 0;
    border: 1px solid rgba(0, 0, 0, 0.25);
    border-radius: 3px;
    cursor: pointer;
}
.trix-color-swatch:hover {
    transform: scale(1.15);
}
.trix-color-custom {
    grid-column: 1 / -1;
    display: flex;
    align-items: center;
    gap: 0.4rem;
    margin-top: 0.15rem;
    padding-top: 0.4rem;
    border-top: 1px solid var(--bs-border-color);
}
.trix-color-custom input[type="color"] {
    width: 1.3rem;
    height: 1.3rem;
    padding: 0;
    border: 1px solid rgba(0, 0, 0, 0.25);
    border-radius: 3px;
    cursor: pointer;
}
.trix-color-custom span {
    font-size: 0.78rem;
    color: var(--bs-body-color);
}
.tiptap-content {
    background: var(--dk-field-bg);
    color: var(--bs-body-color);
    border: 1px solid var(--bs-border-color) !important;
    border-radius: 0 0 var(--dk-radius-sm) var(--dk-radius-sm) !important;
}
/* Tiptap mounts its actual contenteditable surface as a nested .ProseMirror
   element inside the [data-tiptap-editor] div, rather than making that div
   itself editable — min-height/outline-reset belong on the inner element. */
.tiptap-content .ProseMirror {
    min-height: 8rem;
    outline: none;
}
.tiptap-content .ProseMirror p.is-editor-empty:first-child::before {
    content: attr(data-placeholder);
    color: var(--bs-secondary-color);
    float: left;
    height: 0;
    pointer-events: none;
}
.tiptap-content:focus-within {
    box-shadow: none;
    border-color: var(--dk-teal-dark) !important;
}
[data-bs-theme="dark"] .tiptap-content:focus-within {
    border-color: var(--dk-teal) !important;
}
/* Read-only rendering of saved content (ticket description, comments) —
   also applied to the live editing surface itself (see comment above), so
   these list/quote/code/image styles cover both. */
.trix-content img { max-width: 100%; border-radius: var(--dk-radius-sm); }
.trix-content ul, .trix-content ol { padding-left: 1.5rem; }
.trix-content blockquote {
    border-left: 3px solid var(--bs-border-color);
    padding-left: 1rem;
    color: var(--bs-secondary-color);
    margin-left: 0;
}
.trix-content pre {
    background: var(--bs-tertiary-bg);
    padding: 0.75rem;
    border-radius: var(--dk-radius-sm);
    overflow-x: auto;
}
/* No wrapper <div> around the table (its class would be stripped by
   HtmlSanitizer anyway — the bare `div` entry allows no attributes): setting
   display:block + overflow-x:auto directly on <table> makes the table's own
   box independently horizontally scrollable on narrow screens, while its
   row/cell children keep the UA stylesheet's normal table layout — the same
   technique GitHub's own Markdown rendering uses for wide tables. */
.trix-content table {
    display: block;
    max-width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border-collapse: collapse;
    width: 100%;
    margin: 0.75rem 0 1rem;
}
.trix-content th,
.trix-content td {
    border: 1px solid var(--bs-border-color);
    padding: 0.5rem 0.75rem;
    text-align: left;
    vertical-align: top;
}
.trix-content thead th,
.trix-content tr:first-child th {
    background: var(--bs-tertiary-bg);
    font-weight: 600;
}
.rich-toolbar-button:disabled {
    opacity: 0.35;
    cursor: not-allowed;
}
/* ---- Phase 3: séparateur, checklists, mode Markdown/Aperçu --------------- */
.trix-content hr {
    border: none;
    border-top: 1px solid var(--bs-border-color);
    margin: 1rem 0;
}
.trix-content ul[data-type="taskList"] {
    padding-left: 0;
    list-style: none;
}
.trix-content ul[data-type="taskList"] li {
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
}
.trix-content ul[data-type="taskList"] li > label {
    margin-top: 0.2rem;
}
.trix-content ul[data-type="taskList"] p {
    margin-bottom: 0;
}
.trix-content ul[data-type="taskList"] input[type="checkbox"] {
    margin-top: 0.3rem;
}
.trix-content li[data-checked="true"] > div {
    color: var(--bs-secondary-color);
    text-decoration: line-through;
}
/* The Markdown-source textarea reuses .tiptap-content's field chrome
   (border/background/radius) so switching modes doesn't visually jump. */
textarea.tiptap-content {
    width: 100%;
    font-family: var(--bs-font-monospace, monospace);
    font-size: 0.85rem;
    padding: 0.75rem;
    resize: vertical;
}
.rich-editor-preview {
    min-height: 8rem;
    padding: 0.75rem;
}
.rich-toolbar-mode-group {
    display: inline-flex;
    align-items: center;
}
/* Landed on via a mention email/notification's #comment-{id} deep link. */
.card[id^="comment-"]:target {
    animation: comment-highlight 2s ease-out;
}
@keyframes comment-highlight {
    from { background-color: #fff3cd; }
    to { background-color: transparent; }
}
.mention-dropdown {
    position: fixed;
    z-index: 2000;
    min-width: 260px;
    max-width: 340px;
    max-height: 260px;
    overflow-y: auto;
}

/* ---- Contextual help "(?)" icon on ticket fields (help_icon() in helpers.php) ---- */
.field-help {
    position: relative;
    display: inline-flex;
    vertical-align: middle;
}
.field-help-trigger {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.1rem;
    height: 1.1rem;
    padding: 0;
    margin-left: 0.25rem;
    background: none;
    border: none;
    color: var(--bs-secondary-color);
    cursor: pointer;
    font-size: 0.85rem;
    line-height: 1;
}
.field-help-trigger:hover,
.field-help-trigger:focus-visible {
    color: var(--dk-teal-dark);
}
[data-bs-theme="dark"] .field-help-trigger:hover,
[data-bs-theme="dark"] .field-help-trigger:focus-visible {
    color: var(--dk-teal);
}
/* The [hidden] guard matters here for the same reason as .trix-color-menu
   above: without it, this rule's own `display: block` would beat the UA
   stylesheet's `[hidden] { display: none }`. */
.field-help-popover[hidden] {
    display: none;
}
.field-help-popover {
    position: absolute;
    top: 100%;
    left: 0;
    z-index: 20;
    display: block;
    width: 17rem;
    max-width: calc(100vw - 2rem);
    margin-top: 0.35rem;
    padding: 0.65rem 0.75rem;
    background: var(--bs-body-bg);
    border: 1px solid var(--bs-border-color);
    border-radius: var(--dk-radius-sm);
    box-shadow: var(--dk-shadow-lg);
    font-size: 0.8rem;
    font-weight: 400;
    line-height: 1.4;
    color: var(--bs-body-color);
}
.field-help-more {
    display: inline-block;
    margin-top: 0.4rem;
    font-size: 0.78rem;
    font-weight: 600;
}
