:root {
    --bg: #edf2ff;
    --bg-dark: #0f172a;
    --surface: #ffffff;
    --surface-alt: rgba(255, 255, 255, 0.9);
    --primary: #2563eb;
    --primary-soft: #e0e7ff;
    --accent: #06b6d4;
    --text: #0f172a;
    --muted: #6b7280;
    --border: #e2e8f0;
    --shadow: 0 24px 60px rgba(15, 23, 42, 0.08);
    --shadow-strong: 0 30px 80px rgba(15, 23, 42, 0.15);
    --flash-danger: #fee2e2;
    --flash-success: #dcfce7;
    --flash-warning: #fef9c3;
    font-family: "Inter", "Segoe UI", system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: var(--font, "Inter", sans-serif);
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
}

body.auth-mode {
    background: var(--bg-dark);
}

.app-shell {
    display: flex;
    min-height: 100vh;
    background: linear-gradient(135deg, #f8fbff 0%, #e2ebff 45%, #f8fbff 100%);
}

.sidebar {
    width: 280px;
    background: var(--surface);
    border-right: 1px solid rgba(255, 255, 255, 0.4);
    padding: 1.5rem 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    box-shadow: var(--shadow);
    z-index: 20;
    position: sticky;
    top: 0;
    height: 100vh;
    transition: transform 0.25s ease, width 0.25s ease;
    overflow: hidden;
}

body.sidebar-collapsed .sidebar {
    width: 96px;
    padding: 1.5rem 0.8rem;
    overflow: hidden;
}

body.sidebar-collapsed .sidebar .text,
body.sidebar-collapsed .sidebar .brand-labels,
body.sidebar-collapsed .sidebar-subnav,
body.sidebar-collapsed .sidebar-footer {
    opacity: 0;
    pointer-events: none;
    visibility: hidden;
    height: 0;
}

body.sidebar-collapsed .brand-mark {
    margin: 0 auto 0.5rem;
}

body.sidebar-collapsed .sidebar-brand {
    justify-content: center;
    gap: 0;
}

body.sidebar-collapsed .nav-link {
    justify-content: center;
    gap: 0;
    padding: 0.65rem 0.3rem;
}

body.sidebar-collapsed .nav-link .icon {
    margin: 0;
    width: 36px;
}

.brand-mark {
    width: 48px;
    height: 48px;
    border-radius: 16px;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    display: grid;
    place-items: center;
    color: #fff;
    font-weight: 700;
    font-size: 1.2rem;
}

.sidebar-brand {
    display: flex;
    gap: 0.85rem;
    align-items: center;
}

.brand-labels span {
    color: var(--muted);
    font-size: 0.85rem;
}

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

.nav-link {
    display: flex;
    align-items: center;
    gap: 0.9rem;
    padding: 0.85rem 1rem;
    border-radius: 14px;
    color: var(--muted);
    text-decoration: none;
    font-weight: 500;
    transition: background 0.2s ease, color 0.2s ease, transform 0.2s ease;
}

.nav-link .icon {
    width: 28px;
    text-align: center;
}

.nav-link.active,
.nav-link:hover {
    background: var(--primary-soft);
    color: var(--primary);
    transform: translateX(4px);
}

.sidebar-footer {
    margin-top: auto;
    padding-top: 1rem;
    border-top: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    align-items: stretch;
    justify-content: flex-start;
    gap: 0.75rem;
}

.sidebar-footer .ghost-btn {
    width: 100%;
    text-align: center;
}

.chip-name {
    font-weight: 600;
}

.chip-role {
    color: var(--muted);
    font-size: 0.85rem;
    text-transform: capitalize;
}

.workspace {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    border: 0;
}

.topbar {
    height: 74px;
    background: var(--surface);
    box-shadow: var(--shadow);
    padding: 0 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 10;
}

.topbar-left {
    display: flex;
    gap: 1rem;
    align-items: center;
}

.topbar-label {
    text-transform: uppercase;
    letter-spacing: 0.1em;
    font-size: 0.7rem;
    color: var(--muted);
    margin: 0;
}

.topbar-meta {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 1rem;
    min-width: 300px;
}

.search-wrapper {
    position: relative;
    width: min(360px, 100%);
}

.icon-btn.logout-icon-btn {
    position: relative;
    width: 40px;
    height: 40px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: #f8fbff;
    color: #e63946;
    text-decoration: none;
    border: 1px solid var(--border);
    font-weight: 800;
    transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}

.icon-btn.logout-icon-btn::after {
    content: "";
    position: absolute;
    top: 6px;
    right: 6px;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #e63946;
    opacity: 0.85;
}

.icon-btn.logout-icon-btn:hover {
    transform: translateY(-1px);
    border-color: #e63946;
    box-shadow: 0 6px 14px rgba(230, 57, 70, 0.2);
}

.search-icon-btn {
    position: absolute;
    left: 10px;
    top: 50%;
    transform: translateY(-50%);
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 1px solid var(--border);
    background: #f8fbff;
    display: none;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    color: var(--muted);
    padding: 0;
}

.search-wrapper input {
    width: 100%;
    border-radius: 999px;
    padding: 0.65rem 1.2rem;
    border: 1px solid var(--border);
    background: #f8fbff;
    font-size: 0.95rem;
    text-decoration: none;
}

.search-results {
    position: absolute;
    top: calc(100% + 0.4rem);
    left: 0;
    right: 0;
    background: var(--surface);
    border-radius: 18px;
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
    padding: 0.4rem 0;
    display: none;
    z-index: 30;
    max-height: 340px;
    overflow-y: auto;
}

.search-wrapper.active .search-results {
    display: block;
}

.search-result-item {
    display: flex;
    flex-direction: column;
    padding: 0.65rem 1rem;
    text-decoration: none;
    color: inherit;
    border-bottom: 1px solid rgba(226, 232, 240, 0.6);
}

.search-result-item:last-child {
    border-bottom: none;
}

.search-result-item strong {
    font-size: 0.95rem;
}

.search-result-item span {
    font-size: 0.82rem;
    color: var(--muted);
}

.search-result-empty {
    padding: 0.8rem 1rem;
    color: var(--muted);
    font-size: 0.9rem;
}

.topbar h1 {
    margin: 0;
    font-size: 1.4rem;
}

.ghost-btn,
button {
    border: none;
    border-radius: 14px;
    padding: 0.65rem 1.3rem;
    background: var(--primary);
    color: #fff;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    font-size: 1rem;
}

.ghost-btn {
    background: var(--primary-soft);
    color: var(--primary);
}

button:hover,
.ghost-btn:hover {
    box-shadow: 0 12px 20px rgba(37, 99, 235, 0.25);
}

.primary-action,
.ghost-btn,
button,
.icon-link,
.attachment-chip {
    text-decoration: none;
}

.primary-action:hover,
.ghost-btn:hover,
button:hover,
.icon-link:hover,
.attachment-chip:hover {
    text-decoration: none;
}
.role-technicien .sidebar,
.role-technicien .sidebar-backdrop {
    display: none !important;
}

.role-technicien .app-shell {
    flex-direction: column;
}

.role-technicien .workspace {
    margin-left: 0;
}

.role-technicien .topbar-meta {
    min-width: 0;
}

.role-technicien .search-wrapper {
    width: 48px;
    max-width: 48px;
    transition: max-width 0.2s ease, width 0.2s ease;
}

.role-technicien .search-icon-btn {
    display: inline-flex;
}

.role-technicien .search-wrapper input {
    display: none;
}

.role-technicien .search-wrapper.search-open,
.role-technicien .search-wrapper:focus-within {
    max-width: 260px;
    width: 100%;
}

.role-technicien .search-wrapper.search-open input,
.role-technicien .search-wrapper:focus-within input {
    display: block;
    padding-left: 3rem;
}

@media (max-width: 900px) {
    .role-gestionnaire .topbar {
        padding: 0 1rem;
        height: 68px;
    }

    .role-gestionnaire .topbar-label {
        display: none;
    }

    .role-gestionnaire .topbar-left {
        min-width: 0;
    }

    .role-gestionnaire .topbar h1 {
        font-size: 1.15rem;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        max-width: 52vw;
    }

    .role-gestionnaire .topbar-meta {
        min-width: 0;
        gap: 0.6rem;
    }

    .role-gestionnaire .search-wrapper {
        width: 48px;
        max-width: 48px;
        transition: max-width 0.2s ease, width 0.2s ease;
    }

    .role-gestionnaire .search-icon-btn {
        display: inline-flex;
    }

    .role-gestionnaire .search-wrapper input {
        display: none;
    }

    .role-gestionnaire .search-wrapper.search-open,
    .role-gestionnaire .search-wrapper:focus-within {
        max-width: min(320px, 78vw);
        width: 100%;
    }

    .role-gestionnaire .search-wrapper.search-open input,
    .role-gestionnaire .search-wrapper:focus-within input {
        display: block;
        padding-left: 3rem;
    }
}

.page {
    flex: 1;
    padding: 2rem;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    position: relative;
}

.page::before {
    content: "";
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at top right, rgba(6, 182, 212, 0.12), transparent 55%);
    z-index: -1;
}

