:root {
    --ink: #1f2a37;
    --muted: #6b7280;
    --line: #dbe3ed;
    --surface: #f5f7fb;
    --panel: #ffffff;
    --brand: #1f7ab8;
    --brand-soft: #e6f2fb;
    --ok: #0c9c6b;
    --font-sans: "Avenir Next", "Avenir", "Segoe UI", sans-serif;
}

* {
    box-sizing: border-box;
}

body.app-body {
    margin: 0;
    font-family: var(--font-sans);
    color: var(--ink);
    background: radial-gradient(circle at top left, #f8fbff 0%, var(--surface) 55%, #edf2f8 100%);
}

.app-shell {
    min-height: 100vh;
    display: grid;
    grid-template-columns: 250px 1fr;
}

.app-sidebar {
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
    background: #fff;
    border-right: 1px solid var(--line);
    padding: 1rem 0.7rem;
}

.app-main {
    min-width: 0;
    padding: 1rem 1.25rem 1.4rem;
}

.app-workspace {
    min-width: 0;
}

.app-workspace.has-right-column {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 320px;
    gap: 1rem;
    align-items: start;
}

.app-content {
    min-width: 0;
}

.app-content > main.container.py-4 {
    width: 100%;
    max-width: none;
    padding: 0 !important;
}

.app-right-column {
    min-width: 0;
    position: sticky;
    top: 1rem;
}

.right-column-stack {
    display: grid;
    gap: 0.85rem;
}

.app-topbar {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1rem;
    padding: 0.2rem 0;
}

.app-topbar-right {
    display: flex;
    justify-content: flex-end;
    align-items: center;
}

.account-dropdown {
    position: relative;
}

.account-dropdown summary {
    list-style: none;
    cursor: pointer;
    color: #3f5268;
    font-weight: 600;
    font-size: 0.9rem;
    padding: 0.4rem 0.7rem;
    border-radius: 999px;
    border-bottom: 1px solid var(--line);
    background: #fff;
}

.account-dropdown summary::-webkit-details-marker {
    display: none;
}

.account-dropdown[open] summary,
.account-dropdown.is-active summary,
.account-dropdown summary:hover {
    background: var(--brand-soft);
    color: var(--brand);
}

.account-menu {
    position: absolute;
    top: calc(100% + 0.45rem);
    right: 0;
    min-width: 220px;
    display: grid;
    gap: 0.2rem;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 12px;
    box-shadow: 0 16px 35px rgba(24, 39, 58, 0.15);
    padding: 0.45rem;
    z-index: 30;
}

.account-menu a,
.account-menu button {
    width: 100%;
    border: 0;
    text-align: left;
    text-decoration: none;
    color: #3f5268;
    font-weight: 600;
    font-size: 0.9rem;
    padding: 0.45rem 0.55rem;
    border-radius: 8px;
}

.account-menu a:hover,
.account-menu a.is-active {
    background: var(--brand-soft);
    color: var(--brand);
}

.nav-logout {
    background: #fef2f2;
    color: #b91c1c;
}

.sidebar-group {
    display: grid;
    gap: 0.25rem;
}

.sidebar-group summary {
    list-style: none;
    cursor: pointer;
    color: #607084;
    padding: 0.7rem 0.7rem;
    border-radius: 12px;
    font-weight: 700;
    font-size: 0.82rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.sidebar-group summary::-webkit-details-marker {
    display: none;
}

.sidebar-group summary::after {
    content: "+";
    float: right;
    font-weight: 700;
}

.sidebar-group[open] summary::after {
    content: "-";
}

.sidebar-group[open] summary,
.sidebar-group summary:hover {
    color: var(--brand);
    background: var(--brand-soft);
}

.sidebar-subnav {
    display: grid;
    gap: 0.2rem;
    padding: 0.2rem 0 0.2rem 0.45rem;
}

.sidebar-subnav a {
    font-size: 0.88rem;
}

.time-quick-inline {
    position: relative;
    width: 100%;
    display: grid;
    gap: 0.55rem;
    overflow: visible;
}

.time-quick-indicators {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
}

.time-quick-indicator {
    margin: 0;
    border: 1px solid #c7d8ea;
    border-radius: 999px;
    padding: 0.28rem 0.62rem;
    font-size: 0.78rem;
    font-weight: 700;
    color: #375676;
    background: #eef5fc;
}

.time-quick-indicator-billable {
    border-color: #b9dbc9;
    background: #ecf9f1;
    color: #1c6f4f;
}

.time-quick-summary {
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 0.55rem 0.65rem;
    background: linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
    display: grid;
    gap: 0.35rem;
}

.time-quick-summary-top {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 0.5rem;
}

.time-quick-summary-spent,
.time-quick-summary-missing,
.time-quick-week-range {
    margin: 0;
}

.time-quick-summary-spent {
    display: flex;
    align-items: baseline;
    gap: 0.3rem;
    color: #374659;
    font-size: 0.83rem;
}

.time-quick-summary-spent strong {
    color: #0d4e7d;
    font-size: 1rem;
}

.time-quick-summary-missing {
    font-size: 0.78rem;
    color: #536579;
    font-weight: 600;
}

.time-quick-progress {
    height: 7px;
    border-radius: 999px;
    background: #e6edf5;
    overflow: hidden;
}

.time-quick-progress span {
    display: block;
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, #1f7ab8 0%, #0c9c6b 100%);
}

.time-quick-week-range {
    color: var(--muted);
    font-size: 0.76rem;
}

.time-quick-panel {
    display: grid;
    position: static;
    z-index: 40;
    width: 100%;
    max-width: 100%;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 14px;
    box-shadow: 0 14px 36px rgba(20, 36, 54, 0.18);
    padding: 0.75rem;
    gap: 0.55rem;
    margin-top: 0.2rem;
}

.time-quick-row {
    display: grid;
    gap: 0.3rem;
}

.time-quick-check {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    margin: 0;
    font-size: 0.82rem;
    color: var(--muted);
}

.time-quick-row label,
.time-quick-label {
    font-size: 0.82rem;
    color: var(--muted);
}

.time-quick-hint {
    margin: 0.1rem 0 0;
    color: #55687d;
    font-size: 0.75rem;
    font-weight: 600;
}

.time-quick-row input:not([type="radio"]),
.time-quick-row select,
.time-quick-row textarea {
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 0.45rem 0.55rem;
    width: 100%;
    min-width: 0;
}

.time-quick-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 0.55rem;
}

.time-quick-date-wrap {
    display: flex;
    gap: 0.35rem;
    min-width: 0;
}

.time-quick-date-wrap input {
    flex: 1;
    min-width: 0;
}

.time-quick-today {
    border: 1px solid var(--line);
    background: #f4f8fc;
    color: #4b5f75;
    border-radius: 10px;
    padding: 0.45rem 0.55rem;
    font-weight: 600;
    white-space: nowrap;
}

.time-quick-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
}

.app-right-column .time-quick-grid {
    grid-template-columns: 1fr;
}

.app-right-column .time-quick-date-wrap {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
}

.time-quick-pill {
    border: 1px solid #ccd8e6;
    background: #f8fbff;
    color: #425469;
    border-radius: 999px;
    padding: 0.24rem 0.6rem;
    font-size: 0.78rem;
    font-weight: 700;
}

