/* ============================================================
   Design system - Padel Events Club
   Inspire des dashboards SaaS modernes (Linear/Vercel/Stripe) :
   sidebar sombre fixe, contenu clair, palette neutre + un seul
   accent, typographie compacte, composants sobres.
   ============================================================ */

:root {
    --bg: #f6f7f9;
    --surface: #ffffff;
    --surface-2: #f1f2f5;
    --border: #e5e7eb;
    --border-strong: #d7dae0;
    --text: #191b1f;
    --text-muted: #6b7280;
    --text-faint: #9aa0ab;

    --sidebar-bg: #14151a;
    --sidebar-bg-alt: #1b1c22;
    --sidebar-text: #a9adba;
    --sidebar-text-active: #ffffff;
    --sidebar-hover: rgba(255, 255, 255, 0.06);
    --sidebar-active-bg: rgba(16, 185, 129, 0.16);
    --sidebar-border: rgba(255, 255, 255, 0.08);

    --primary: #10b981;
    --primary-hover: #0d9d6f;
    --primary-strong: #047857;
    --primary-tint: #e3f8ee;
    --primary-text: #047857;

    --danger: #e5484d;
    --danger-hover: #d33d42;
    --danger-tint: #fdecec;
    --danger-text: #c13a3e;

    --warning-tint: #fef3c7;
    --warning-text: #92400e;

    --neutral-tint: #eef0f3;
    --neutral-text: #565c66;

    --radius-lg: 14px;
    --radius: 10px;
    --radius-sm: 7px;
    --sidebar-w: 258px;

    --shadow-sm: 0 1px 2px rgba(16, 24, 40, 0.04);
    --shadow: 0 1px 3px rgba(16, 24, 40, 0.06), 0 4px 12px rgba(16, 24, 40, 0.05);
    --shadow-hover: 0 4px 10px rgba(16, 24, 40, 0.07), 0 10px 24px rgba(16, 24, 40, 0.07);
}

* {
    box-sizing: border-box;
}

html {
    -webkit-text-size-adjust: 100%;
}

body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, Arial, sans-serif;
    background: var(--bg);
    color: var(--text);
    font-size: 14px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

a {
    color: var(--primary-text);
}

h1, h2, h3 {
    font-weight: 650;
    letter-spacing: -0.012em;
    margin: 0;
}

h2 { font-size: 1.375rem; }
h3 { font-size: 1.05rem; }

.icon {
    width: 1.05rem;
    height: 1.05rem;
    flex-shrink: 0;
}

/* ============ Shell layout (sidebar + main) ============ */

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

.sidebar {
    width: var(--sidebar-w);
    flex-shrink: 0;
    background: var(--sidebar-bg);
    color: var(--sidebar-text);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    z-index: 30;
    transition: transform 0.2s ease;
    overflow: hidden;
}

/* Seule cette zone (les liens de navigation) defile si le contenu depasse la hauteur d'ecran ;
   l'en-tete (logo/modules) et le pied (utilisateur/deconnexion) restent toujours visibles.
   Sans ca, un contenu de sidebar plus haut que 100vh fait apparaitre un ascenseur sur toute la
   page (une position:fixed qui deborde compte quand meme dans le scroll de la fenetre). */
.sidebar-scroll {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.18) transparent;
}

.sidebar-scroll::-webkit-scrollbar {
    width: 6px;
}

.sidebar-scroll::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.18);
    border-radius: 999px;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 1.1rem 1.15rem;
    color: #fff;
    font-weight: 700;
    font-size: 0.95rem;
    border-bottom: 1px solid var(--sidebar-border);
    white-space: nowrap;
}

.logo-dot {
    width: 1.7rem;
    height: 1.7rem;
    border-radius: 8px;
    background: linear-gradient(135deg, var(--primary), var(--primary-strong));
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 0.85rem;
    flex-shrink: 0;
}

.sidebar-modules {
    display: flex;
    gap: 0.4rem;
    padding: 0.85rem 0.9rem 0.7rem;
}

.module-pill {
    flex: 1;
    text-align: center;
    padding: 0.4rem 0.5rem;
    border-radius: var(--radius-sm);
    font-size: 0.78rem;
    font-weight: 600;
    text-decoration: none;
    color: var(--sidebar-text);
    background: var(--sidebar-hover);
}