.stat-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1rem;
}

.stat-card {
    background: var(--surface);
    border-radius: 20px;
    padding: 1.5rem;
    box-shadow: var(--shadow);
    position: relative;
    overflow: hidden;
}

.stat-card::after {
    content: "";
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at top right, rgba(37, 99, 235, 0.15), transparent 60%);
}

.stat-card span {
    color: var(--muted);
    font-size: 0.9rem;
    position: relative;
}

.stat-card strong {
    font-size: 2.4rem;
    position: relative;
}

.panel {
    background: var(--surface);
    border-radius: 24px;
    padding: 1.8rem;
    box-shadow: var(--shadow);
    display: flex;
    flex-direction: column;
    gap: 1.2rem;
}

.panel-header {
    display: flex;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 1rem;
}

.hint {
    color: var(--muted);
    margin: 0;
}

.table {
    border-radius: 18px;
    border: 1px solid var(--border);
    overflow: hidden;
}

.table-head,
.table-row {
    display: grid;
    grid-template-columns: repeat(4, minmax(120px, 1fr));
    gap: 0.5rem;
    padding: 0.9rem 1.25rem;
    align-items: center;
}

.table-head {
    background: var(--primary-soft);
    color: var(--primary);
    font-weight: 600;
}

.table-row {
    background: var(--surface);
}

.table-row:nth-child(even) {
    background: #f9fbff;
}

.table-row:not(:last-child) {
    border-bottom: 1px solid var(--border);
}

.dashboard-table .table-head,
.dashboard-table .table-row {
    grid-template-columns: 1.4fr 1fr 1fr 1fr;
}

.equip-row-link {
    cursor: pointer;
    transition: background 0.15s ease;
}

.equip-row-link:hover {
    background: #f3f6ff;
}

.equip-row-link:focus {
    outline: 2px solid var(--primary);
    outline-offset: 3px;
}

.equip-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 0.8rem;
    margin-bottom: 1.2rem;
}

.equip-stat-card {
    background: #f8faff;
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    box-shadow: var(--shadow);
}

.equip-stat-card strong {
    font-size: 1.8rem;
    line-height: 1;
}

.equip-stat-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.pill {
    padding: 0.2rem 0.75rem;
    border-radius: 999px;
    background: rgba(37, 99, 235, 0.12);
    color: var(--primary);
    font-size: 0.85rem;
    font-weight: 700;
}

.pill-status-service {
    background: #dcfce7;
    color: #15803d;
}

.pill-status-maintenance {
    background: #fef9c3;
    color: #92400e;
}

.pill-status-out {
    background: #fee2e2;
    color: #b91c1c;
}

.pill-status-ticket-new {
    background: #e0f2fe;
    color: #0369a1;
}

.pill-status-ticket-progress {
    background: #fef3c7;
    color: #92400e;
}

.pill-status-ticket-done {
    background: #dcfce7;
    color: #15803d;
}

.pill-priority-urgent {
    background: #fee2e2;
    color: #b91c1c;
}

.pill-priority-important {
    background: #fff1f2;
    color: #9f1239;
}

.pill-priority-basse {
    background: #f1f5f9;
    color: #475569;
}

.pill-doc {
    background: #fef9c3;
    color: #854d0e;
    margin-left: 0.5rem;
}

@media (max-width: 900px) {
    .dashboard-table {
        border: none;
        box-shadow: none;
    }
    .dashboard-table .table-head {
        display: none;
    }
    .dashboard-table .table-row {
        display: block;
        padding: 1rem;
        border-radius: 12px;
        margin-bottom: 0.75rem;
        border: 1px solid var(--border);
        background: #fff;
        box-shadow: var(--shadow);
    }
    .dashboard-table .table-row:last-child {
        margin-bottom: 0;
    }
    .dashboard-table .table-row .cell {
        display: flex;
        align-items: flex-start;
        gap: 0.6rem;
        padding: 0.08rem 0;
    }
    .dashboard-table .table-row .cell:not(:last-child) {
        margin-bottom: 0.35rem;
    }
    .dashboard-table .table-row .cell::before {
        content: attr(data-label);
        flex: 0 0 6.5rem;
        font-size: 0.8rem;
        letter-spacing: 0.02em;
        color: var(--muted);
        text-transform: uppercase;
        font-weight: 700;
    }
    .dashboard-table .table-row .cell:first-child {
        font-weight: 700;
        color: var(--text);
    }
}