.time-quick-pill:hover,
.time-quick-pill:focus-visible {
    border-color: #a7c2df;
    background: #ebf4ff;
    color: #1f5c8b;
}

/* Durée choisie (EVO-36) : pastille active, ou « Autre… » quand la durée personnalisée est dépliée. */
.time-quick-pill.is-active {
    border-color: var(--brand);
    background: var(--brand);
    color: #fff;
}

.time-quick-ticket-message:empty {
    display: none;
}

.time-quick-link {
    justify-self: start;
    border: 0;
    background: none;
    padding: 0;
    color: var(--brand);
    font-size: 0.78rem;
    font-weight: 600;
    text-decoration: underline;
}

.time-quick-row .help-text {
    margin: 0;
    color: var(--muted);
    font-size: 0.75rem;
}

.time-quick-submit {
    border: 0;
    background: var(--ok);
    color: #fff;
    border-radius: 10px;
    font-weight: 700;
    padding: 0.48rem 0.7rem;
}

.time-quick-status {
    margin: 0;
    min-height: 1.1rem;
    color: var(--muted);
    font-size: 0.82rem;
}

.time-quick-status[data-state='success'] {
    color: #0c7c54;
}

.time-quick-status[data-state='error'] {
    color: #b42318;
}

.time-tracker {
    background: rgba(255, 255, 255, 0.96);
    border: 1px solid var(--line);
    border-radius: 999px;
    padding: 0.35rem 0.7rem;
    color: #4f5f73;
    font-size: 0.85rem;
    box-shadow: 0 8px 20px rgba(16, 32, 49, 0.12);
}

.auth-shell {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 1.5rem;
}

.auth-panel {
    width: min(460px, 100%);
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 18px;
    padding: 2rem;
    box-shadow: 0 16px 40px rgba(15, 33, 56, 0.08);
}

.auth-kicker {
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--brand);
    margin: 0 0 0.6rem;
}

.auth-panel h1 {
    margin: 0;
    font-size: 1.7rem;
}

.auth-subtitle {
    color: var(--muted);
    margin: 0.4rem 0 1.2rem;
}

.brand {
    padding: 0.7rem 0.6rem 1rem;
    border-bottom: 1px solid var(--line);
}

.brand h2 {
    margin: 0;
    color: #ba2f19;
    font-size: 1.45rem;
}

.brand p {
    margin: 0.3rem 0 0;
    color: var(--muted);
    font-size: 0.9rem;
}

.sidebar-nav {
    display: grid;
    gap: 0.35rem;
    padding-top: 1rem;
}

.sidebar-nav a {
    text-decoration: none;
    color: #607084;
    padding: 0.75rem 0.7rem;
    border-radius: 999px;
    font-weight: 600;
}

.sidebar-nav a.is-active,
.sidebar-nav a:hover {
    color: var(--brand);
    background: var(--brand-soft);
}

.page {
    width: 100%;
    min-width: 0;
}

.page-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.page-heading {
    min-width: 0;
}

.page-header h1 {
    margin: 0;
    font-size: 1.75rem;
}

.page-header p {
    margin: 0.35rem 0 0;
    color: var(--muted);
}

.page-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 0.5rem;
}

.page-content {
    min-width: 0;
}

.panel {
    border: 1px solid var(--line);
    border-radius: 16px;
    box-shadow: 0 8px 25px rgba(17, 28, 43, 0.05);
}

.panel h3 {
    margin-top: 0;
    margin-bottom: 1rem;
    font-size: 1.2rem;
}

.ticket-list-head {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1rem;
}

/* Refresh next to the views, on the right. */
.ticket-refresh {
    margin-left: auto;
}

.ticket-list-head h3 {
    margin-bottom: 0;
}

.ticket-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
}

.ticket-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: grid;
    gap: 0.85rem;
}

.ticket-list li {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 0.8rem;
    align-items: center;
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 0.8rem;
    transition: border-color 160ms ease, background-color 160ms ease;
}

.ticket-list li.is-selected {
    border-color: var(--brand);
    background: var(--brand-soft);
}

.ticket-select {
    min-width: 0;
    /* Sans place pour le titre, les badges passent à la ligne au lieu de l'écraser (EVO-51). */
    flex: 1 1 16rem;
    border: 0;
    padding: 0;
    color: inherit;
    background: transparent;
    text-align: left;
}

.ticket-select:not(:disabled) {
    cursor: pointer;
}

.ticket-select:disabled {
    cursor: not-allowed;
    opacity: 0.72;
}

.ticket-list strong {
    display: block;
}

.ticket-list span {
    color: var(--muted);
    font-size: 0.9rem;
}

/* Tableau de bord client (EVO-16) : compteurs des demandes et tickets en colonnes. */
.client-counters {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.8rem;
}

.client-counter {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 0.5rem;
    padding: 0.9rem 1rem;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: var(--panel);
    color: var(--ink);
    text-decoration: none;
}

.client-counter:hover {
    border-color: var(--brand);
    background: var(--brand-soft);
}

.client-counter span {
    color: var(--muted);
}

.client-counter strong {
    font-size: 1.5rem;
}

.client-board {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 0.7rem;
}

.client-board-column {
    min-width: 0;
    padding: 0.6rem;
    border-radius: 12px;
    background: var(--surface);
}

.client-board-column h4 {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: 0 0 0.6rem;
    font-size: 0.95rem;
}

.client-ticket {
    display: grid;
    gap: 0.35rem;
    margin-bottom: 0.5rem;
    padding: 0.6rem;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: var(--panel);
    font-size: 0.9rem;
}

.client-ticket-title {
    overflow-wrap: anywhere;
}

.client-ticket-meta {
    color: var(--muted);
    font-size: 0.8rem;
}

/* Échanges d'un ticket, ouverts dans le panneau latéral (EVO-41) */
.client-ticket-thread {
    width: fit-content;
    font-size: 0.82rem;
}

.client-board-empty {
    margin: 0;
    color: var(--muted);
    font-size: 0.85rem;
}

.ticket-filter-empty {
    margin: 0;
    padding: 1rem;
    color: var(--muted);
    text-align: center;
}

/* Panneau des tickets (EVO-33) : vues, filtres, groupes par projet de la vue « À facturer ». */
.ticket-view-intro,
.ticket-hidden-note {
    color: var(--muted);
    font-size: 0.9rem;
}

.ticket-hidden-note {
    margin: 1rem 0 0;
}

/* Blocs de travail de « Mes tickets » (EVO-51), au-dessus de la liste complète. */
.ticket-blocks {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 26rem), 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.ticket-block {
    min-width: 0;
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 0.8rem;
}

/* Colonnes étroites : badges et boutons sous le titre, alignés à gauche. */
.ticket-block .ticket-list li {
    flex-direction: column;
    align-items: stretch;
    gap: 0.5rem;
}

.ticket-block .ticket-select {
    flex: none;
}

.ticket-block .ticket-meta {
    justify-content: flex-start;
}

.ticket-block-today {
    border-color: var(--bs-primary-border-subtle);
}