.module-pill.is-active {
    background: var(--primary);
    color: #06231a;
}

a.module-pill:hover {
    background: rgba(255, 255, 255, 0.12);
    color: #fff;
}

.module-pill.is-soon {
    opacity: 0.4;
    cursor: default;
}

.sidebar-section-label {
    font-size: 0.68rem;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    color: var(--text-faint);
    padding: 0.9rem 1.15rem 0.35rem;
    font-weight: 600;
}

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

.sidebar-nav a {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    padding: 0.55rem 0.65rem;
    border-radius: var(--radius-sm);
    color: var(--sidebar-text);
    text-decoration: none;
    font-size: 0.86rem;
    font-weight: 500;
}

.sidebar-nav a:hover {
    background: var(--sidebar-hover);
    color: #fff;
}

.sidebar-nav a.active {
    background: var(--sidebar-active-bg);
    color: #fff;
    font-weight: 600;
}

.sidebar-nav a.active .icon {
    color: var(--primary);
}

/* Sous-menu (ex: "Produits" regroupant Tous les produits / Catégories / Stock) : la ligne parente
   n'est pas cliquable (juste un intitulé de groupe), les liens enfants sont indentés et légèrement
   plus petits pour se distinguer visuellement des liens de premier niveau. */
.sidebar-nav .nav-group-label {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    padding: 0.55rem 0.65rem 0.15rem;
    color: var(--text-faint);
    font-size: 0.78rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.sidebar-nav a.nav-sub {
    padding-left: 2.2rem;
    font-size: 0.83rem;
}

/* Petit compteur d'action a cote d'un lien de menu (ex: "3" sur "Commandes en attente") - pousse
   a droite via margin-left:auto sur le lien flex parent (.sidebar-nav a est display:flex). */
.nav-badge {
    margin-left: auto;
    background: var(--danger-tint);
    color: var(--danger-text);
    border-radius: 999px;
    font-size: 0.7rem;
    font-weight: 700;
    padding: 0.05rem 0.45rem;
    line-height: 1.4;
}

.sidebar-nav a.active .nav-badge {
    background: rgba(255, 255, 255, 0.25);
    color: #fff;
}

.sidebar-footer {
    border-top: 1px solid var(--sidebar-border);
    padding: 0.85rem 1.15rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
}

.sidebar-user {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    min-width: 0;
}

.sidebar-avatar {
    width: 1.9rem;
    height: 1.9rem;
    border-radius: 50%;
    background: var(--sidebar-hover);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.78rem;
    font-weight: 700;
    flex-shrink: 0;
}

.sidebar-username {
    font-size: 0.83rem;
    color: #fff;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-footer a {
    color: var(--sidebar-text);
    display: inline-flex;
    padding: 0.4rem;
    border-radius: var(--radius-sm);
}

.sidebar-footer a:hover {
    color: #fff;
    background: var(--sidebar-hover);
}

.shell-main {
    flex: 1;
    margin-left: var(--sidebar-w);
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.shell-topbar {
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    padding: 1rem 2rem;
    position: sticky;
    top: 0;
    z-index: 20;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.nav-toggle-btn {
    display: none;
    align-items: center;
    justify-content: center;
    width: 2.1rem;
    height: 2.1rem;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: var(--surface);
    cursor: pointer;
    flex-shrink: 0;
}

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

.shell-content {
    padding: 1.75rem 2rem 3rem;
    max-width: 1280px;
    width: 100%;
}

.sidebar-scrim {
    display: none;
}

/* Page autonome sans shell (ex: erreur de config avant authentification) */
.container {
    max-width: 640px;
    margin: 3rem auto;
    padding: 0 1.25rem;
}

/* ============ Page header / typography helpers ============ */

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

.hint {
    color: var(--text-muted);
    font-size: 0.86rem;
    margin: -0.7rem 0 1.15rem;
}

/* ============ Alerts ============ */

.alert {
    display: flex;
    align-items: flex-start;
    gap: 0.6rem;
    padding: 0.75rem 1rem;
    border-radius: var(--radius);
    margin-bottom: 1rem;
    font-size: 0.88rem;
    border: 1px solid transparent;
}

.alert-success { background: var(--primary-tint); color: var(--primary-strong); border-color: rgba(16, 185, 129, 0.2); }
.alert-warning { background: var(--warning-tint); color: var(--warning-text); border-color: rgba(146, 64, 14, 0.15); }
.alert-error { background: var(--danger-tint); color: var(--danger-text); border-color: rgba(193, 58, 62, 0.18); }

/* ============ Cards ============ */

.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1.4rem 1.5rem;
    box-shadow: var(--shadow-sm);
}

.order-list {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}

.order-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 0.95rem 1.15rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
    box-shadow: var(--shadow-sm);
    transition: box-shadow 0.15s ease, border-color 0.15s ease;
}

.order-card:hover {
    box-shadow: var(--shadow);
    border-color: var(--border-strong);
}

.order-card-warning {
    border-left: 4px solid var(--warning-text);
    background: var(--warning-tint);
}

.order-card-danger {
    border-left: 4px solid var(--danger-text);
    background: var(--danger-tint);
}

.dash-table tr.row-warning td {
    background: var(--warning-tint);
}

.dash-table tr.row-danger td {
    background: var(--danger-tint);
}

.product-thumb {
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
}

a.product-thumb {
    color: var(--text);
    text-decoration: none;
}

a.product-thumb:hover {
    color: var(--primary-text);
    text-decoration: underline;
}

.product-thumb img {
    width: 32px;
    height: 32px;
    object-fit: cover;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    flex-shrink: 0;
}

.product-thumb-placeholder {
    width: 32px;
    height: 32px;
    border-radius: var(--radius-sm);
    border: 1px dashed var(--border-strong);
    flex-shrink: 0;
    background: var(--surface-2);
}

.order-info {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    min-width: 0;
}

.order-ref {
    font-weight: 700;
    font-size: 1.05rem;
    text-decoration: none;
    color: var(--primary-text);
    letter-spacing: -0.01em;
}

.order-ref:hover {
    text-decoration: underline;
}

.order-meta {
    color: var(--text-muted);
    font-size: 0.83rem;
}

.order-amount {
    font-weight: 650;
    font-size: 1.02rem;
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}

.order-actions {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.order-card-column {
    flex-direction: column;
    align-items: stretch;
    gap: 0.75rem;
}

.order-card-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
}

/* ============ Badges ============ */

.badge {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.2rem 0.6rem;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 600;
    white-space: nowrap;
    text-decoration: none;
}

a.badge {
    transition: opacity 0.12s ease;
}

a.badge:hover {
    opacity: 0.8;
}

.badge::before {
    content: "";
    width: 0.4rem;
    height: 0.4rem;
    border-radius: 50%;
    background: currentColor;
    flex-shrink: 0;
}

.badge-success { background: var(--primary-tint); color: var(--primary-strong); }
.badge-warning { background: var(--warning-tint); color: var(--warning-text); }
.badge-danger { background: var(--danger-tint); color: var(--danger-text); }
.badge-neutral { background: var(--neutral-tint); color: var(--neutral-text); }

.badge-late {
    color: var(--danger-text);
    font-weight: 700;
}

/* Interrupteur (toggle) - ex: colonne "Publié" des produits, pour changer un statut d'un clic sans
   bouton distinct dans la colonne Actions. Pur CSS (le clic soumet directement le formulaire
   parent, comme n'importe quel bouton "submit" - pas besoin de JS pour l'aspect "interrupteur"). */
.toggle-switch {
    position: relative;
    display: inline-block;
    width: 2.35rem;
    height: 1.3rem;
    border-radius: 999px;
    border: none;
    background: var(--border-strong);
    cursor: pointer;
    padding: 0;
    vertical-align: middle;
    transition: background 0.15s ease;
}

.toggle-switch:hover {
    filter: brightness(0.94);
}

.toggle-switch.is-on {
    background: var(--primary);
}

.toggle-switch .toggle-knob {
    position: absolute;
    top: 0.15rem;
    left: 0.15rem;
    width: 1rem;
    height: 1rem;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
    transition: transform 0.15s ease;
}

.toggle-switch.is-on .toggle-knob {
    transform: translateX(1.05rem);
}

/* ============ Buttons ============ */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    background: var(--primary);
    color: #06231a;
    border: 1px solid transparent;
    padding: 0.5rem 0.9rem;
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    white-space: nowrap;
    transition: background 0.12s ease, transform 0.05s ease, box-shadow 0.12s ease;
    box-shadow: var(--shadow-sm);
}