.form {
    display: grid;
    gap: 0.9rem;
}

.form.split {
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}

.maintenance-form {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1.5rem;
    align-items: start;
}

.maintenance-form .field {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.maintenance-form .field .hint {
    font-size: 0.85rem;
    line-height: 1.3;
}

.maintenance-form .span-2 {
    grid-column: 1 / -1;
}

.maintenance-form textarea {
    min-height: 180px;
}

.maintenance-form .form-note {
    padding: 0.8rem 1rem;
    border-radius: 14px;
    background: #f5f7ff;
}

.maintenance-form .actions {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.ticket-summary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 0.75rem;
    background: #f5f7ff;
    padding: 0.8rem 1rem;
    border-radius: 16px;
}

.ticket-summary .label {
    margin: 0;
    font-size: 0.85rem;
    color: var(--muted);
}

.ticket-summary strong {
    font-size: 1.6rem;
}

.ticket-controls {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    align-items: flex-end;
    justify-content: space-between;
}

.ticket-filters {
    flex: 1;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1rem;
}

.ticket-filters .field {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.ticket-filters label {
    font-weight: 600;
    font-size: 0.95rem;
}

.filter-chip-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.filter-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.65rem 0.9rem;
    border-radius: 12px;
    border: 1px solid var(--border);
    background: #f6f8ff;
    color: var(--text);
    cursor: pointer;
    transition: all 0.15s ease;
    font-weight: 600;
}

.filter-chip:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.filter-chip.active {
    background: var(--primary-soft);
    color: var(--primary);
    border-color: var(--primary);
}

.sort-control {
    position: relative;
    display: inline-block;
    width: 100%;
}

.sort-toggle {
    width: 100%;
    padding: 0.75rem 1rem;
    border-radius: 14px;
    border: 1px solid var(--border);
    background: #f6f8ff;
    color: var(--text);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    justify-content: space-between;
    cursor: pointer;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.sort-toggle:hover,
.sort-toggle:focus {
    border-color: var(--primary);
    box-shadow: 0 4px 14px rgba(51, 97, 255, 0.12);
}

.sort-menu {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    width: 100%;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 12px;
    box-shadow: 0 12px 28px rgba(0, 0, 0, 0.08);
    padding: 0.35rem;
    display: none;
    z-index: 10;
}

.sort-menu.open {
    display: block;
}

.sort-menu button {
    width: 100%;
    text-align: left;
    padding: 0.6rem 0.75rem;
    border: none;
    background: transparent;
    border-radius: 10px;
    cursor: pointer;
}

.sort-menu button:hover {
    background: #f6f8ff;
}

.sort-menu button.active {
    background: var(--primary-soft);
    color: var(--primary);
    font-weight: 700;
}

.filters-actions {
    display: flex;
    gap: 0.6rem;
    align-items: center;
    flex-wrap: wrap;
}

.ticket-export {
    display: flex;
    gap: 0.6rem;
    align-items: center;
}

.ticket-table-wrapper {
    width: 100%;
    overflow-x: auto;
}

.ticket-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 760px;
}

.desktop-only {
    display: table;
}

.mobile-ticket-list {
    display: none;
}

.ticket-table th,
.ticket-table td {
    padding: 0.95rem 0.75rem;
    border-bottom: 1px solid var(--border);
    text-align: left;
}

.ticket-table th {
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--muted);
}

.ticket-table tbody tr:hover {
    background: #f7f9ff;
}

.ticket-cell-main strong {
    display: block;
    margin-bottom: 0.2rem;
}

.date-stack {
    display: flex;
    flex-direction: column;
    line-height: 1.2;
}

.date-stack .time {
    color: var(--muted);
    font-size: 0.85rem;
}

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

.ticket-link:hover strong {
    color: var(--primary);
}

.mobile-ticket-card {
    display: grid;
    gap: 0.5rem;
    padding: 1rem;
    border: 1px solid var(--border);
    border-radius: 16px;
    background: #fff;
    box-shadow: var(--shadow);
}

.mobile-ticket-card header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.5rem;
}

.mobile-ticket-number {
    margin: 0;
    font-weight: 700;
    color: var(--primary);
}

.mobile-ticket-date {
    margin: 0;
    color: var(--muted);
    font-size: 0.9rem;
}

.mobile-ticket-meta {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 0.6rem;
}

.mobile-ticket-meta .label {
    display: block;
    color: var(--muted);
    font-size: 0.8rem;
}

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

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

.attachment-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.45rem 0.7rem;
    border-radius: 999px;
    background: var(--primary-soft);
    color: var(--primary);
    text-decoration: none;
    font-size: 0.9rem;
}

.clamp-2 {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.ticket-layout {
    margin-top: 1.5rem;
    display: grid;
    grid-template-columns: 260px 1fr;
    gap: 1.5rem;
}

.ticket-overview {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 0.9rem;
}

.ticket-overview article {
    border-radius: 16px;
    padding: 1rem;
    background: #f8f9ff;
    border: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
}

.ticket-overview article .label {
    text-transform: uppercase;
    font-size: 0.75rem;
    color: var(--muted);
    letter-spacing: 0.08em;
    margin: 0;
}

.ticket-overview article strong {
    font-size: 2rem;
    line-height: 1.2;
}

.tickets-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.ticket-form-panel {
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 1.25rem;
    background: #f9fbff;
}

.ticket-form-panel h3 {
    margin-top: 0;
}

.ticket-inline-form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.ticket-inline-form textarea {
    min-height: 120px;
}

.attachment-actions {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
}

.attachment-inline {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
}

.attachment-inline .icon-btn {
    min-width: 46px;
    justify-content: center;
}

.ghost-btn.is-disabled,
.icon-btn.is-disabled,
.ghost-btn[disabled],
.icon-btn[disabled] {
    opacity: 0.45;
    cursor: not-allowed;
    pointer-events: none;
}
.ticket-row {
    align-items: flex-start;
}

.ticket-row-actions form {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.ticket-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 1rem;
}

.ticket-card {
    border: 1px solid var(--border);
    border-radius: 18px;
    padding: 1rem;
    background: #fff;
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
    box-shadow: 0 12px 30px rgba(15, 23, 42, 0.06);
}

.ticket-detail-layout {
    display: grid;
    grid-template-columns: minmax(0, 2.1fr) minmax(260px, 320px);
    gap: 1.25rem;
    margin-top: 1.2rem;
    align-items: flex-start;
}

.ticket-detail-layout.is-single {
    grid-template-columns: 1fr;
}

.ticket-detail-main {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    max-width: 960px;
    margin: 0 auto;
}

.ticket-summary-card {
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 1.2rem 1.4rem;
    background: #fff;
    box-shadow: 0 25px 35px rgba(15, 23, 42, 0.05);
}

.ticket-summary-header {
    display: flex;
    align-items: flex-start;
    gap: 0.6rem;
    flex-wrap: wrap;
}

.ticket-summary-header .summary-title {
    order: 1;
    min-width: 240px;
}

.ticket-summary-header .summary-badges {
    order: 2;
    margin-left: auto;
}

.ticket-summary-header .summary-assignee {
    order: 3;
    flex: 1 1 100%;
    margin-top: 0.15rem;
}

.summary-assignee .label {
    margin: 0;
    color: var(--muted);
    font-size: 0.95rem;
}

.ticket-summary-header .summary-badges {
    display: flex;
    gap: 0.45rem;
    align-items: center;
}

.age-pill {
    background: #eef2ff;
    color: #4338ca;
}

.quick-assign {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.45rem;
    margin-top: 0.35rem;
}

.quick-assign .label {
    margin: 0;
}

.quick-assign-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: center;
    width: 100%;
    justify-content: flex-start;
}