.ticket-block-overdue {
    border-color: var(--bs-danger-border-subtle);
}

.ticket-block-blocked {
    border-color: var(--bs-warning-border-subtle);
}

.ticket-block-head h4 {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin: 0;
    font-size: 1rem;
}

.ticket-block-head p,
.ticket-block-empty {
    margin: 0.15rem 0 0.6rem;
    color: var(--muted);
    font-size: 0.85rem;
}

.ticket-block-empty {
    margin-bottom: 0;
}

.ticket-block-count {
    border-radius: 999px;
    padding: 0 0.5rem;
    background: var(--bs-secondary-bg);
    font-size: 0.8rem;
    font-weight: 600;
}

/* Tickets masqués d'un bloc (EVO-53) : repliés en fin de bloc, lien et bouton discrets. */
.ticket-block-hidden {
    margin-top: 0.6rem;
}

.ticket-block-hidden summary {
    color: var(--muted);
    font-size: 0.8rem;
    cursor: pointer;
}

.ticket-block-hidden .ticket-list {
    margin-top: 0.5rem;
    opacity: 0.75;
}

.ticket-visibility {
    display: inline;
    margin: 0;
}

.ticket-visibility .btn-link {
    padding-inline: 0.25rem;
    color: var(--muted);
    font-size: 0.8rem;
}

.ticket-all.is-secondary {
    border-top: 1px solid var(--line);
    padding-top: 1rem;
}

.ticket-all-title {
    margin-bottom: 0.75rem;
    font-size: 1rem;
}

/* Tickets mensuels du mois (EVO-44), repliés au-dessus de la liste. */
.monthly-tickets {
    margin-bottom: 1rem;
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 0.6rem 0.8rem;
}

.monthly-tickets summary {
    cursor: pointer;
    font-weight: 600;
}

.monthly-tickets .ticket-list {
    margin-top: 0.6rem;
}

.ticket-filter-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.ticket-filter-bar .form-control,
.ticket-filter-bar .form-select {
    width: auto;
    min-width: 10rem;
    max-width: 100%;
}

.ticket-filter-bar .ticket-filter-query {
    flex: 1 1 14rem;
}

.ticket-group + .ticket-group {
    margin-top: 1.25rem;
}

.ticket-group-head {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    margin-bottom: 0.6rem;
}

.ticket-meta {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    align-items: center;
    gap: 0.5rem;
}

.ticket-list .ticket-time {
    color: inherit;
    font-weight: 600;
    white-space: nowrap;
}

.ticket-list li.is-without-time {
    border-color: var(--bs-warning-border-subtle);
    background: var(--bs-warning-bg-subtle);
}

.ticket-list .ticket-invoice {
    color: inherit;
    text-decoration: none;
}

.ticket-empty {
    display: grid;
    gap: 0.2rem;
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 0.8rem;
}

.ticket-empty span {
    color: var(--muted);
    font-size: 0.9rem;
}

/* Description d'une saisie (EVO-37) : coupée à la ligne plutôt que d'élargir le tableau. */
.time-entry-note {
    max-width: 18rem;
    overflow-wrap: anywhere;
}

.time-entry-ticket {
    max-width: 16rem;
    overflow-wrap: anywhere;
}

.worked-ticket {
    max-width: 28rem;
    overflow-wrap: anywhere;
}

.metrics {
    margin: 0;
    display: grid;
    gap: 0.8rem;
}

.metrics-compact {
    gap: 0.6rem;
}

.metrics div {
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 0.75rem 0.8rem;
    background: #fbfdff;
}

.metrics dt {
    color: var(--muted);
    font-size: 0.9rem;
}

.metrics dd {
    margin: 0.3rem 0 0;
    font-size: 1.2rem;
    font-weight: 700;
}

.weekly-range {
    color: var(--muted);
    font-size: 0.83rem;
}

.weekly-progress {
    height: 9px;
    border-radius: 999px;
    background: #e5edf6;
    overflow: hidden;
}

.weekly-progress-fill {
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, #1f7ab8 0%, #0c9c6b 100%);
}

/* Fil de discussion d'un ticket (EVO-40) : panneau latéral à droite, au-dessus de la page. */
.ticket-thread-panel {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    z-index: 1050;
    display: flex;
    flex-direction: column;
    width: min(34rem, 100vw);
    background: var(--panel);
    border-left: 1px solid var(--line);
    box-shadow: -18px 0 40px rgba(20, 36, 54, 0.18);
}

.ticket-thread-panel-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.8rem 1rem;
    border-bottom: 1px solid var(--line);
    font-weight: 700;
}

.ticket-thread-panel-body {
    display: block;
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
}

.ticket-thread-panel-body[busy] {
    opacity: 0.6;
}

.ticket-thread-notice {
    margin: 0;
    color: var(--muted);
}

.ticket-thread-head {
    margin-bottom: 1rem;
}

.ticket-thread-context {
    margin: 0 0 0.2rem;
    color: var(--muted);
    font-size: 0.82rem;
}

.ticket-thread-title {
    margin: 0 0 0.5rem;
    font-size: 1.15rem;
    overflow-wrap: anywhere;
}

.ticket-thread-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.4rem;
    color: var(--muted);
    font-size: 0.85rem;
}

.ticket-thread-meta .btn {
    margin-left: auto;
}

.ticket-thread-count {
    margin: 1.1rem 0 0.6rem;
    font-size: 0.9rem;
    color: var(--muted);
}

.ticket-thread-messages {
    display: grid;
    gap: 0.6rem;
    margin: 0;
    padding: 0;
    list-style: none;
}

.ticket-thread-entry {
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 0.7rem 0.8rem;
    background: #fff;
}

.ticket-thread-description {
    background: var(--surface);
}

.ticket-thread-entry.is-internal {
    border-color: #f0c36d;
    background: #fffaf0;
}

.ticket-thread-author {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 0.4rem;
    margin: 0 0 0.4rem;
    font-size: 0.85rem;
}

.ticket-thread-author time,
.ticket-thread-edited {
    color: var(--muted);
    font-size: 0.78rem;
}

.ticket-thread-body {
    overflow-wrap: anywhere;
    font-size: 0.92rem;
}

.ticket-thread-body > :last-child {
    margin-bottom: 0;
}

.ticket-thread-body img {
    max-width: 100%;
    height: auto;
}

.ticket-thread-body pre {
    padding: 0.6rem;
    border-radius: 8px;
    background: var(--surface);
    white-space: pre-wrap;
}

.ticket-thread-body table {
    display: block;
    max-width: 100%;
    overflow-x: auto;
}

.time-quick-links {
    display: flex;
    flex-wrap: wrap;
    gap: 0.3rem 0.8rem;
}