.btn:hover {
    background: var(--primary-hover);
}

.btn:active {
    transform: scale(0.98);
}

.btn:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

.btn-block {
    width: 100%;
}

.btn-secondary {
    background: var(--surface);
    color: var(--text);
    border-color: var(--border-strong);
    box-shadow: none;
}

.btn-secondary:hover {
    background: var(--surface-2);
}

.btn-danger {
    background: var(--danger);
    color: #fff;
}

.btn-danger:hover {
    background: var(--danger-hover);
}

.btn-sm {
    padding: 0.36rem 0.65rem;
    font-size: 0.78rem;
}

.empty-state {
    text-align: center;
    color: var(--text-muted);
    padding: 3.5rem 1rem;
    background: var(--surface);
    border: 1px dashed var(--border-strong);
    border-radius: var(--radius-lg);
    font-size: 0.9rem;
}

/* ============ Login ============ */

body.login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: var(--sidebar-bg);
    background-image: radial-gradient(circle at 20% 20%, rgba(16, 185, 129, 0.18), transparent 45%),
                       radial-gradient(circle at 80% 80%, rgba(16, 185, 129, 0.1), transparent 45%);
}

form.login-form {
    max-width: 360px;
    width: 100%;
    margin: 0 1.25rem;
    padding: 2rem 1.9rem;
    display: flex;
    flex-direction: column;
    gap: 1.1rem;
    background: var(--surface);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-hover);
    border: 1px solid rgba(255, 255, 255, 0.06);
}

