/* Ticket Work — application web, thème sombre à accent violet. */

:root {
    --bg: #09090e;
    --bg-2: #0e0e16;
    --panel: #13131d;
    --panel-2: #181825;
    --panel-3: #1f1f30;
    --line: #262638;
    --line-2: #35354d;
    --text: #e4e4f2;
    --muted: #8d8da8;
    --accent: #6a5af0;
    --accent-2: #9d92ff;
    --accent-dark: #4a3fc4;
    --red: #ec5d70;
    --red-bg: rgba(236, 93, 112, .12);
    --green: #3fc383;
    --green-bg: rgba(63, 195, 131, .12);
    --amber: #e5b75f;
    --radius: 10px;
    --radius-sm: 7px;
    --shadow: 0 10px 30px rgba(0, 0, 0, .35);
    --sidebar: 250px;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
html, body { margin: 0; padding: 0; }

body {
    background:
        radial-gradient(1000px 520px at 12% -10%, rgba(106, 90, 240, .14), transparent 60%),
        radial-gradient(800px 460px at 100% 0%, rgba(74, 63, 196, .10), transparent 60%),
        var(--bg);
    background-attachment: fixed;
    color: var(--text);
    font: 14.5px/1.6 "Inter", "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
    min-height: 100vh;
}

a { color: var(--accent-2); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { margin: 0; font-weight: 700; line-height: 1.25; }
img { max-width: 100%; }

/* ---------------------------------------------------------------- structure */

.app { display: flex; min-height: 100vh; }

.sidebar {
    width: var(--sidebar);
    flex-shrink: 0;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
    background: rgba(14, 14, 22, .92);
    border-right: 1px solid var(--line);
    padding: 20px 14px;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.brand {
    display: flex;
    align-items: center;
    gap: 11px;
    color: var(--text);
    font-weight: 800;
    font-size: 17px;
    letter-spacing: -.01em;
    padding: 2px 8px;
}
.brand:hover { text-decoration: none; }
.brand__logo {
    width: 34px;
    height: 34px;
    border-radius: 10px;
    background: linear-gradient(135deg, #8a7cff, #4a3fc4);
    display: grid;
    place-items: center;
    color: #fff;
    font-weight: 800;
    box-shadow: 0 6px 18px rgba(106, 90, 240, .4);
}
.brand--lg { justify-content: center; font-size: 22px; margin-bottom: 22px; }
.brand--lg .brand__logo { width: 44px; height: 44px; font-size: 20px; }

.nav { display: flex; flex-direction: column; gap: 2px; }
.nav__group {
    margin: 18px 10px 6px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .1em;
    text-transform: uppercase;
    color: var(--muted);
}
.nav a {
    display: block;
    padding: 9px 12px;
    border-radius: 8px;
    color: #c9c9de;
    font-weight: 500;
    transition: background .12s, color .12s;
}
.nav a:hover { background: var(--panel-3); color: var(--text); text-decoration: none; }
.nav a.active { background: rgba(106, 90, 240, .18); color: var(--accent-2); font-weight: 600; }

.nav a.nav__project { font-weight: 600; }
.nav a.nav__project.is-current { color: var(--text); background: var(--panel-3); }
.nav__sub { margin: 2px 0 8px 16px; padding-left: 8px; border-left: 1px solid var(--line-2); display: flex; flex-direction: column; gap: 1px; }
.nav__sub a { padding: 6px 10px; font-size: 13.5px; }
.nav__empty { color: var(--muted); font-size: 13px; padding: 6px 12px; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.topbar {
    position: sticky;
    top: 0;
    z-index: 20;
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px 36px;
    background: rgba(9, 9, 14, .78);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--line);
}
.topbar__crumb {
    color: var(--muted);
    font-size: 12px;
    font-weight: 600;
    letter-spacing: .08em;
    text-transform: uppercase;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.topbar__right { margin-left: auto; display: flex; align-items: center; gap: 14px; }
.userchip { display: flex; align-items: center; gap: 10px; }
.userchip__name { font-weight: 600; font-size: 13px; line-height: 1.2; }
.userchip__role { color: var(--muted); font-size: 11.5px; }

.menu-btn {
    display: none;
    cursor: pointer;
    font-size: 20px;
    line-height: 1;
    padding: 6px 10px;
    border: 1px solid var(--line-2);
    border-radius: 8px;
    background: var(--panel-2);
}

.content {
    width: 100%;
    max-width: 1560px;
    margin: 0 auto;
    padding: 28px 36px 70px;
}

.nav-toggle { display: none; }
.nav-backdrop { display: none; }

/* ---------------------------------------------------------------- titres & blocs */

.page-head {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
    margin-bottom: 18px;
}
.page-title { font-size: 24px; font-weight: 800; letter-spacing: -.02em; }
.page-sub { color: var(--muted); margin-top: 3px; }

.section-title {
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .09em;
    color: var(--accent-2);
    margin: 28px 0 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--line);
}
.section-title:first-child { margin-top: 0; }

.panel {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 20px;
}
.panel + .panel { margin-top: 14px; }

.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.right { margin-left: auto; }

/* ---------------------------------------------------------------- messages */

.flash {
    border: 1px solid var(--line-2);
    border-left: 4px solid var(--accent);
    background: var(--panel);
    border-radius: var(--radius-sm);
    padding: 11px 14px;
    margin-bottom: 14px;
}
.flash--success { border-left-color: var(--green); }
.flash--error { border-left-color: var(--red); }

.toast {
    position: fixed;
    right: 22px;
    bottom: 22px;
    z-index: 60;
    background: var(--panel-3);
    border: 1px solid var(--accent);
    border-radius: var(--radius-sm);
    padding: 11px 16px;
    box-shadow: var(--shadow);
}
.toast--error { border-color: var(--red); }

/* ---------------------------------------------------------------- boutons */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 9px 16px;
    font: inherit;
    font-weight: 600;
    font-size: 13.5px;
    color: var(--text);
    background: var(--panel-3);
    border: 1px solid var(--line-2);
    border-radius: 8px;
    cursor: pointer;
    transition: border-color .12s, background .12s, transform .05s;
}
.btn:hover { border-color: var(--accent); text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn--primary { background: linear-gradient(180deg, #7566f5, #5a4cdf); border-color: #7a6cf7; color: #fff; }
.btn--primary:hover { background: linear-gradient(180deg, #8174f7, #6354e6); }
.btn--danger { color: var(--red); background: var(--red-bg); border-color: rgba(236, 93, 112, .35); }
.btn--danger:hover { border-color: var(--red); }
.btn--ghost { background: transparent; }
.btn--sm { padding: 5px 11px; font-size: 12.5px; }
.btn--lg { padding: 13px 18px; font-size: 15px; }
.btn--block { width: 100%; }

/* ---------------------------------------------------------------- onglets */

.tabs {
    display: flex;
    gap: 6px;
    border-bottom: 1px solid var(--line);
    margin-bottom: 18px;
    flex-wrap: wrap;
}
.tabs a {
    padding: 10px 16px;
    color: var(--muted);
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
    font-weight: 600;
}
.tabs a:hover { color: var(--text); text-decoration: none; }
.tabs a.active { color: var(--accent-2); border-bottom-color: var(--accent); }

/* ---------------------------------------------------------------- badges */

.badge {
    display: inline-block;
    padding: 2px 10px;
    font-size: 11.5px;
    font-weight: 600;
    border: 1px solid var(--line-2);
    background: var(--panel-3);
    color: var(--muted);
    border-radius: 999px;
    white-space: nowrap;
}
.badge--high, .badge--blocker, .badge--critical { color: var(--red); border-color: rgba(236, 93, 112, .4); background: var(--red-bg); }
.badge--medium, .badge--major { color: var(--accent-2); border-color: rgba(106, 90, 240, .5); background: rgba(106, 90, 240, .14); }
.badge--low, .badge--minor { color: var(--green); border-color: rgba(63, 195, 131, .4); background: var(--green-bg); }
.badge--type { color: var(--text); }

/* ---------------------------------------------------------------- avatars */

.avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
    background: var(--accent-dark);
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 700;
    border: 2px solid var(--panel);
    flex-shrink: 0;
}
.avatar--sm { width: 24px; height: 24px; font-size: 9px; }
.avatar--lg { width: 56px; height: 56px; font-size: 18px; }
.avatars { display: inline-flex; }
.avatars .avatar + .avatar { margin-left: -7px; }

/* ---------------------------------------------------------------- formulaires */

.field { margin-bottom: 16px; }
.field label, .label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: var(--muted);
    margin-bottom: 6px;
}

input[type="text"], input[type="search"], select, textarea, input[type="file"] {
    width: 100%;
    background: var(--bg-2);
    border: 1px solid var(--line-2);
    color: var(--text);
    padding: 10px 12px;
    font: inherit;
    border-radius: 8px;
    transition: border-color .12s, box-shadow .12s;
}
textarea { min-height: 120px; resize: vertical; }
input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(106, 90, 240, .2);
}
select option { background: var(--bg-2); }

.row { display: flex; gap: 16px; flex-wrap: wrap; }
.row > * { flex: 1; min-width: 200px; }

.checks { display: flex; flex-wrap: wrap; gap: 8px 16px; }
.check { display: inline-flex; align-items: center; gap: 7px; cursor: pointer; }
.check input { accent-color: var(--accent); width: 16px; height: 16px; }

.errors { color: var(--red); font-size: 12.5px; margin-top: 4px; }

/* ---------------------------------------------------------------- Kanban */

.filters { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; margin-bottom: 18px; }
.filters select { width: auto; min-width: 170px; padding: 7px 10px; }

.kanban {
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: minmax(270px, 1fr);
    gap: 14px;
    overflow-x: auto;
    padding-bottom: 14px;
    align-items: start;
}

.kcol {
    background: rgba(14, 14, 22, .8);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    min-height: 220px;
}
.kcol__head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 14px;
    font-weight: 700;
    font-size: 13px;
    border-bottom: 1px solid var(--line);
}
.kcol__count {
    background: var(--panel-3);
    color: var(--muted);
    padding: 1px 9px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
}
.kcol__body { padding: 10px; display: flex; flex-direction: column; gap: 10px; min-height: 160px; }
.kcol.is-over { outline: 2px dashed var(--accent); outline-offset: -4px; background: rgba(106, 90, 240, .08); }

.kcard {
    background: var(--panel-2);
    border: 1px solid var(--line);
    border-left: 3px solid var(--accent-dark);
    border-radius: 9px;
    padding: 12px 13px;
    transition: border-color .12s, transform .12s, box-shadow .12s;
}
.kcard:hover { border-color: var(--accent); box-shadow: var(--shadow); transform: translateY(-1px); }
.kcard[draggable="true"] { cursor: grab; }
.kcard.dragging { opacity: .4; }
.kcard--high { border-left-color: var(--red); }
.kcard--low { border-left-color: var(--green); }
.kcard__title { color: var(--text); font-weight: 600; display: block; margin-bottom: 9px; word-break: break-word; }
.kcard__title:hover { color: var(--accent-2); text-decoration: none; }
.kcard__meta { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.kcard__foot { display: flex; align-items: center; justify-content: space-between; margin-top: 11px; color: var(--muted); font-size: 12.5px; }

/* ---------------------------------------------------------------- tableaux & cartes */

.table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    overflow: hidden;
}
.table th {
    text-align: left;
    font-size: 11.5px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .07em;
    color: var(--muted);
    padding: 11px 14px;
    background: var(--bg-2);
    border-bottom: 1px solid var(--line-2);
}
.table td { padding: 12px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tr:last-child td { border-bottom: none; }
.table tr.row--high td { background: var(--red-bg); }
.table tr.row--low td { background: var(--green-bg); }
.table tbody tr:hover td { background: var(--panel-3); }

.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 16px; }
.pcard {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 20px;
    display: block;
    color: var(--text);
    transition: border-color .12s, transform .12s, box-shadow .12s;
}
.pcard:hover { border-color: var(--accent); transform: translateY(-2px); box-shadow: var(--shadow); text-decoration: none; }
.pcard__name { color: var(--text); font-weight: 700; font-size: 17px; }
.pcard__stats { display: flex; gap: 10px; margin-top: 16px; }
.stat { flex: 1; text-align: center; background: var(--bg-2); border: 1px solid var(--line); border-radius: 9px; padding: 10px 6px; }
.stat b { display: block; font-size: 22px; color: var(--accent-2); line-height: 1.2; }
.stat span { font-size: 11.5px; color: var(--muted); }

.empty {
    color: var(--muted);
    text-align: center;
    padding: 44px 20px;
    border: 1px dashed var(--line-2);
    border-radius: var(--radius);
}

/* ---------------------------------------------------------------- fiche ticket */

.ticket-layout { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 28px; align-items: start; }
.ticket-title { font-size: 26px; font-weight: 800; letter-spacing: -.02em; margin: 10px 0 8px; word-break: break-word; }
.prose { white-space: pre-wrap; word-break: break-word; }

.side-block {
    border: 1px solid var(--line);
    background: var(--panel);
    border-radius: var(--radius);
    padding: 16px;
    margin-bottom: 14px;
}
.side-block h3 {
    font-size: 11.5px;
    text-transform: uppercase;
    letter-spacing: .09em;
    color: var(--muted);
    margin-bottom: 12px;
}
.kv { display: flex; justify-content: space-between; gap: 10px; padding: 7px 0; border-bottom: 1px solid var(--line); font-size: 13px; }
.kv:last-child { border-bottom: none; }
.kv span:first-child { color: var(--muted); }

.person { display: flex; align-items: center; gap: 10px; padding: 5px 0; }

.comment {
    border: 1px solid var(--line);
    background: var(--panel);
    border-radius: var(--radius);
    padding: 14px 16px;
    margin-bottom: 12px;
}
.comment__head { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }

.attachments { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 10px; }
.attachment { border: 1px solid var(--line); background: var(--bg-2); border-radius: 9px; padding: 8px; max-width: 240px; font-size: 12.5px; }
.attachment img, .attachment video { display: block; max-width: 100%; max-height: 170px; margin-bottom: 6px; border-radius: 6px; }

.ai-box { border: 1px solid rgba(106, 90, 240, .45); background: rgba(106, 90, 240, .08); border-radius: var(--radius); padding: 14px 16px; }
.ai-box ul { margin: 6px 0 0 18px; padding: 0; color: var(--muted); font-size: 12.5px; }

.log { list-style: none; margin: 0; padding: 0; }
.log li { padding: 9px 0; border-bottom: 1px solid var(--line); font-size: 13px; }
.log time { color: var(--muted); font-size: 12px; margin-left: 8px; }

details > summary { cursor: pointer; color: var(--accent-2); font-weight: 600; margin-bottom: 10px; }

/* ---------------------------------------------------------------- connexion */

.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px; }
.login-card {
    width: 100%;
    max-width: 420px;
    background: rgba(19, 19, 29, .9);
    border: 1px solid var(--line);
    border-radius: 16px;
    box-shadow: var(--shadow);
    padding: 36px 32px;
    text-align: center;
}
.login-card h1 { font-size: 22px; margin-bottom: 6px; }
.login-card .btn { margin: 22px 0 14px; }

.pagination { display: flex; gap: 8px; margin: 0; padding: 0; list-style: none; flex-wrap: wrap; }
.pagination a, .pagination span { display: inline-block; padding: 5px 12px; border: 1px solid var(--line-2); border-radius: 7px; font-size: 13px; }
.pagination .active span { background: var(--accent-dark); border-color: var(--accent); }

/* ---------------------------------------------------------------- tablette / mobile */

@media (max-width: 1000px) {
    .menu-btn { display: inline-block; }
    .sidebar {
        position: fixed;
        z-index: 40;
        left: 0;
        top: 0;
        transform: translateX(-100%);
        transition: transform .2s ease;
        width: 270px;
    }
    .nav-toggle:checked ~ .app .sidebar { transform: none; box-shadow: var(--shadow); }
    .nav-toggle:checked ~ .app .nav-backdrop {
        display: block;
        position: fixed;
        inset: 0;
        z-index: 30;
        background: rgba(0, 0, 0, .55);
    }
    .topbar { padding: 10px 16px; }
    .content { padding: 20px 16px 60px; }
    .ticket-layout { grid-template-columns: 1fr; }
    .userchip__text { display: none; }
}

@media (max-width: 560px) {
    .page-title { font-size: 20px; }
    .ticket-title { font-size: 21px; }
    .cards { grid-template-columns: 1fr; }
    .kanban { grid-auto-columns: 82vw; }
    .table { display: block; overflow-x: auto; }
}