@media (max-width: 992px) {
    .app-shell {
        grid-template-columns: 84px 1fr;
    }

    .app-workspace.has-right-column {
        grid-template-columns: 1fr;
    }

    .app-right-column {
        position: static;
        top: auto;
        order: 2;
    }

    .app-sidebar {
        padding: 0.8rem 0.45rem;
    }

    .brand p {
        display: none;
    }

    .brand {
        padding: 0.4rem 0.25rem 0.7rem;
    }

    .brand h2 {
        font-size: 1.1rem;
        text-align: center;
    }

    .sidebar-nav {
        padding-top: 0.55rem;
    }

    .sidebar-nav a {
        display: block;
        padding: 0.55rem 0.35rem;
        border-radius: 10px;
        font-size: 0.72rem;
        line-height: 1.2;
        text-align: center;
    }

    .sidebar-group summary {
        display: block;
        text-align: center;
        font-size: 0.66rem;
        line-height: 1.2;
        padding: 0.55rem 0.3rem;
        letter-spacing: 0.03em;
    }

    .sidebar-group summary::after {
        display: none;
    }

    .sidebar-subnav {
        display: grid;
        gap: 0.2rem;
        padding: 0.2rem 0;
    }

    .sidebar-subnav a {
        font-size: 0.68rem;
        padding: 0.45rem 0.25rem;
    }

    .app-main {
        padding: 0.85rem 0.85rem 1.1rem;
    }

    .app-topbar {
        justify-content: flex-end;
    }

    .account-menu {
        width: 100%;
        right: auto;
        left: 0;
    }

    .time-quick-inline {
        width: 100%;
    }

    .time-quick-head {
        flex-direction: column;
        align-items: stretch;
    }

    .time-tracker {
        text-align: center;
    }

    .time-quick-panel {
        width: auto;
    }
}

@media (max-width: 1100px) {
    .client-board {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 620px) {
    .client-counters {
        grid-template-columns: 1fr;
    }

    .ticket-list-head {
        align-items: stretch;
        flex-direction: column;
    }

    .ticket-list li {
        align-items: stretch;
        flex-direction: column;
    }

    .ticket-meta {
        justify-content: flex-start;
    }

    .ticket-filter-bar .form-select {
        flex: 1 1 100%;
    }

    .page-header {
        align-items: stretch;
        flex-direction: column;
    }

    .page-actions {
        justify-content: flex-start;
    }

    .time-quick-grid {
        grid-template-columns: 1fr;
    }

    .time-quick-date-wrap {
        grid-template-columns: 1fr;
    }
}

/* Sélection d'employés (secrets) */
.assignee-picker {
    border: 0;
    padding-top: 0;
    padding-bottom: 0;
    margin: 0;
    /* Un fieldset vaut min-content par défaut : il déborderait sur mobile. */
    min-width: 0;
}

.assignee-picker-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 10px;
}

.assignee-picker-head .badge {
    flex: 0 0 auto;
}

.assignee-picker-head legend {
    float: none;
    width: auto;
    font-size: 1rem;
}

.assignee-picker-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 10px;
}

.assignee-picker-toolbar input[type="search"] {
    flex: 1 1 220px;
    max-width: 360px;
}

.assignee-picker-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 8px;
}

.assignee-option {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
    padding: 10px 12px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: var(--panel);
    cursor: pointer;
    transition: border-color 0.15s ease, background-color 0.15s ease;
}

.assignee-option[hidden] {
    display: none;
}

.assignee-option:hover {
    border-color: var(--brand);
}

.assignee-option:has(input:checked) {
    border-color: var(--brand);
    background: var(--brand-soft);
}

.assignee-option:has(input:focus-visible) {
    outline: 2px solid var(--brand);
    outline-offset: 2px;
}

.assignee-option.is-locked {
    cursor: default;
    border-color: var(--line);
    background: var(--surface);
}

.assignee-option.is-locked .form-check-input:disabled {
    opacity: 0.6;
}

.assignee-option.is-locked .assignee-avatar {
    background: var(--muted);
    border-color: var(--muted);
    color: #fff;
}

.assignee-option .form-check-input {
    flex: 0 0 auto;
    margin: 0;
}

.assignee-avatar {
    flex: 0 0 32px;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--surface);
    border: 1px solid var(--line);
    color: var(--muted);
    font-size: 0.75rem;
    font-weight: 600;
}

.assignee-option:has(input:checked) .assignee-avatar {
    background: var(--brand);
    border-color: var(--brand);
    color: #fff;
}

.assignee-text {
    display: flex;
    flex-direction: column;
    min-width: 0;
    line-height: 1.25;
}

.assignee-name {
    font-weight: 600;
    color: var(--ink);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.assignee-name .badge {
    font-size: 0.65rem;
    vertical-align: middle;
}

.assignee-email {
    color: var(--muted);
    font-size: 0.85rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Champ référence des lignes de devis et de facture (Tom Select) */
.billing-reference-cell {
    min-width: 9rem;
}

/* Colonnes des lignes de devis : lisibles sans élargir le tableau (défilement horizontal en dernier recours). */
.billing-title-cell {
    min-width: 7rem;
}

.billing-number-cell {
    min-width: 4.5rem;
}

.billing-amount-cell {
    min-width: 6rem;
}

.billing-reference-dropdown {
    min-width: 20rem;
}

/* Icônes SVG en ligne (EVO-31, templates/icons/) : taille du texte, couleur héritée (currentColor). */
.icon {
    width: 1em;
    height: 1em;
    vertical-align: -0.125em;
    flex-shrink: 0;
}

.btn-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.3rem 0.45rem;
    line-height: 1;
}

/* Liste des clients en cartes (EVO-31) */
.client-filter {
    max-width: 32rem;
    margin-bottom: 1rem;
}

/* Autant de colonnes de 16rem que la zone de contenu en contient : une seule sur un téléphone. */
.client-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(16rem, 100%), 1fr));
    gap: 1rem;
}

.client-card {
    border-color: var(--line);
    border-radius: 12px;
}

.client-card-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.5rem;
}

/* Jeton de groupe GitLab : en haut à droite de la carte (EVO-16). */
.client-card-token {
    display: flex;
    flex-shrink: 0;
    flex-direction: column;
    align-items: flex-end;
    gap: 0.25rem;
    text-align: right;
}

.client-card-token-date {
    color: var(--muted);
    font-size: 0.8rem;
    white-space: nowrap;
}

.client-card-title {
    margin: 0;
    font-size: 1.05rem;
    font-weight: 600;
    overflow-wrap: break-word;
}

.client-card-title a {
    color: var(--ink);
    text-decoration: none;
}

.client-card-title a:hover {
    color: var(--brand);
}

.client-card-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.25rem;
    background: transparent;
    border-top-color: var(--line);
}

.client-card-actions form {
    margin: 0;
}

.client-card-meta {
    margin-top: 0.4rem;
    color: var(--muted);
    font-size: 0.85rem;
}

.client-servers {
    display: grid;
    gap: 0.35rem;
    margin: 0.75rem 0 0;
    padding: 0;
    list-style: none;
}

.client-servers li,
.client-server-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.6rem;
}

.client-server-row + .client-server-row {
    margin-top: 0.6rem;
}

.client-server-name {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    font-weight: 500;
}

.server-tools {
    display: inline-flex;
    gap: 0.6rem;
}

.server-tools a,
.client-projects a,
.copy-ip-button {
    color: var(--muted);
}

.server-tools a:hover,
.client-projects a:hover,
.copy-ip-button:hover {
    color: var(--brand);
}

.copy-ip {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
}

.copy-ip-button {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0;
    border: 0;
    font-size: inherit;
    text-decoration: none;
}