.ticket-status-controls {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    margin-top: 0.6rem;
}

.ticket-status-controls .status-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: center;
}

.ticket-status-controls select {
    min-width: 180px;
}


.ticket-summary-date {
    margin: 0.35rem 0 0.75rem;
    color: var(--muted);
}

@media (max-width: 720px) {
    .ticket-summary-header .summary-title,
    .ticket-summary-header .summary-assignee,
    .ticket-summary-header .summary-badges {
        flex: 1 1 100%;
    }
    .ticket-status-controls {
        width: 100%;
    }
    .ticket-status-controls .status-form {
        width: 100%;
    }
    .ticket-status-controls select {
        width: 100%;
    }
}

.ticket-summary-meta {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}

.ticket-summary-meta .meta-row {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
}

.ticket-summary-meta .meta-block {
    min-width: 220px;
}

.ticket-highlight-new {
    background: linear-gradient(135deg, rgba(96, 165, 250, 0.12), rgba(59, 130, 246, 0.07));
}

.ticket-highlight-new .ticket-link,
.ticket-highlight-new .store-ticket-card-header .ticket-number,
.ticket-highlight-new .ticket-date,
.ticket-highlight-new .mobile-ticket-number,
.ticket-highlight-new .mobile-ticket-date {
    color: inherit;
}

.ticket-priority-urgent {
    background: #ffe4e6 !important;
}

.ticket-priority-important {
    background: #fff1f2 !important;
}

.store-ticket-card.ticket-priority-urgent {
    border-left-color: #ef4444;
}

.store-ticket-card.ticket-priority-important {
    border-left-color: #fb7185;
}

.ticket-table tbody tr.ticket-priority-urgent:hover {
    background: #ffe4e6 !important;
}

.ticket-table tbody tr.ticket-priority-important:hover {
    background: #fff1f2 !important;
}

.ticket-summary-meta .label {
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--muted);
    margin: 0;
}

.summary-assignee .label strong {
    font-weight: 800;
    color: var(--text);
    text-transform: none;
    letter-spacing: normal;
    margin-left: 0.25rem;
}

.ticket-summary-meta .value {
    margin: 0.2rem 0 0;
    font-weight: 600;
}

.ticket-thread {
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 1.2rem 1.4rem;
    background: #fff;
}

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

.ticket-timeline {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 1.2rem;
    position: relative;
}

.ticket-timeline::before {
    content: "";
    position: absolute;
    left: 12px;
    top: 4px;
    bottom: 4px;
    width: 2px;
    background: var(--border);
}

.ticket-timeline li {
    display: flex;
    gap: 0.9rem;
    position: relative;
}

.timeline-dot {
    width: 16px;
    height: 16px;
    border-radius: 999px;
    background: #e2e8f0;
    border: 2px solid #fff;
    box-shadow: 0 0 0 3px #fff;
    flex-shrink: 0;
    margin-top: 0.2rem;
}

.timeline-dot.is-active {
    background: var(--primary);
}

.timeline-dot.muted {
    background: #cbd5f5;
}

.timeline-item {
    border-radius: 16px;
    background: #f8fbff;
    padding: 0.9rem 1.1rem;
    width: 100%;
}

.timeline-meta {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 0.8rem;
}

.timeline-meta span {
    font-size: 0.85rem;
    color: var(--muted);
}

.timeline-item p {
    margin: 0.6rem 0 0.4rem;
    line-height: 1.5;
}

.timeline-tag {
    display: inline-flex;
    align-items: center;
    padding: 0.2rem 0.75rem;
    border-radius: 999px;
    background: #e0e7ff;
    color: #3730a3;
    font-size: 0.8rem;
    font-weight: 600;
}

.ticket-documents {
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 1.1rem 1.3rem;
    background: #fff;
}

.ticket-documents .document-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}

.ticket-documents .document-list li {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 0.5rem 1rem;
    align-items: center;
    border-bottom: 1px solid var(--border);
    padding-bottom: 0.4rem;
}

.document-actions {
    display: inline-flex;
    gap: 0.4rem;
    align-items: center;
}

.icon-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.65rem 0.9rem;
}

.icon-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text);
    text-decoration: none;
    font-size: 0.95rem;
    cursor: pointer;
    transition: background 0.2s ease, transform 0.2s ease;
}

.icon-link:hover {
    background: var(--primary-soft);
    transform: translateY(-1px);
}

.inline-form {
    display: inline;
}

.ticket-action-group {
    display: inline-flex;
    gap: 0.4rem;
    align-items: center;
}

.success-btn {
    background: #dcfce7;
    color: #166534;
    border: 1px solid #bbf7d0;
}

.success-btn.is-disabled,
.success-btn[disabled] {
    background: #f1f5f9;
    color: var(--muted);
    border-color: var(--border);
}

.ticket-note-form {
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 1.2rem 1.4rem;
    background: #f8fbff;
}

.ticket-note-form form {
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
    margin-top: 0.8rem;
}

.ticket-note-form .file-label {
    font-weight: 600;
    font-size: 0.95rem;
}

.ticket-note-form input[type="file"] {
    width: 100%;
}

.ticket-assign-history {
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 1rem 1.2rem;
    background: #fff;
}

