:root {
    --bg: #f7f7f8;
    --text: #111827;
    --muted: #6b7280;
    --border: #d1d5db;
    --surface: #ffffff;
    --primary: #1d4ed8;
    --primary-700: #1e40af;
    --danger: #dc2626;
    --danger-700: #b91c1c;
    --info-bg: #cff4fc;
    --info-fg: #055160;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.4;
}

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

a:hover {
    text-decoration: underline;
}

img {
    max-width: 100%;
    height: auto;
    display: block;
}

.container {
    width: 100%;
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 1rem;
}

.py-4 {
    padding-top: 1.5rem;
    padding-bottom: 1.5rem;
}

.h3 {
    font-size: 1.5rem;
    margin: 0;
}

.h6 {
    font-size: 1rem;
}

.mb-0 { margin-bottom: 0; }
.mb-1 { margin-bottom: 0.25rem; }
.mb-2 { margin-bottom: 0.5rem; }
.mb-3 { margin-bottom: 1rem; }
.mb-4 { margin-bottom: 1.5rem; }
.mt-auto { margin-top: auto; }
.mt-3 { margin-top: 1rem; }

.small {
    font-size: 0.875rem;
}

.text-body-secondary {
    color: var(--muted);
}

.text-danger {
    color: var(--danger);
}

.fw-bold,
.fw-semibold {
    font-weight: 600;
}

.row {
    display: flex;
    flex-wrap: wrap;
    margin: -0.375rem;
}

.row > * {
    padding: 0.375rem;
}

.col-12 { width: 100%; }
.col-sm-6 { width: 100%; }
.col-lg-4 { width: 100%; }
.col-md-2 { width: 100%; }
.col-md-4 { width: 100%; }

@media (min-width: 576px) {
    .col-sm-6 { width: 50%; }
}

@media (min-width: 768px) {
    .col-md-2 { width: 16.6667%; }
    .col-md-4 { width: 33.3333%; }
}

@media (min-width: 992px) {
    .col-lg-4 { width: 33.3333%; }
}

.d-flex { display: flex; }
.flex-column { flex-direction: column; }
.justify-content-between { justify-content: space-between; }
.align-items-center { align-items: center; }
.align-items-end { align-items: flex-end; }
.gap-2 { gap: 0.5rem; }
.w-100 { width: 100%; }
.h-100 { height: 100%; }

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

.form-control,
.form-select {
    width: 100%;
    padding: 0.55rem 0.7rem;
    border: 1px solid var(--border);
    border-radius: 0.5rem;
    background: #fff;
    color: var(--text);
}