.copy-ip-feedback {
    color: var(--ok);
    font-size: 0.8rem;
}

.client-projects {
    margin-top: 0.75rem;
    font-size: 0.9rem;
}

.client-projects summary {
    color: var(--muted);
    cursor: pointer;
}

.client-projects p,
.client-projects ul {
    margin: 0.4rem 0 0;
}

.client-projects ul {
    display: grid;
    gap: 0.25rem;
    padding: 0;
    list-style: none;
}

.client-projects li,
.client-list li {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
}

/* Production et préproduction d'un projet, liens courts de la carte (EVO-31) */
.client-project-links {
    display: inline-flex;
    flex-shrink: 0;
    align-items: center;
    gap: 0.4rem;
}

.client-projects a.client-site-link {
    padding: 0 0.4rem;
    border: 1px solid var(--line);
    border-radius: 999px;
    font-size: 0.75rem;
    line-height: 1.4;
    text-decoration: none;
}

.client-projects a.client-site-link:hover {
    border-color: var(--brand);
}

/* Technologies of a project (EVO-61): logo, label and version, on the client cards and the client page */
.tech-line {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    color: var(--muted);
    font-size: 0.8rem;
    white-space: nowrap;
}

.tech-lines {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem 0.75rem;
    margin-top: 0.25rem;
}

/* Fiche d'un client (EVO-31) */
.client-list {
    display: grid;
    gap: 0.5rem;
    margin: 0;
    padding: 0;
    list-style: none;
}

.client-list form {
    margin: 0;
}

.client-list-link {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    white-space: nowrap;
}

.client-list .client-project {
    display: block;
}

.client-project-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
}

/*
 * Production et préproduction d'un projet : adresse puis serveur, toujours sur deux lignes, pour que les deux
 * s'affichent de la même façon quelle que soit la longueur des adresses. Libellé au-dessus sur un écran étroit.
 */
.client-sites {
    display: grid;
    grid-template-columns: max-content minmax(0, 1fr);
    gap: 0.5rem 0.75rem;
    margin: 0.35rem 0 0;
    font-size: 0.9rem;
}

.client-sites dt {
    color: var(--muted);
    font-weight: 500;
}

.client-sites dd {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.1rem;
    min-width: 0;
    margin: 0;
}

/* Une adresse plus longue que la colonne passe à la ligne plutôt que d'élargir la fiche. */
.client-sites .client-list-link {
    max-width: 100%;
    white-space: normal;
    overflow-wrap: anywhere;
}

.client-site-server {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    color: var(--muted);
    font-size: 0.85rem;
}

@media (max-width: 575.98px) {
    .client-sites {
        grid-template-columns: minmax(0, 1fr);
        row-gap: 0.1rem;
    }

    .client-sites dd + dt {
        margin-top: 0.4rem;
    }
}

/* Service d'un accès sensible : logo du type (EVO-31), nom et libellé. */
.service-type {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    min-width: 0;
}

.service-type-logo {
    flex-shrink: 0;
    color: var(--muted);
    font-size: 1.6rem;
    line-height: 1;
}

.service-type-text {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.service-type-label {
    color: var(--muted);
    font-size: 0.85rem;
}

.client-facts {
    display: grid;
    grid-template-columns: minmax(8rem, auto) 1fr;
    gap: 0.4rem 1rem;
    margin: 0;
}

.client-facts dt {
    color: var(--muted);
    font-weight: 500;
}

.client-facts dd {
    margin: 0;
}

/* Calendrier des temps (EVO-47) */
.timesheet {
    --ts-complete: var(--ok);
    --ts-complete-soft: #e5f6ef;
    --ts-partial: #d98a06;
    --ts-partial-soft: #fdf3e1;
    --ts-empty: #d1434b;
    --ts-empty-soft: #fbe9ea;
    --ts-holiday-soft: #eef0f4;
    --ts-leave: #7c5cc4;
    --ts-leave-soft: #f1ecfb;
    --ts-internal: #0f8b8d;
}

.timesheet-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.timesheet-nav,
.timesheet-switches {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
}

.timesheet-period-label {
    min-width: 9rem;
    margin: 0;
    font-size: 1.2rem;
    text-align: center;
}

.timesheet-kpis {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 0.75rem;
    margin-bottom: 0.75rem;
}

.timesheet-kpi {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 0.75rem 1rem;
    background: var(--panel);
}

.timesheet-kpi-label,
.timesheet-kpi-hint {
    color: var(--muted);
    font-size: 0.8rem;
}

.timesheet-kpi-value {
    font-size: 1.45rem;
    font-variant-numeric: tabular-nums;
}

.timesheet-kpi.is-negative .timesheet-kpi-value {
    color: var(--ts-empty);
}

.timesheet-kpi.is-positive .timesheet-kpi-value {
    color: var(--ts-complete);
}

.timesheet-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    margin: 0 0 1rem;
    padding: 0;
    list-style: none;
    color: var(--muted);
    font-size: 0.8rem;
}

.timesheet-legend li {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
}

.timesheet-swatch,
.timesheet-status-dot {
    display: inline-block;
    width: 0.7rem;
    height: 0.7rem;
    border-radius: 999px;
    background: var(--line);
}

.timesheet-swatch.is-leave {
    background: var(--ts-leave);
}

.timesheet-swatch.is-internal {
    background: var(--ts-internal);
}

.timesheet-swatch.is-complete,
.timesheet-status-dot.is-complete {
    background: var(--ts-complete);
}

.timesheet-swatch.is-partial,
.timesheet-status-dot.is-partial {
    background: var(--ts-partial);
}

.timesheet-swatch.is-empty,
.timesheet-status-dot.is-empty {
    background: var(--ts-empty);
}

.timesheet-status-dot.is-today {
    background: var(--brand);
}

.timesheet-month-head {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    justify-content: space-between;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
}

.timesheet-month-head a {
    color: inherit;
}

.timesheet-month-total {
    color: var(--muted);
    font-variant-numeric: tabular-nums;
}

.timesheet-month-total strong {
    color: var(--ink);
}

.timesheet-grid {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.timesheet-grid-row {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr)) minmax(6.5rem, 0.8fr);
    gap: 0.4rem;
}