.ticket-assign-history ul {
    margin: 0.5rem 0 0;
    padding-left: 1.1rem;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.ticket-assign-history li {
    line-height: 1.4;
}

.ticket-meta-line {
    display: flex;
    gap: 0.4rem;
    flex-wrap: wrap;
    align-items: center;
    margin: 0.15rem 0;
}

.priority-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.15rem 0.55rem;
    border-radius: 999px;
    font-weight: 700;
    font-size: 0.86rem;
}

.priority-urgent {
    background: #fee2e2;
    color: #b91c1c;
}

.priority-important {
    background: #fef9c3;
    color: #92400e;
}

.priority-basse {
    background: #e2e8f0;
    color: #475569;
}

.age-chip {
    display: inline-flex;
    align-items: center;
    padding: 0.15rem 0.5rem;
    background: #eef2ff;
    color: #4338ca;
    border-radius: 999px;
    font-weight: 600;
    font-size: 0.85rem;
}

.ticket-detail-side {
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 1.3rem 1.2rem;
    background: #fff;
    box-shadow: 0 15px 35px rgba(15, 23, 42, 0.05);
}

.ticket-detail-side form {
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
}

.ticket-detail-side select,
.ticket-detail-side button {
    width: 100%;
}

.ticket-action-bar {
    position: sticky;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(255, 255, 255, 0.98);
    padding: 0.75rem 1rem;
    display: flex;
    gap: 0.6rem;
    justify-content: flex-end;
    align-items: center;
    border-top: 1px solid var(--border);
    z-index: 5;
}

.ticket-action-bar .primary-action,
.ticket-action-bar .ghost-btn {
    flex: 0 0 auto;
}

@media (max-width: 720px) {
    .ticket-action-bar {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        justify-content: center;
        flex-wrap: nowrap;
        gap: 0.8rem;
        box-shadow: 0 -6px 24px rgba(0, 0, 0, 0.08);
    }
    .ticket-action-bar .primary-action,
    .ticket-action-bar .ghost-btn {
        min-width: 56px;
        width: auto;
        justify-content: center;
        text-align: center;
    }
    /* réserve de place pour la barre fixe */
    .ticket-detail-panel {
        padding-bottom: 120px;
    }
}

/* Techniciens mobile : actions côte à côte */
.role-technicien .ticket-action-bar {
    justify-content: center;
    flex-wrap: nowrap;
}

.role-technicien .ticket-action-bar .primary-action,
.role-technicien .ticket-action-bar .ghost-btn {
    width: auto;
    min-width: 46px;
}

.ticket-action-bar .primary-action {
    background: var(--primary);
    box-shadow: 0 12px 25px rgba(37, 99, 235, 0.2);
}
@media (max-width: 900px) {
    .ticket-detail-layout {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 720px) {
    .ticket-detail-layout {
        justify-items: center;
        gap: 1rem;
    }
    .ticket-detail-main,
    .ticket-summary-card,
    .ticket-thread,
    .ticket-documents,
    .ticket-note-form {
        width: 100%;
        max-width: 520px;
    }
    .ticket-thread,
    .ticket-documents,
    .ticket-note-form {
        box-sizing: border-box;
    }
}

.role-technicien .ticket-detail-layout {
    justify-content: center;
}

.role-gestionnaire .ticket-detail-layout,
.role-admin .ticket-detail-layout {
    grid-template-columns: 1fr;
}

.role-gestionnaire .ticket-detail-main,
.role-gestionnaire .ticket-summary-card,
.role-gestionnaire .ticket-thread,
.role-gestionnaire .ticket-documents,
.role-gestionnaire .ticket-note-form,
.role-admin .ticket-detail-main,
.role-admin .ticket-summary-card,
.role-admin .ticket-thread,
.role-admin .ticket-documents,
.role-admin .ticket-note-form {
    width: 100%;
    max-width: none;
    margin: 0;
    box-sizing: border-box;
}

.role-technicien .ticket-detail-main,
.role-technicien .ticket-summary-card,
.role-technicien .ticket-thread,
.role-technicien .ticket-documents,
.role-technicien .ticket-note-form {
    width: 100%;
    max-width: 600px;
    margin: 0 auto;
    box-sizing: border-box;
}

.store-tickets-panel {
    padding: 2rem;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.store-ticket-hero {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1.5rem;
}

.store-ticket-eyebrow {
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-size: 0.75rem;
    color: var(--muted);
    margin: 0 0 0.25rem;
}

.store-ticket-identity {
    margin-top: 0.8rem;
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
}

.store-ticket-identity span {
    background: #eef2ff;
    color: #3730a3;
    border-radius: 999px;
    padding: 0.25rem 0.75rem;
    font-weight: 600;
    font-size: 0.82rem;
}

.store-ticket-hero-actions {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    align-items: flex-end;
    text-align: right;
}

.store-ticket-insights {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 0.85rem;
}

.store-ticket-insights article {
    border: 1px solid var(--border);
    border-radius: 18px;
    padding: 0.9rem 1rem;
    background: #fff;
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
}

.store-ticket-insights .insight-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 0.75rem;
}

.store-ticket-insights .insight-number {
    display: block;
    font-size: 1.8rem;
    line-height: 1;
}

.store-ticket-insights .insight-title {
    display: block;
    margin: 0;
    font-weight: 800;
    font-size: 1.05rem;
    line-height: 1.25;
}

.store-ticket-insights .insight-meta {
    margin: 0;
    color: var(--muted);
    font-size: 0.88rem;
}

.store-ticket-insights .insight-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    margin-top: 0.1rem;
}

.store-ticket-insights .insight-chip {
    background: #f1f5f9;
    border-radius: 999px;
    padding: 0.2rem 0.65rem;
    font-size: 0.8rem;
    color: #0f172a;
    font-weight: 600;
}

.store-ticket-insights .insight-chip.muted {
    color: var(--muted);
    font-weight: 600;
}

.store-ticket-context-card {
    background: #f5f7ff;
    border-color: transparent;
}

.store-ticket-label {
    margin: 0;
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--muted);
}

.ghost-btn.compact {
    padding: 0.55rem 1rem;
}

.store-ticket-journey {
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
}

.store-ticket-card {
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 1rem 1.1rem;
    background: #fff;
    display: flex;
    flex-direction: column;
    gap: 0.55rem;
    border-left: 6px solid #c7d2fe;
}

.store-ticket-card h3 {
    margin: 0;
    font-size: 1.05rem;
    line-height: 1.25;
}

.store-ticket-card-header {
    display: flex;
    justify-content: space-between;
    gap: 0.75rem;
    align-items: center;
}

.ticket-number {
    display: inline-flex;
    align-items: center;
    font-weight: 700;
    color: var(--primary);
    font-size: 0.95rem;
}