.form-check {
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.form-check-input {
    width: 1rem;
    height: 1rem;
}

.btn {
    display: inline-block;
    border: 1px solid transparent;
    border-radius: 0.5rem;
    padding: 0.5rem 0.85rem;
    font-weight: 600;
    cursor: pointer;
    text-align: center;
    text-decoration: none;
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.btn-sm {
    padding: 0.35rem 0.6rem;
    font-size: 0.85rem;
}

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

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

.btn-outline-primary {
    background: transparent;
    border-color: var(--primary);
    color: var(--primary);
}

.btn-outline-primary:hover {
    background: var(--primary);
    color: #fff;
}

.btn-outline-danger {
    background: transparent;
    border-color: var(--danger);
    color: var(--danger);
}

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

.btn-outline-secondary {
    background: transparent;
    border-color: #4b5563;
    color: #374151;
}

.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 0.7rem;
    overflow: hidden;
}

.card-body {
    padding: 1rem;
}

.card-img-top {
    width: 100%;
    height: 220px;
    object-fit: cover;
    background: #e5e7eb;
}

.card-title {
    margin-top: 0;
}

.catalogue-product-title {
    line-height: 1.3;
    min-height: calc(1.3em * 2);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    margin-bottom: 0;
}

.catalogue-product-meta {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin: 0.4rem 0 0.75rem;
    flex-wrap: wrap;
}

.catalogue-etat {
    font-size: 0.75rem;
    font-weight: 600;
    padding: 0.15rem 0.5rem;
    border-radius: 999px;
    white-space: nowrap;
}

.catalogue-etat--tbe  { background: #dcfce7; color: #166534; }
.catalogue-etat--bon  { background: #dbeafe; color: #1e40af; }
.catalogue-etat--abime { background: #fee2e2; color: #991b1b; }

.catalogue-dims {
    font-size: 0.78rem;
    color: #6b7280;
    white-space: nowrap;
}

.catalogue-product-description-wrap {
    position: relative;
    height: calc(1.45em * 3);
    overflow: hidden;
    margin-top: 0.4rem;
    transition: height 0.2s ease;
}
.catalogue-product-description-wrap.is-expanded {
    height: auto;
    overflow: visible;
}
.catalogue-product-description {
    font-size: 0.82rem;
    color: #6b7280;
    line-height: 1.45;
    margin: 0;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.catalogue-product-description-wrap.is-expanded .catalogue-product-description {
    display: block;
    overflow: visible;
    -webkit-line-clamp: unset;
}
.catalogue-description-toggle {
    position: absolute;
    bottom: 4px;
    right: 0;
    font-size: 0.8rem;
    font-weight: 600;
    color: #2563eb;
    background: linear-gradient(to right, transparent, #fff 25%);
    border: none;
    padding: 0 2px 0 32px;
    cursor: pointer;
    line-height: 1.45;
    display: none;
}
.catalogue-description-toggle.is-visible {
    display: block;
}
.catalogue-product-description-wrap.is-expanded .catalogue-description-toggle {
    position: static;
    background: none;
    padding: 2px 0 0;
    display: block;
}

.catalogue-photo-trigger {
    width: 100%;
    border: 0;
    padding: 0;
    background: transparent;
    cursor: zoom-in;
}

.catalogue-add-btn:disabled {
    opacity: 1;
    background: #e5e7eb;
    border-color: #9ca3af;
    color: #6b7280;
    cursor: not-allowed;
}

.cart-items {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.cart-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.75rem;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 0.5rem;
}

.cart-photo-btn {
    flex-shrink: 0;
    width: 80px;
    background: none;
    border: none;
    padding: 0;
    cursor: zoom-in;
    border-radius: 0.375rem;
    overflow: hidden;
}

.cart-item-photo {
    width: 80px;
    height: 80px;
    object-fit: cover;
    display: block;
    border-radius: 0.375rem;
}

.cart-item-info {
    flex: 1;
    min-width: 0;
}

.cart-item-libelle {
    display: block;
    margin-bottom: 0.25rem;
}

.cart-item-action {
    flex-shrink: 0;
}

.catalogue-image-modal {
    position: fixed;
    inset: 0;
    z-index: 1200;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.catalogue-image-modal[hidden] {
    display: none;
}

.catalogue-image-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(17, 24, 39, 0.76);
}

.catalogue-image-dialog {
    position: relative;
    z-index: 1;
    margin: 0;
    width: min(96vw, 1000px);
    border-radius: 0.75rem;
    background: #111827;
    padding: 0.75rem;
}

.catalogue-image-full {
    width: 100%;
    max-height: 80vh;
    object-fit: contain;
    border-radius: 0.5rem;
    background: #000;
}

.catalogue-image-close {
    position: absolute;
    top: 0.95rem;
    right: 0.95rem;
    border: 0;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.9);
    color: #111827;
    font-weight: 600;
    padding: 0.3rem 0.7rem;
    cursor: pointer;
}

.catalogue-image-caption {
    margin: 0.55rem 0 0;
    color: #e5e7eb;
    font-size: 0.95rem;
}

.badge {
    display: inline-block;
    padding: 0.25rem 0.5rem;
    border-radius: 999px;
    font-size: 0.78rem;
    font-weight: 600;
}

.text-bg-info {
    background: var(--info-bg);
    color: var(--info-fg);
}

.text-bg-success {
    background: #dcfce7;
    color: #166534;
}

.text-bg-danger {
    background: #fee2e2;
    color: #991b1b;
}

.text-bg-warning {
    background: #ffedd5;
    color: #9a3412;
}

.text-bg-danger-inverse {
    background: #dc2626;
    color: #111827;
}

.list-group {
    display: grid;
    gap: 0.5rem;
}

.list-group-item {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 0.6rem;
    padding: 0.75rem;
}

.alert {
    border-radius: 0.55rem;
    padding: 0.7rem 0.9rem;
    border: 1px solid transparent;
}

.layout-flashes {
    margin: 0.75rem 1rem;
    display: grid;
    gap: 0.5rem;
}

.alert-global {
    margin: 0;
}

.alert-danger {
    position: relative;
    padding-left: 2.1rem;
    background: linear-gradient(135deg, #b91c1c 0%, #dc2626 100%);
    border: 2px solid #7f1d1d;
    color: #fff;
    font-weight: 700;
    box-shadow: 0 6px 18px rgba(127, 29, 29, 0.35);
}

.alert-danger::before {
    content: "!";
    position: absolute;
    left: 0.8rem;
    top: 50%;
    transform: translateY(-50%);
    width: 1rem;
    height: 1rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    background: #fff;
    color: #991b1b;
    font-size: 0.8rem;
    font-weight: 800;
}

.alert-success {
    background: #ecfdf5;
    border-color: #bbf7d0;
    color: #14532d;
}

.alert-light {
    background: #f9fafb;
    border-color: #e5e7eb;
    color: #374151;
}

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

.progress {
    height: 0.6rem;
    background: #e5e7eb;
    border-radius: 999px;
    overflow: hidden;
}

.progress-bar {
    height: 100%;
    background: #2563eb;
}

.form-shell {
    max-width: 860px;
    margin: 0 auto;
}

.admin-dashboard-shell {
    max-width: 1280px;
}

.form-head {
    margin-bottom: 1rem;
}

.form-head h1 {
    margin: 0 0 0.3rem;
}

.form-head p {
    margin: 0;
    color: var(--muted);
}

.produit-form {
    display: grid;
    gap: 1rem;
}

.form-section {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 0.75rem;
    padding: 1rem;
}

.form-section h2 {
    margin: 0 0 0.9rem;
    font-size: 1.05rem;
}

.form-grid-two,
.form-grid-three {
    display: grid;
    gap: 0.8rem;
}

.form-grid-two {
    grid-template-columns: 1fr;
}

.form-grid-three {
    grid-template-columns: 1fr;
}

.admin-dashboard-grid {
    display: grid;
    gap: 0.8rem;
    grid-template-columns: 1fr;
}

.admin-stats-section {
    background: linear-gradient(180deg, #f8fbff 0%, #ffffff 100%);
}

.admin-stats-kpis {
    display: grid;
    gap: 0.8rem;
    grid-template-columns: 1fr;
}

.admin-stats-kpi {
    background: #ffffff;
    border: 1px solid #dbe4f3;
    border-radius: 0.8rem;
    padding: 1rem;
    box-shadow: 0 8px 20px rgba(30, 64, 175, 0.08);
}

.admin-stats-label {
    margin: 0;
    font-size: 0.88rem;
    color: #4b5563;
    letter-spacing: 0.02em;
}

.admin-stats-value {
    margin: 0.35rem 0 0;
    font-size: 2rem;
    line-height: 1;
    font-weight: 700;
    color: #1e3a8a;
}

.admin-stats-days {
    margin-top: 1rem;
}

.admin-stats-day-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    gap: 0.5rem;
}

.admin-stats-day-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.8rem;
    background: #ffffff;
    border: 1px solid #dbe4f3;
    border-radius: 0.7rem;
    padding: 0.55rem 0.75rem;
}

.admin-stats-day-date {
    font-weight: 600;
    color: #1f2937;
}

.admin-stats-day-count {
    min-width: 2.1rem;
    padding: 0.1rem 0.55rem;
    border-radius: 999px;
    background: #dbeafe;
    color: #1e3a8a;
    text-align: center;
    font-weight: 700;
}

[data-admin-dashboard-stats-copy-target="feedback"][data-state="ok"] {
    color: #166534;
}

[data-admin-dashboard-stats-copy-target="feedback"][data-state="error"] {
    color: #b91c1c;
}

@media (min-width: 720px) {
    .form-grid-two {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .form-grid-three {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .admin-dashboard-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
        align-items: start;
    }

    .admin-dashboard-main {
        grid-column: auto;
    }

    .admin-stats-kpis {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

.form-toggle {
    margin-top: 0.6rem;
}

.form-toggle label {
    margin-left: 0.35rem;
}

.form-grid-end {
    align-items: end;
}

.form-end-checkbox {
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    min-height: 100%;
}

.form-help {
    margin: 0.4rem 0 0;
    color: var(--muted);
    font-size: 0.9rem;
}

.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.6rem;
    flex-wrap: wrap;
}

.photo-preview-grid {
    display: grid;
    gap: 0.8rem;
    margin-bottom: 0.9rem;
    grid-template-columns: 1fr;
}

@media (min-width: 720px) {
    .photo-preview-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

.photo-preview-card {
    border: 1px solid var(--border);
    border-radius: 0.65rem;
    background: #fafafa;
    padding: 0.65rem;
}

.photo-preview-title {
    margin: 0 0 0.45rem;
    font-size: 0.88rem;
    color: var(--muted);
    font-weight: 600;
}

.photo-preview-img {
    width: 100%;
    height: 170px;
    border-radius: 0.45rem;
    border: 1px solid #e5e7eb;
    object-fit: cover;
    background: #f3f4f6;
}

.photo-preview-empty {
    min-height: 170px;
    border-radius: 0.45rem;
    border: 1px dashed #d1d5db;
    display: grid;
    place-items: center;
    background: #f9fafb;
    color: var(--muted);
    font-size: 0.92rem;
}

.dmax-list-shell {
    display: grid;
    gap: 1rem;
}

.dmax-list-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.dmax-list-head h1 {
    margin: 0;
}

.dmax-filter-bar {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 0.7rem;
    padding: 0.8rem;
    display: grid;
    gap: 0.75rem;
    grid-template-columns: 1fr;
}

@media (min-width: 760px) {
    .dmax-filter-bar {
        grid-template-columns: repeat(3, minmax(0, 1fr));
        align-items: end;
    }
}

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

.dmax-list-meta {
    color: var(--muted);
}

.dmax-table-wrap {
    overflow: auto;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 0.7rem;
}

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

.dmax-table th,
.dmax-table td {
    border-bottom: 1px solid #e5e7eb;
    padding: 0.75rem;
    text-align: left;
    vertical-align: middle;
}

.dmax-table th {
    font-size: 0.9rem;
    color: var(--muted);
    background: #fafafa;
}

.dmax-thumb {
    width: 220px;
    height: 140px;
    object-fit: cover;
    border-radius: 0.5rem;
    border: 1px solid #e5e7eb;
    background: #f3f4f6;
}

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

.dmax-actions-stack {
    flex-direction: column;
    align-items: stretch;
}

.dmax-actions-stack form,
.dmax-actions-stack .btn {
    width: 100%;
}

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

.catalogue-pager {
    margin-top: 2rem;
}

.is-disabled {
    pointer-events: none;
    opacity: 0.5;
}

body.login-page {
    min-height: 100vh;
    background: #0f172a;
}

.login-screen {
    position: relative;
    min-height: 100vh;
    padding: 1.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    background-image:
        linear-gradient(120deg, rgba(10, 18, 36, 0.62) 0%, rgba(10, 18, 36, 0.42) 44%, rgba(10, 18, 36, 0.22) 100%),
        var(--login-bg-image);
    background-position: center;
    background-size: cover;
    background-repeat: no-repeat;
}

.login-hero {
    position: absolute;
    top: 1.5rem;
    left: 1.5rem;
    color: #f8fafc;
    max-width: calc(50% - 1.5rem);
}

.login-hero-title {
    margin: 0 0 0.4rem;
    font-size: clamp(2.1rem, 6vw, 4.4rem);
    letter-spacing: 0.1em;
    font-weight: 800;
}

.login-hero-subtitle {
    display: none;
    margin: 0;
    font-size: clamp(1rem, 1.5vw, 1.3rem);
    line-height: 1.4;
    white-space: nowrap;
}

@media (min-width: 640px) {
    .login-hero-subtitle {
        display: block;
    }
}

.login-acrostic {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 1.5rem;
    padding: 0 0.2rem;
    margin-right: 0.05rem;
    border-radius: 0.3rem;
    color: #111827;
    background: #fde68a;
    font-weight: 800;
}

.login-panel {
    width: 100%;
    max-width: 460px;
    background: rgba(255, 255, 255, 0.94);
    backdrop-filter: blur(2px);
    border: 1px solid rgba(255, 255, 255, 0.35);
    border-radius: 0.85rem;
    padding: 1.2rem;
    box-shadow: 0 20px 36px rgba(2, 6, 23, 0.26);
}

.login-panel-title {
    margin: 0 0 0.9rem;
    font-size: 1.4rem;
}

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

.login-error {
    margin-bottom: 0.8rem;
    padding: 0.7rem 0.85rem;
    border-radius: 0.55rem;
    border: 1px solid #fecaca;
    color: #7f1d1d;
    background: #fef2f2;
}

.login-submit {
    width: 100%;
}

.login-footer {
    position: absolute;
    bottom: 1.25rem;
    left: 50%;
    transform: translateX(-50%);
    text-align: center;
}
.login-footer a {
    font-size: 0.78rem;
    color: rgba(255, 255, 255, 0.65);
    text-decoration: none;
}
.login-footer a:hover {
    color: #fff;
    text-decoration: underline;
}