.timesheet-grid-head span {
    color: var(--muted);
    font-size: 0.78rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.timesheet-day {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    min-width: 0;
    min-height: 7.5rem;
    border: 1px solid var(--line);
    border-left-width: 4px;
    border-radius: 10px;
    padding: 0.45rem 0.55rem;
    background: var(--panel);
    color: var(--ink);
    text-align: left;
    font: inherit;
    transition: box-shadow 0.15s ease, transform 0.15s ease;
}

.timesheet-grid.is-compact .timesheet-day {
    min-height: 3.6rem;
}

button.timesheet-day:hover,
button.timesheet-day:focus-visible {
    box-shadow: 0 4px 14px rgba(31, 42, 55, 0.12);
    transform: translateY(-1px);
    outline: none;
}

.timesheet-day.is-outside {
    border: 1px dashed transparent;
    background: transparent;
}

.timesheet-day.is-complete {
    border-left-color: var(--ts-complete);
}

.timesheet-day.is-partial {
    border-left-color: var(--ts-partial);
    background: var(--ts-partial-soft);
}

.timesheet-day.is-empty {
    border-left-color: var(--ts-empty);
    background: var(--ts-empty-soft);
}

.timesheet-day.is-leave {
    border-left-color: var(--ts-leave);
    background: var(--ts-leave-soft);
}

.timesheet-day-leave {
    align-self: flex-start;
    border-radius: 999px;
    padding: 0 0.45rem;
    background: var(--ts-leave);
    color: #fff;
    font-size: 0.68rem;
    font-weight: 600;
}

.timesheet-day-entry.is-internal span:first-child,
.timesheet-chip.is-internal {
    color: var(--ts-internal);
}

.timesheet-chip.is-internal {
    border-color: var(--ts-internal);
}

.timesheet-detail-entry.is-internal {
    box-shadow: inset 3px 0 0 var(--ts-internal);
    padding-left: 0.6rem;
}

.timesheet-day.is-holiday {
    background: var(--ts-holiday-soft);
    color: var(--muted);
}

.timesheet-day.is-future {
    color: var(--muted);
    background: transparent;
}

.timesheet-day.is-today {
    border-color: var(--brand);
    border-left-color: var(--brand);
    box-shadow: 0 0 0 1px var(--brand) inset;
}

.timesheet-day-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 0.25rem;
}

.timesheet-day-number {
    font-weight: 700;
}

.timesheet-day-total {
    white-space: nowrap;
    font-size: 0.85rem;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}

.timesheet-day-holiday {
    font-size: 0.72rem;
    text-align: right;
}

.timesheet-day-bar {
    display: block;
    height: 4px;
    border-radius: 999px;
    background: rgba(31, 42, 55, 0.08);
    overflow: hidden;
}

.timesheet-day-bar span {
    display: block;
    height: 100%;
    background: var(--ts-partial);
}

.timesheet-day.is-complete .timesheet-day-bar span {
    background: var(--ts-complete);
}

.timesheet-day.is-today .timesheet-day-bar span {
    background: var(--brand);
}

.timesheet-day-entries {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    min-width: 0;
}

.timesheet-day-entry {
    display: flex;
    justify-content: space-between;
    gap: 0.35rem;
    min-width: 0;
    font-size: 0.75rem;
    line-height: 1.3;
}

.timesheet-day-entry-time {
    flex-shrink: 0;
    color: var(--muted);
    font-variant-numeric: tabular-nums;
}

.timesheet-day-more {
    color: var(--brand);
    font-size: 0.72rem;
    font-weight: 600;
}

.timesheet-week {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 0.1rem;
    border-radius: 10px;
    padding: 0.45rem 0.6rem;
    background: var(--surface);
    font-size: 0.85rem;
    font-variant-numeric: tabular-nums;
}

.timesheet-week span {
    color: var(--muted);
}

.timesheet-week-weekend {
    font-size: 0.72rem;
}

.timesheet-list .timesheet-list-day.is-empty th,
.timesheet-list .timesheet-list-day.is-empty td {
    background: var(--ts-empty-soft);
}

.timesheet-list .timesheet-list-day.is-today th {
    box-shadow: inset 3px 0 0 var(--brand);
}

.timesheet-list .timesheet-list-day.is-future {
    color: var(--muted);
}

.timesheet-list .timesheet-list-week th,
.timesheet-list .timesheet-list-week td {
    border-top-width: 2px;
    background: var(--surface);
    font-size: 0.85rem;
}