.ticket-date {
    margin: 0.1rem 0 0;
    font-size: 0.82rem;
    color: var(--muted);
}

.store-ticket-card-description {
    margin: 0;
    color: var(--text);
    line-height: 1.5;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.store-ticket-card-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: center;
    justify-content: flex-start;
}

.store-ticket-card-actions .primary-action {
    padding: 0.55rem 1rem;
    font-size: 0.95rem;
    box-shadow: none;
}

.store-ticket-empty {
    border: 1px dashed var(--border);
    border-radius: 20px;
    padding: 2rem;
    background: #f9fbff;
    text-align: center;
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
    align-items: center;
}

.store-ticket-empty p {
    margin: 0;
    font-size: 1rem;
}

@media (max-width: 840px) {
    .store-ticket-hero {
        flex-direction: column;
        align-items: flex-start;
        text-align: left;
    }
    .store-ticket-hero-actions {
        align-items: flex-start;
    }
}

.primary-action {
    border-radius: 999px;
    background: var(--primary);
    color: #fff;
    padding: 0.75rem 1.5rem;
    font-weight: 600;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    box-shadow: 0 12px 25px rgba(37, 99, 235, 0.2);
}

.primary-action:hover {
    color: #fff;
    transform: translateY(-1px);
}

.ghost-btn.light {
    background: #f2f6ff;
    color: var(--primary);
}

.ticket-card header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 0.75rem;
}

.ticket-card header .hint {
    margin: 0.1rem 0 0;
}

.ticket-card-body {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}

.ticket-card-body span {
    font-size: 0.75rem;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.ticket-card footer {
    margin-top: 0.5rem;
}

.ticket-card footer form {
    display: flex;
    gap: 0.6rem;
    align-items: center;
}

.ticket-card footer select {
    min-width: 140px;
}

.ticket-header-actions {
    margin-left: auto;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 0.4rem;
    text-align: right;
}

.type-section {
    grid-column: 1 / -1;
    border: 1px solid var(--border);
    border-radius: 18px;
    padding: 1.5rem;
    background: #f8fbff;
    display: none;
    gap: 1rem;
}

.type-section.is-active {
    display: block;
}

.type-section-header h3 {
    margin: 0;
}

.type-section-header .hint {
    margin: 0.3rem 0 0;
}

.type-grid {
    margin-top: 1rem;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1.2rem;
}

.type-grid .span-2 {
    grid-column: 1 / -1;
}

@media (max-width: 900px) {
    .maintenance-form {
        grid-template-columns: 1fr;
    }
    .ticket-layout {
        grid-template-columns: 1fr;
    }
    .store-ticket-grid {
        grid-template-columns: 1fr;
    }

    /* Gestionnaire : bascule en cartes (comme mobile) plus tôt */
    .role-gestionnaire .desktop-only {
        display: none;
    }

    .role-gestionnaire .mobile-ticket-list {
        display: grid;
        gap: 1rem;
        margin-top: 1rem;
    }

    .role-gestionnaire .ticket-table-wrapper {
        overflow-x: visible;
    }

    .role-gestionnaire .ticket-table-wrapper table {
        display: none;
    }
}

@media (max-width: 720px) {
    .maintenance-form .actions {
        flex-direction: column;
        align-items: stretch;
    }

    .desktop-only {
        display: none;
    }

    .mobile-ticket-list {
        display: grid;
        gap: 1rem;
        margin-top: 1rem;
    }

    .ticket-table-wrapper {
        border: none;
        padding: 0;
    }

    .ticket-table-wrapper table {
        display: none;
    }
}

.row-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.8rem;
    align-items: center;
    font-weight: 600;
}

.row-actions a {
    text-decoration: none;
    color: var(--primary);
}

.row-actions a:hover {
    text-decoration: underline;
}

.attachments-row {
    margin: 0.2rem 0 0;
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    font-size: 0.85rem;
    color: var(--muted);
}

.attachments-row a {
    color: var(--primary);
    text-decoration: none;
    font-weight: 600;
}

.attachments-row a:hover {
    text-decoration: underline;
}

.equip-actions {
    display: flex;
    gap: 0.6rem;
    align-items: center;
    flex-wrap: wrap;
}

.equip-actions form {
    margin: 0;
}

.ghost-btn.danger {
    background: rgba(220, 38, 38, 0.1);
    color: #b91c1c;
}

.store-ticket-panel {
    padding: 2rem;
}

.store-ticket-grid {
    display: grid;
    grid-template-columns: minmax(0, 2fr) minmax(240px, 1fr);
    gap: 1.5rem;
}

.store-ticket-main,
.store-ticket-aside {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.store-ticket-form .field {
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
}

.store-ticket-form .field textarea {
    margin-top: 0.2rem;
}

.store-ticket-form textarea {
    padding: 1.15rem 1.25rem;
    line-height: 1.6;
}

.field.is-hidden {
    display: none;
}

.field.is-disabled {
    opacity: 0.5;
    position: relative;
}

.field.is-disabled select {
    pointer-events: none;
    background: #f1f5f9;
    color: #94a3b8;
    border-color: #e2e8f0;
}

.store-card {
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 1rem;
    background: #f8fbff;
}

.store-card span {
    font-size: 0.85rem;
    color: var(--muted);
}

.store-card strong {
    font-size: 1.1rem;
}

.store-ticket-actions {
    margin-top: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}

.store-ticket-actions button {
    align-self: flex-start;
    border-radius: 999px;
    padding: 0.8rem 1.6rem;
}

.equipment-meta,
.equipment-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 1rem;
}

.equipment-meta {
    padding: 1rem;
    border-radius: 18px;
    background: #f1f5f9;
}

.equipment-grid {
    margin-top: 1.2rem;
}

.equipment-grid .label,
.equipment-meta .label {
    text-transform: uppercase;
    font-size: 0.75rem;
    color: var(--muted);
    letter-spacing: 0.08em;
}

.equipment-notes {
    margin-top: 1.2rem;
    padding: 1.2rem;
    border-radius: 18px;
    background: #f8fafc;
}

.equipment-docs {
    margin-top: 1.5rem;
    padding: 1.2rem;
    border-radius: 18px;
    background: #f9fafb;
}

.docs-header {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}