.login-form h1 {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    font-size: 1.1rem;
    margin: 0;
}

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

.field label {
    font-size: 0.8rem;
    color: var(--text-muted);
    font-weight: 500;
}

.field input {
    padding: 0.6rem 0.75rem;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
    font-size: 0.95rem;
    background: var(--surface);
    color: var(--text);
}

.field input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-tint);
}

/* ============ Onglets (ex: page evenement : contenu vs inscriptions) ============
   Meme astuce que le menu mobile (input radio cache + label ~ selecteur general) : pas de JS. */

.tab-radio {
    display: none;
}

.tab-bar {
    display: flex;
    gap: 0.4rem;
    border-bottom: 1px solid var(--border);
    margin-bottom: 1.4rem;
}

.tab-btn {
    padding: 0.65rem 0.2rem;
    margin-right: 1.2rem;
    font-size: 0.92rem;
    font-weight: 600;
    color: var(--text-muted);
    cursor: pointer;
    border-bottom: 2px solid transparent;
    display: flex;
    align-items: center;
    gap: 0.45rem;
}

.tab-btn:hover {
    color: var(--text);
}

.tab-count {
    background: var(--neutral-tint);
    color: var(--neutral-text);
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 700;
    padding: 0.1rem 0.5rem;
}

.tab-panel {
    display: none;
}

#tab-content:checked ~ #panel-content,
#tab-registrations:checked ~ #panel-registrations,
#tab-waitlist:checked ~ #panel-waitlist,
#tab-info:checked ~ #panel-info,
#tab-variants:checked ~ #panel-variants,
#tab-images:checked ~ #panel-images,
#tab-suppliers:checked ~ #panel-suppliers,
#tab-stock:checked ~ #panel-stock {
    display: block;
}

#tab-content:checked ~ .tab-bar label[for="tab-content"],
#tab-registrations:checked ~ .tab-bar label[for="tab-registrations"],
#tab-waitlist:checked ~ .tab-bar label[for="tab-waitlist"],
#tab-info:checked ~ .tab-bar label[for="tab-info"],
#tab-variants:checked ~ .tab-bar label[for="tab-variants"],
#tab-images:checked ~ .tab-bar label[for="tab-images"],
#tab-suppliers:checked ~ .tab-bar label[for="tab-suppliers"],
#tab-stock:checked ~ .tab-bar label[for="tab-stock"] {
    color: var(--text);
    border-bottom-color: var(--primary);
}