.timesheet-chip {
    display: inline-flex;
    gap: 0.35rem;
    max-width: 100%;
    margin: 0.1rem 0.25rem 0.1rem 0;
    border: 1px solid var(--line);
    border-radius: 999px;
    padding: 0.1rem 0.55rem;
    font-size: 0.78rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.timesheet-badge.is-complete {
    background: var(--ts-complete);
}

.timesheet-badge.is-partial {
    background: var(--ts-partial);
}

.timesheet-badge.is-empty {
    background: var(--ts-empty);
}

.timesheet-badge.is-today {
    background: var(--brand);
}

.timesheet-badge.is-leave {
    background: var(--ts-leave);
}

.timesheet-badge.is-holiday,
.timesheet-badge.is-future {
    background: var(--muted);
}

.timesheet-detail-summary {
    font-size: 1.05rem;
}

.timesheet-detail-entry {
    border-top: 1px solid var(--line);
    padding: 0.6rem 0;
}

.timesheet-detail-entry .min-w-0 {
    min-width: 0;
}

.timesheet-detail-summaries {
    margin: 0.35rem 0 0;
    padding-left: 1.1rem;
    color: var(--muted);
    font-size: 0.85rem;
}

@media (max-width: 992px) {
    .timesheet-kpis {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .timesheet-day {
        min-height: 4rem;
    }

    .timesheet-day-entries {
        display: none;
    }
}

@media (max-width: 620px) {
    .timesheet-grid-row {
        grid-template-columns: repeat(5, minmax(0, 1fr));
    }

    .timesheet-week {
        grid-column: 1 / -1;
        flex-direction: row;
        flex-wrap: wrap;
        gap: 0.35rem;
    }

    .timesheet-grid-head > span:last-child {
        display: none;
    }

    .timesheet-day-head {
        flex-direction: column;
        align-items: flex-start;
    }

    .timesheet-day {
        padding: 0.35rem;
    }

    .timesheet-day-total {
        font-size: 0.72rem;
    }

    .timesheet-day-holiday {
        display: none;
    }
}

/* Réponse sous le fil d'un ticket (EVO-40, lot B) */
.ticket-thread-reply {
    margin-top: 1rem;
    border-top: 1px solid var(--line);
    padding-top: 0.9rem;
}

.ticket-thread-reply .form-label {
    font-weight: 600;
}

.ticket-thread-reply .form-text {
    font-size: 0.78rem;
}

.ticket-thread-files {
    margin: 0 0 0.75rem;
    font-size: 0.85rem;
}

.ticket-thread-files > summary {
    width: fit-content;
    color: var(--muted);
    cursor: pointer;
}

.ticket-thread-files[open] > summary {
    margin-bottom: 0.4rem;
}

/* Temps à facturer d'un ticket, dans le panneau des échanges (EVO-48) */
.ticket-billable {
    margin: 0 0 1rem;
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 0.75rem;
    background: var(--surface);
}

.ticket-billable-summary {
    margin: 0 0 0.5rem;
    font-size: 0.9rem;
}

.ticket-billable .form-label {
    margin-bottom: 0.15rem;
    font-size: 0.8rem;
}

.ticket-billable-submit {
    padding-top: 1.45rem;
}

.ticket-billable-hint {
    margin: 0 0 0.5rem;
    color: var(--muted);
    font-size: 0.8rem;
}

/* Labels des tickets (EVO-52) : la priorité tient dans une colonne étroite, les labels prennent le reste. */
.ticket-label-table td:nth-child(2) {
    min-width: 16rem;
}

.ticket-label-position {
    width: 6rem;
}

/* Écart entre temps à facturer et temps passé (EVO-51) : rouge quand on facture moins, vert quand on facture plus. */
.ticket-billable-gap {
    margin-left: 0.25rem;
    font-weight: 600;
    white-space: nowrap;
}

.ticket-billable-gap.is-under {
    color: var(--bs-danger-text-emphasis);
}

.ticket-billable-gap.is-over {
    color: var(--bs-success-text-emphasis);
}

/*
 * Saisie rapide du temps à facturer (EVO-56) : un lien discret, ou la pastille du temps saisi, qui déplie un petit
 * formulaire. Dans une ligne du tableau de bord, le formulaire ouvert passe sur sa propre ligne, à la fin.
 */
.ticket-billable-inline {
    display: inline-block;
    max-width: 100%;
}

.ticket-meta > .ticket-billable-inline:has(details[open]) {
    flex-basis: 100%;
    order: 10;
}

.ticket-billable-inline > details > summary {
    display: inline-flex;
    align-items: center;
    gap: 0.15rem;
    list-style: none;
    cursor: pointer;
    white-space: nowrap;
}

.ticket-billable-inline > details > summary::-webkit-details-marker {
    display: none;
}

.ticket-billable-inline-toggle {
    border-radius: 999px;
    padding: 0.1rem 0.5rem;
    color: var(--muted);
    font-size: 0.8rem;
    text-decoration: underline dotted;
    text-underline-offset: 3px;
}

.ticket-billable-inline-toggle:hover,
.ticket-billable-inline-toggle:focus-visible {
    color: var(--bs-primary);
}

.ticket-billable-inline-toggle.is-set {
    border: 1px solid var(--line);
    background: var(--bs-light);
    color: inherit;
    font-weight: 600;
    text-decoration: none;
}

.ticket-billable-inline-toggle.is-saved {
    animation: ticket-billable-saved 1.6s ease-out;
}

@keyframes ticket-billable-saved {
    from {
        background: var(--bs-success-bg-subtle);
        border-color: var(--bs-success-border-subtle);
    }
}

.ticket-billable-inline-form {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 0.5rem;
    margin-top: 0.4rem;
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 0.5rem 0.6rem;
    background: var(--surface);
    text-align: left;
    white-space: normal;
}

.ticket-billable-inline-field {
    display: grid;
    gap: 0.1rem;
    margin: 0;
    font-size: 0.75rem;
    color: var(--muted);
}

.ticket-billable-inline-field.is-duration {
    flex: 0 0 6.5rem;
}

.ticket-billable-inline-field.is-note {
    flex: 1 1 10rem;
    min-width: 0;
}

.ticket-billable-inline-actions {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.ticket-billable-inline-hint,
.ticket-billable-inline-error {
    flex: 1 1 100%;
    margin: 0;
    font-size: 0.75rem;
}

.ticket-billable-inline-hint {
    color: var(--muted);
}

.ticket-billable-inline-hint .btn-link {
    font-size: inherit;
}

.ticket-billable-inline-error {
    color: var(--bs-danger-text-emphasis);
}

.timesheet-detail-entry .ticket-billable-inline {
    display: block;
    margin-top: 0.35rem;
}

/* Suivi du temps unifié (EVO-49) : saisie dans le panneau d'un jour, ticket ou temps interne */
.time-quick-kind {
    display: grid;
    gap: 0.5rem;
}

.time-quick-kind-switch {
    display: grid;
    grid-auto-columns: 1fr;
    grid-auto-flow: column;
    gap: 0.25rem;
    border: 1px solid var(--line);
    border-radius: 999px;
    padding: 0.2rem;
    background: var(--surface);
}

.time-quick-kind-tab {
    border: 0;
    border-radius: 999px;
    padding: 0.3rem 0.6rem;
    background: transparent;
    color: var(--muted);
    font-size: 0.85rem;
    font-weight: 600;
}

.time-quick-kind-tab.is-active {
    background: var(--panel);
    color: var(--brand);
    box-shadow: 0 1px 3px rgba(31, 42, 55, 0.12);
}

/* Nouveau ticket (EVO-57) : temps passé ou estimation */
.time-quick-choice {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem 1rem;
}

.time-quick-row .time-quick-choice-option {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    color: var(--ink);
    font-size: 0.85rem;
    cursor: pointer;
}

.time-quick-row textarea {
    resize: vertical;
}

#timesheet-day-panel {
    --bs-offcanvas-width: min(460px, 100vw);
}

.timesheet-day-entry-form {
    border-top: 1px solid var(--line);
}

.timesheet-sync-note {
    margin: -0.25rem 0 0.75rem;
    color: var(--muted);
    font-size: 0.8rem;
}

.timesheet-day-entry.is-pending span:first-child,
.timesheet-chip.is-pending {
    font-style: italic;
}

.timesheet-day-entry.is-failed span:first-child,
.timesheet-chip.is-failed {
    color: var(--ts-empty);
}

.timesheet-detail-entry.is-pending,
.timesheet-detail-entry.is-failed {
    box-shadow: inset 3px 0 0 var(--brand);
    padding-left: 0.6rem;
}

.timesheet-detail-entry.is-failed {
    box-shadow: inset 3px 0 0 var(--ts-empty);
}

/* Tri en masse des clients archivés (EVO-34). */
.archived-clients-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
}

.archived-clients-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem 0.75rem;
}

.client-card-select {
    flex: none;
    margin-top: 0.3rem;
}

.client-card-select + .client-card-title {
    flex: 1;
}