.docs-header form {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.documents-list {
    list-style: none;
    padding: 0;
    margin: 1rem 0 0;
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
}

.documents-list li {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.8rem 1rem;
    border-radius: 14px;
    background: #fff;
    border: 1px solid var(--border);
    gap: 1rem;
}

.doc-actions {
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

.doc-actions a {
    color: var(--primary);
    text-decoration: none;
    font-weight: 600;
}

.doc-actions a:hover {
    text-decoration: underline;
}

.equipements-table .table-head,
.equipements-table .table-row {
    grid-template-columns: 2.2fr 1.5fr 90px 150px 160px auto;
}

.equipements-table-general .table-head,
.equipements-table-general .table-row {
    grid-template-columns: 2.2fr 1.5fr 90px 150px 160px auto;
}

.equipements-table-general .table-head div,
.equipements-table-general .table-row div {
    display: flex;
    align-items: center;
}

.equipements-table-general .table-head div:nth-child(1),
.equipements-table-general .table-row div:nth-child(1),
.equipements-table-general .table-head div:nth-child(2),
.equipements-table-general .table-row div:nth-child(2) {
    flex-direction: column;
    align-items: flex-start;
}

.equipements-table-general .table-head div:nth-child(3),
.equipements-table-general .table-row div:nth-child(3),
.equipements-table-general .table-head div:nth-child(4),
.equipements-table-general .table-row div:nth-child(4),
.equipements-table-general .table-head div:nth-child(5),
.equipements-table-general .table-row div:nth-child(5) {
    justify-content: center;
    text-align: center;
}

.equipements-table-general .table-head div:nth-child(6),
.equipements-table-general .table-row div:nth-child(6) {
    justify-content: flex-end;
}

.equipements-table-clim .table-head,
.equipements-table-clim .table-row {
    grid-template-columns: 2fr 1.4fr 1fr 1fr 1fr 1fr 1fr auto;
}

.equipements-table-sensor .table-head,
.equipements-table-sensor .table-row {
    grid-template-columns: 2fr 1.4fr 0.8fr 1fr 1fr 1.2fr auto;
}

.equipements-table-sensor .table-head div:nth-child(3),
.equipements-table-sensor .table-row div:nth-child(3),
.equipements-table-sensor .table-head div:nth-child(4),
.equipements-table-sensor .table-row div:nth-child(4),
.equipements-table-sensor .table-head div:nth-child(5),
.equipements-table-sensor .table-row div:nth-child(5) {
    text-align: center;
}

.equipements-table-sensor .table-head div:nth-child(6),
.equipements-table-sensor .table-row div:nth-child(6) {
    text-align: left;
}

.equipements-table-sensor .table-row div:nth-child(7),
.equipements-table-sensor .table-head div:nth-child(7) {
    text-align: right;
}

.equipements-table-rideau .table-head,
.equipements-table-rideau .table-row {
    grid-template-columns: 2fr 1.4fr 1fr 1fr 1.1fr 1fr 1fr auto;
}

.equipements-table-rideau .table-head div:nth-child(3),
.equipements-table-rideau .table-row div:nth-child(3),
.equipements-table-rideau .table-head div:nth-child(4),
.equipements-table-rideau .table-row div:nth-child(4),
.equipements-table-rideau .table-head div:nth-child(5),
.equipements-table-rideau .table-row div:nth-child(5),
.equipements-table-rideau .table-head div:nth-child(6),
.equipements-table-rideau .table-row div:nth-child(6),
.equipements-table-rideau .table-head div:nth-child(7),
.equipements-table-rideau .table-row div:nth-child(7) {
    text-align: center;
}

.equipements-table-rideau .table-row div:nth-child(8),
.equipements-table-rideau .table-head div:nth-child(8) {
    text-align: right;
}

.sensor-table .table-head,
.sensor-table .table-row {
    grid-template-columns: 1.2fr 0.8fr 0.8fr 0.8fr 1.3fr 1.4fr;
}

.rideau-table .table-head,
.rideau-table .table-row {
    grid-template-columns: 1fr 0.6fr 0.7fr 0.9fr 1fr 1fr 1.2fr 0.6fr 0.8fr 0.6fr 0.8fr;
}

.nav-link .text small {
    display: block;
    font-size: 0.75rem;
    color: var(--muted);
    font-weight: 400;
}

.filter-chips {
    display: flex;
    gap: 0.4rem;
    flex-wrap: wrap;
}

.filter-chips a {
    padding: 0.25rem 0.8rem;
    border-radius: 999px;
    border: 1px solid var(--border);
    color: var(--muted);
    font-size: 0.85rem;
    text-decoration: none;
}

.filter-chips a.active {
    background: var(--primary-soft);
    color: var(--primary);
    border-color: transparent;
}

.sidebar-subnav {
    margin-left: 2.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}

.sidebar-subnav a {
    font-size: 0.9rem;
    color: var(--muted);
    text-decoration: none;
    padding: 0.15rem 0;
    border-left: 2px solid transparent;
    padding-left: 0.65rem;
}

.sidebar-subnav a.active {
    color: var(--primary);
    border-color: var(--primary);
}

input,
select,
textarea {
    width: 100%;
    padding: 0.85rem 1rem;
    border-radius: 14px;
    border: 1px solid var(--border);
    background: #f8faff;
    font-size: 1rem;
    font-family: inherit;
}

textarea {
    resize: vertical;
}

input[type="checkbox"] {
    width: auto;
    height: auto;
    padding: 0;
    margin-right: 0.4rem;
}

.flash-container {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}

.flash {
    padding: 0.9rem 1.2rem;
    border-radius: 14px;
    font-weight: 500;
}

.flash-danger { background: var(--flash-danger); }
.flash-success { background: var(--flash-success); }
.flash-warning { background: var(--flash-warning); }
.flash-info { background: var(--primary-soft); }

.settings-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 1.25rem;
}

.settings-section {
    background: var(--surface);
    border-radius: 20px;
    padding: 1.25rem;
    box-shadow: var(--shadow);
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
}

.settings-section-span {
    grid-column: span 2;
}

.settings-section h3 {
    margin: 0;
}

.settings-section .hint {
    margin-top: -0.3rem;
}

.settings-users-table {
    width: 100%;
    border-collapse: collapse;
}

.settings-users-table th,
.settings-users-table td {
    padding: 0.7rem 0.5rem;
    border-bottom: 1px solid var(--border);
    text-align: left;
    vertical-align: top;
}

.settings-users-table th {
    font-size: 0.85rem;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.settings-users-table td strong {
    display: block;
}

.settings-inline-form {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    align-items: center;
    margin: 0.3rem 0;
}

.settings-inline-form select,
.settings-inline-form input {
    flex: 1;
    min-width: 130px;
}

.settings-inline-form button {
    flex: 0 0 auto;
}

.settings-form {
    display: flex;
    flex-direction: column;
    gap: 0.9rem;
}

.settings-form .field label {
    display: block;
    font-weight: 600;
    margin-bottom: 0.3rem;
}

.settings-form .field small {
    color: var(--muted);
    font-size: 0.85rem;
}

.log-viewer {
    background: #0f172a;
    color: #e2e8f0;
    border-radius: 16px;
    padding: 1rem;
    font-family: "JetBrains Mono", "Courier New", monospace;
    font-size: 0.9rem;
    max-height: 260px;
    overflow: auto;
    white-space: pre-wrap;
}

.preline {
    white-space: pre-line;
}

.magasin-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem 1.25rem;
}

.settings-doc {
    font-size: 0.9rem;
    color: var(--muted);
}

.table-wrapper {
    overflow-x: auto;
}

/* Auth */
.auth-layout {
    display: grid;
    grid-template-columns: minmax(280px, 420px) 1fr;
    min-height: 100svh;
    align-items: center;
}

.auth-panel {
    background: var(--surface);
    padding: 3rem 3.5rem;
    display: flex;
    flex-direction: column;
    gap: 1.2rem;
    box-shadow: var(--shadow-strong);
    z-index: 1;
}

.auth-hero {
    background: linear-gradient(145deg, #1d4ed8, #0f172a);
    color: #fff;
    display: flex;
    align-items: center;
    padding: 4rem;
}

.hero-content {
    max-width: 420px;
}

.hero-content h1 {
    font-size: 2.2rem;
    margin-bottom: 0.8rem;
}

.hero-content p {
    margin: 0;
}

.hero-content .muted {
    color: rgba(255, 255, 255, 0.8);
}

.auth-panel .form {
    margin-top: 1rem;
}

.auth-panel button {
    width: 100%;
}

.auth-mode .auth-panel {
    max-width: 480px;
    width: min(92vw, 520px);
    margin: 0 auto;
}

.auth-mode .auth-layout {
    padding: 1.5rem 1rem;
}

.auth-form h2 {
    margin-bottom: 0.4rem;
}

.auth-form .hint {
    margin-top: 0;
}

.sidebar-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.4);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s ease;
    z-index: 5;
}