#tab-registrations:checked ~ .tab-bar label[for="tab-registrations"] .tab-count,
#tab-waitlist:checked ~ .tab-bar label[for="tab-waitlist"] .tab-count,
#tab-variants:checked ~ .tab-bar label[for="tab-variants"] .tab-count,
#tab-images:checked ~ .tab-bar label[for="tab-images"] .tab-count,
#tab-suppliers:checked ~ .tab-bar label[for="tab-suppliers"] .tab-count {
    background: var(--primary-tint);
    color: var(--primary-strong);
}

/* ============ Editeur de texte enrichi ============ */

.richtext {
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
    overflow: hidden;
}

.richtext-toolbar {
    display: flex;
    gap: 0.25rem;
    padding: 0.4rem;
    background: var(--surface-2);
    border-bottom: 1px solid var(--border);
}

.richtext-toolbar button {
    width: 1.9rem;
    height: 1.9rem;
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    background: transparent;
    color: var(--text);
    font-size: 0.85rem;
    cursor: pointer;
}

.richtext-toolbar button:hover {
    background: var(--surface);
    border-color: var(--border-strong);
}

.richtext-editor {
    padding: 0.65rem 0.75rem;
    min-height: 6rem;
    font-size: 0.95rem;
    line-height: 1.5;
}

.richtext-editor:focus {
    outline: none;
}

.richtext-editor ul,
.richtext-editor ol {
    padding-left: 1.4rem;
    margin: 0.4rem 0;
}

/* ============ Status buttons (retraits) ============ */

.status-buttons {
    display: flex;
    align-items: center;
    gap: 0;
    flex-wrap: wrap;
}

.status-buttons form {
    display: flex;
    align-items: center;
}

.status-buttons form:not(:last-child)::after {
    content: "";
    width: 1.5rem;
    height: 2px;
    background: var(--border-strong);
    margin: 0 0.3rem;
    flex-shrink: 0;
}

.status-buttons form.step-done:not(:last-child)::after {
    background: var(--primary);
}

.btn-status {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    background: var(--surface);
    border: 1px solid var(--border-strong);
    color: var(--text);
    padding: 0.45rem 0.75rem;
    border-radius: 999px;
    font-size: 0.8rem;
    font-weight: 500;
    cursor: pointer;
}

.btn-status:hover {
    background: var(--surface-2);
}

.btn-status .step-dot {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.1rem;
    height: 1.1rem;
    border-radius: 50%;
    background: var(--border-strong);
    color: #fff;
    font-size: 0.65rem;
    font-weight: 700;
    flex-shrink: 0;
}

.btn-status.step-done .step-dot {
    background: var(--primary);
    color: #06231a;
}

.btn-status.active {
    background: var(--primary);
    color: #06231a;
    border-color: var(--primary);
    font-weight: 650;
}

.btn-status.active .step-dot {
    background: #06231a;
    color: var(--primary);
}

/* ============ Tables (shared look) ============ */

.table-wrap {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    overflow-x: auto;
}

.summary-table,
.dash-table,
.lines-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.87rem;
}

.dash-table { min-width: 780px; }

.summary-table th,
.dash-table th,
.lines-table th {
    text-align: left;
    color: var(--text-faint);
    font-size: 0.71rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 650;
    padding: 0.7rem 0.85rem;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}

.summary-table td,
.dash-table td,
.lines-table td {
    padding: 0.65rem 0.85rem;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}

.summary-table tr:last-child td,
.dash-table tr:last-child td,
.lines-table tr:last-child td {
    border-bottom: none;
}

.dash-table tr:hover td {
    background: var(--surface-2);
}

table[data-sortable] th[data-sort] {
    cursor: pointer;
    user-select: none;
}

table[data-sortable] th[data-sort]:hover {
    color: var(--text);
}

table[data-sortable] th[data-sort]::after {
    content: "\2195";
    margin-left: 0.3rem;
    opacity: 0.35;
    font-size: 0.8em;
}

table[data-sortable] th[data-sort].sorted-asc::after {
    content: "\2191";
    opacity: 1;
}

table[data-sortable] th[data-sort].sorted-desc::after {
    content: "\2193";
    opacity: 1;
}

.summary-table td.num, .summary-table th.num,
.dash-table td.num, .dash-table th.num,
.lines-table td.num, .lines-table th.num {
    text-align: right;
    font-variant-numeric: tabular-nums;
}