/* Disponibilité (surveillance HTTP des adresses des clients) */
.hb { display: inline-flex; gap: 2px; align-items: flex-end; vertical-align: middle; }
.hb i { display: block; width: 5px; height: 20px; border-radius: 2px; background: var(--ok); }
.hb i.down { background: #d1434b; }
.hb i.skip { background: #c9d1dc; }
.hb.big { flex-wrap: wrap; }
.hb.big i { width: 8px; height: 34px; }
.dot { display: inline-block; width: .6rem; height: .6rem; border-radius: 50%; margin-right: .35rem; }
.dot.up { background: var(--ok); }
.dot.down { background: #d1434b; }
.dot.pause { background: #9aa4b2; }
.dot.pending { background: #d98a06; }
.stat { border: 1px solid var(--line); border-radius: .6rem; padding: .8rem 1rem; background: var(--panel); }
.stat .v { font-size: 1.6rem; font-weight: 700; line-height: 1.1; }
.stat .v.stat-up { color: var(--ok); }
.stat .v.stat-down { color: #d1434b; }
.stat .v.stat-pause { color: #9aa4b2; }
.stat .l { color: var(--muted); font-size: .82rem; }
.banner-down { background: #fbe9ea; border: 1px solid #f0b9bd; color: #7d1d24; border-radius: .6rem; padding: .9rem 1.1rem; }
.banner-down .big { font-size: 1.15rem; font-weight: 700; }
.timeline { position: relative; margin: 0; padding: 0 0 0 1.4rem; list-style: none; border-left: 2px solid var(--line); }
.timeline li { position: relative; padding: 0 0 1rem 1rem; }
.timeline li::before { content: ""; position: absolute; left: -1.95rem; top: .25rem; width: .8rem; height: .8rem; border-radius: 50%; background: #d1434b; border: 2px solid #fff; box-shadow: 0 0 0 2px #d1434b; }
.timeline li.ok::before { background: var(--ok); box-shadow: 0 0 0 2px var(--ok); }
.timeline li.next::before { background: #fff; box-shadow: 0 0 0 2px #9aa4b2; }
.timeline .when { font-weight: 600; font-variant-numeric: tabular-nums; }
.uptime-line { display: flex; justify-content: space-between; align-items: center; gap: 1rem; padding: .5rem 0; border-bottom: 1px solid var(--line); }
.uptime-line:last-child { border-bottom: 0; }

/* Panels loaded after the page (ticket panel, quick entry): placeholder until GitLab has answered. */
turbo-frame#tickets-panel,
turbo-frame#time-quick-widget {
    display: block;
}

.frame-loading::before {
    content: "";
    display: inline-block;
    width: 0.85rem;
    height: 0.85rem;
    margin-right: 0.4rem;
    vertical-align: -0.1rem;
    border: 2px solid currentColor;
    border-right-color: transparent;
    border-radius: 50%;
    animation: frame-loading-spin 0.8s linear infinite;
}

@keyframes frame-loading-spin {
    to {
        transform: rotate(360deg);
    }
}

@media (prefers-reduced-motion: reduce) {
    .frame-loading::before {
        animation: none;
    }
}

/*
 * Thème sombre : `data-bs-theme="dark"` sur <html>, rendu par base.html.twig et basculé par theme_controller selon
 * le choix du menu du compte. Bootstrap bascule ses propres composants ; ce bloc redéfinit les
 * variables du thème et les surfaces claires écrites en dur plus haut, sans toucher au thème clair.
 */
[data-bs-theme="dark"] {
    --ink: #e2e8f0;
    --muted: #9aa8b9;
    --line: #2c3a4b;
    --surface: #0f151d;
    --panel: #17202b;
    --brand: #3b93d0;
    --brand-soft: #1b3348;
    --ok: #12a374;
    --bs-body-bg: var(--panel);
    --bs-body-color: var(--ink);
    --bs-emphasis-color: #f5f8fb;
    --bs-secondary-color: var(--muted);
    --bs-border-color: var(--line);
    --bs-secondary-bg: #222e3c;
    --bs-tertiary-bg: #1c2632;
    --bs-light: #222e3c;
}

[data-bs-theme="dark"] body.app-body {
    background: radial-gradient(circle at top left, #16202c 0%, var(--surface) 55%, #0b1016 100%);
}

[data-bs-theme="dark"] :is(
    .app-sidebar,
    .account-dropdown summary,
    .account-menu,
    .time-quick-panel,
    .ticket-thread-entry,
    .timeline li.next::before
) {
    background: var(--panel);
}

[data-bs-theme="dark"] :is(.time-quick-summary, .metrics div, .time-quick-today, .time-quick-pill) {
    background: var(--bs-tertiary-bg);
}

[data-bs-theme="dark"] .time-tracker {
    background: rgba(23, 32, 43, 0.96);
}

[data-bs-theme="dark"] :is(.time-quick-progress, .weekly-progress, .timesheet-day-bar) {
    background: var(--bs-secondary-bg);
}

[data-bs-theme="dark"] :is(
    .account-dropdown summary,
    .account-menu a,
    .account-menu button,
    .sidebar-group summary,
    .sidebar-nav a,
    .time-quick-summary-spent,
    .time-quick-summary-missing,
    .time-quick-hint,
    .time-quick-today,
    .time-quick-pill,
    .time-tracker
) {
    color: #b8c4d2;
}

[data-bs-theme="dark"] .time-quick-summary-spent strong {
    color: #8cc4ec;
}

[data-bs-theme="dark"] .brand h2 {
    color: #ef6f55;
}

[data-bs-theme="dark"] .time-quick-pill {
    border-color: var(--line);
}

[data-bs-theme="dark"] .time-quick-pill:focus-visible {
    border-color: #3e6d96;
    background: var(--brand-soft);
    color: #8cc4ec;
}

[data-bs-theme="dark"] .time-quick-pill.is-active {
    border-color: var(--brand);
    background: var(--brand);
    color: #fff;
}

[data-bs-theme="dark"] .time-quick-indicator {
    border-color: #2f4a63;
    background: var(--brand-soft);
    color: #a9cdea;
}

[data-bs-theme="dark"] .time-quick-indicator-billable {
    border-color: #23533f;
    background: #13332a;
    color: #7fd6b0;
}

[data-bs-theme="dark"] .time-quick-status[data-state='success'] {
    color: #4fd1a1;
}

[data-bs-theme="dark"] .time-quick-status[data-state='error'],
[data-bs-theme="dark"] .nav-logout {
    color: #f19a90;
}

[data-bs-theme="dark"] .nav-logout {
    background: #3a1d1f;
}

[data-bs-theme="dark"] .ticket-thread-entry.is-internal {
    border-color: #7a5d1f;
    background: #2b2416;
}

[data-bs-theme="dark"] .timesheet {
    --ts-complete-soft: #13332a;
    --ts-partial-soft: #3a2c12;
    --ts-empty-soft: #3a1d1f;
    --ts-holiday-soft: #222a35;
    --ts-leave-soft: #2a2140;
}

[data-bs-theme="dark"] .banner-down {
    background: #3a1d1f;
    border-color: #6b2c31;
    color: #f5b8bc;
}

[data-bs-theme="dark"] .timeline li::before {
    border-color: var(--panel);
}

[data-bs-theme="dark"] :is(.account-menu, .time-quick-panel, .ticket-thread-panel, .time-tracker, .panel, .auth-panel) {
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.45);
}

/* Bootstrap garde ces variantes claires en thème sombre : elles prennent les teintes du thème. */
[data-bs-theme="dark"] .table-light {
    --bs-table-bg: var(--bs-tertiary-bg);
    --bs-table-color: var(--ink);
    --bs-table-border-color: var(--line);
}

[data-bs-theme="dark"] .btn-light {
    --bs-btn-bg: var(--bs-secondary-bg);
    --bs-btn-color: var(--ink);
    --bs-btn-border-color: var(--line);
    --bs-btn-hover-bg: #2b3949;
    --bs-btn-hover-color: var(--ink);
    --bs-btn-hover-border-color: var(--line);
}

[data-bs-theme="dark"] .text-bg-light {
    background-color: var(--bs-secondary-bg) !important;
    color: var(--ink) !important;
}

/* Choix du thème dans le menu du compte. */
.theme-switch {
    display: grid;
    gap: 0.3rem;
    padding: 0.35rem 0.55rem 0.45rem;
    border-bottom: 1px solid var(--line);
    margin-bottom: 0.2rem;
}

.theme-switch-label {
    color: var(--muted);
    font-size: 0.75rem;
    font-weight: 600;
}

.theme-switch-options {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.2rem;
    padding: 0.15rem;
    border-radius: 9px;
    background: var(--bs-tertiary-bg);
}

.account-menu .theme-switch-options button {
    padding: 0.3rem 0.2rem;
    border-radius: 7px;
    background: none;
    text-align: center;
    font-size: 0.8rem;
}

.account-menu .theme-switch-options button[aria-pressed="true"] {
    background: var(--panel);
    color: var(--brand);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
}