body.sidebar-open .sidebar-backdrop {
    opacity: 1;
    visibility: visible;
}

@media (max-width: 1100px) {
    .auth-layout {
        grid-template-columns: 1fr;
        min-height: 100svh;
        padding: 1.2rem;
    }

    .auth-hero {
        min-height: 28vh;
        order: -1;
        padding: 2.5rem 1.75rem;
    }

    .app-shell {
        flex-direction: column;
    }

    .sidebar {
        position: fixed;
        inset: 0 auto 0 0;
        transform: translateX(-100%);
        height: 100vh;
        width: min(320px, 86vw);
        padding: 1.25rem 1rem;
    }

    body.sidebar-open .sidebar {
        transform: translateX(0);
    }
}

@media (min-width: 1101px) {
    .sidebar-footer {
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
    }

    .sidebar-footer .ghost-btn {
        width: auto;
        padding: 0.55rem 1rem;
    }
}

@media (max-width: 720px) {
    .auth-layout {
        min-height: 100svh;
    }
    .auth-panel {
        padding: 1.4rem 1.25rem;
        gap: 0.85rem;
    }
    .hero-content h1 {
        font-size: 1.65rem;
    }
    .hero-content p {
        font-size: 0.95rem;
    }
    .auth-hero {
        min-height: 20vh;
    }

    .auth-panel .form {
        margin-top: 0.6rem;
    }
}

@media (max-width: 720px) and (max-height: 800px) {
    .auth-hero {
        min-height: 0;
        padding: 1.2rem 1rem;
        display: none;
    }

    .auth-mode .auth-layout {
        padding: 0.8rem;
        align-items: stretch;
    }

    .hero-content h1 {
        font-size: 1.45rem;
    }

    .auth-panel {
        padding: 1.05rem 1rem 1.25rem;
    }

    .demo-accounts {
        display: none;
    }
}

.cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1rem;
}

.card-link {
    text-decoration: none;
    color: inherit;
}

.card {
    background: var(--surface);
    border-radius: 20px;
    padding: 1.25rem 1.25rem 1.1rem;
    box-shadow: var(--shadow);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.store-card {
    border: 1px solid var(--border);
}

.store-card.store-brand-oceanor {
    background: linear-gradient(135deg, rgba(96, 165, 250, 0.22), rgba(255, 255, 255, 0.96));
    border-color: rgba(59, 130, 246, 0.35);
}

.store-card.store-brand-goldcenter {
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.16), rgba(255, 255, 255, 0.96));
    border-color: rgba(239, 68, 68, 0.30);
}

.store-card.store-brand-cara {
    background: linear-gradient(135deg, rgba(250, 204, 21, 0.18), rgba(255, 255, 255, 0.96));
    border-color: rgba(250, 204, 21, 0.30);
}

.store-card.store-brand-swarovski {
    background: linear-gradient(135deg, rgba(148, 163, 184, 0.18), rgba(255, 255, 255, 0.98));
    border-color: rgba(148, 163, 184, 0.35);
}

.store-card.store-brand-mauboussin {
    background: var(--surface);
}

.store-card.store-brand-leffetpei {
    background: linear-gradient(135deg, rgba(74, 222, 128, 0.16), rgba(255, 255, 255, 0.96));
    border-color: rgba(16, 185, 129, 0.25);
}

.store-card.store-brand-mado {
    background: linear-gradient(135deg, rgba(168, 85, 247, 0.18), rgba(255, 255, 255, 0.96));
    border-color: rgba(147, 51, 234, 0.28);
}

.equipements-mobile {
    display: none;
}

.equipements-mobile-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1rem;
}

.equip-mobile-card {
    border: 1px solid var(--border);
    padding: 1rem 1.1rem;
}

.equip-mobile-card .hint {
    margin: 0.35rem 0 0.75rem;
}

.equip-mobile-meta {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.75rem 1rem;
}

.equip-mobile-meta .span-2 {
    grid-column: 1 / -1;
}

.equip-mobile-meta .label {
    display: block;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--muted);
    margin-bottom: 0.15rem;
}

.equip-mobile-meta .hint {
    display: block;
    margin: 0.15rem 0 0;
}

@media (max-width: 900px) {
    .role-gestionnaire .equipements-desktop {
        display: none;
    }

    .role-gestionnaire .equipements-mobile {
        display: block;
    }
}

.card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-strong);
}

.card-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.75rem;
}

.action-row {
    display: flex;
    gap: 0.75rem;
    align-items: center;
}

.action-row form {
    margin: 0;
}

@media (max-width: 640px) {
    .page {
        padding: 1.25rem;
    }

    .table-head,
    .table-row {
        grid-template-columns: repeat(2, minmax(140px, 1fr));
    }

    .stat-card strong {
        font-size: 1.8rem;
    }
}