.dash-actions {
    display: flex;
    gap: 0.4rem;
    flex-wrap: wrap;
}

.qty-pill {
    display: inline-flex;
    min-width: 1.8rem;
    justify-content: center;
    background: var(--primary-tint);
    color: var(--primary-strong);
    font-weight: 700;
    border-radius: 999px;
    padding: 0.15rem 0.5rem;
    font-size: 0.82rem;
}

/* Standalone card wrapper kept for older markup using .card > table directly */
.card .summary-table,
.card .lines-table {
    margin-top: 0.25rem;
}

/* ============ Order detail ============ */

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

.back-link {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.85rem;
    margin-bottom: 0.9rem;
    font-weight: 500;
}

.back-link:hover {
    color: var(--text);
}

.contact-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 0.9rem;
    font-size: 0.9rem;
}

.contact-grid .stat-label {
    color: var(--text-faint);
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    display: block;
    margin-bottom: 0.2rem;
    font-weight: 650;
}

.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 0.7rem;
    margin-bottom: 1.4rem;
}

.stat-tile {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 0.9rem 1.05rem;
    box-shadow: var(--shadow-sm);
}

.stat-tile .stat-label {
    color: var(--text-faint);
    font-size: 0.71rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.3rem;
    font-weight: 650;
}

.stat-tile .stat-value {
    font-size: 1.25rem;
    font-weight: 700;
}

.section-card {
    margin-bottom: 1.4rem;
}

/* ============ Actions groupées (bulk-toolbar) ============ */

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

.bulk-toolbar-groups {
    display: flex;
    align-items: stretch;
    gap: 0.9rem;
    flex-wrap: wrap;
}

.bulk-toolbar-group {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    background: var(--surface-2);
    border-radius: var(--radius-sm);
    padding: 0.75rem 0.9rem;
    flex: 1 1 260px;
}

.bulk-toolbar-group-title {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-weight: 650;
    font-size: 0.82rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.02em;
}

.bulk-toolbar-group-title .icon {
    width: 1rem;
    height: 1rem;
}

.bulk-toolbar-controls {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.bulk-toolbar-percent {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    background: var(--surface);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
    padding: 0 0.6rem;
    height: 2.05rem;
}

.bulk-toolbar-percent input {
    width: 3rem;
    border: none;
    background: transparent;
    padding: 0;
    font-size: 0.9rem;
    color: var(--text);
}

.bulk-toolbar-percent input:focus {
    outline: none;
}

.bulk-toolbar-percent span {
    color: var(--text-muted);
    font-size: 0.85rem;
}

/* Cases a cocher (selection multiple produits) : agrandies et teintees a la couleur de l'appli -
   sinon la case native du navigateur est minuscule et grise, peu visible dans le tableau. */
#productsTable input[type="checkbox"] {
    width: 1.05rem;
    height: 1.05rem;
    accent-color: var(--primary);
    cursor: pointer;
}

/* ============ Responsive ============ */

@media (max-width: 960px) {
    .sidebar {
        transform: translateX(-100%);
        box-shadow: var(--shadow-hover);
    }

    .shell-main {
        margin-left: 0;
    }

    .nav-toggle-btn {
        display: inline-flex;
    }

    .nav-toggle-checkbox:checked ~ .shell .sidebar,
    .nav-toggle-checkbox:checked ~ .sidebar {
        transform: translateX(0);
    }

    .nav-toggle-checkbox:checked ~ .shell .sidebar-scrim,
    .nav-toggle-checkbox:checked ~ .sidebar-scrim {
        display: block;
    }

    .sidebar-scrim {
        position: fixed;
        inset: 0;
        background: rgba(10, 12, 15, 0.45);
        z-index: 25;
    }
}

@media (max-width: 640px) {
    .shell-topbar {
        padding: 0.85rem 1.1rem;
    }
    .shell-content {
        padding: 1.25rem 1.1rem 2.5rem;
    }
    .order-card {
        flex-direction: column;
        align-items: stretch;
    }
    .order-actions {
        justify-content: stretch;
    }
    .order-actions form {
        flex: 1;
    }
    .detail-header .order-actions {
        width: 100%;
    }
    .btn {
        text-align: center;
        width: 100%;
    }
}
