/* =========================================================
   STOCKQUINCA HMI — STYLE BUREAU PRO
   CSS local, sans Vite, sans CDN
========================================================= */

* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    margin: 0;
    background: #eef3f9;
    color: #0f172a;
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    font-size: 14px;
}

/* =========================================================
   TOPBAR
========================================================= */

.sq-topbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 74px;
    z-index: 1000;
    background: #ffffff;
    border-bottom: 1px solid #dbe4ef;
    box-shadow: 0 8px 28px rgba(15, 23, 42, 0.07);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
}

.sq-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 270px;
}

.sq-brand-mark {
    width: 46px;
    height: 46px;
    border-radius: 16px;
    background: linear-gradient(135deg, #1d4ed8, #16a34a);
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 950;
    text-decoration: none;
    box-shadow: 0 12px 26px rgba(37, 99, 235, 0.25);
}

.sq-brand-title {
    font-size: 18px;
    font-weight: 950;
    line-height: 1;
    color: #0f172a;
}

.sq-brand-subtitle {
    margin-top: 5px;
    font-size: 12px;
    font-weight: 700;
    color: #64748b;
}

.sq-quickbar {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    flex: 1;
    overflow-x: auto;
    padding: 0 20px;
}

.sq-quick-link {
    height: 40px;
    padding: 0 16px;
    border-radius: 13px;
    background: #f8fafc;
    border: 1px solid #dbe4ef;
    color: #0f172a;
    text-decoration: none;
    font-size: 13px;
    font-weight: 900;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    white-space: nowrap;
}

.sq-quick-link:hover {
    background: #2563eb;
    border-color: #2563eb;
    color: #ffffff;
}

.sq-account {
    min-width: 190px;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 12px;
}

.sq-account-name {
    font-size: 13px;
    font-weight: 900;
    color: #0f172a;
}

.sq-logout-button {
    height: 38px;
    border: none;
    border-radius: 12px;
    padding: 0 14px;
    background: #fee2e2;
    color: #b91c1c;
    font-size: 12px;
    font-weight: 900;
    cursor: pointer;
}

/* =========================================================
   SIDEBAR
========================================================= */

.sq-sidebar {
    position: fixed;
    top: 74px;
    left: 0;
    bottom: 0;
    width: 280px;
    background: #0f172a;
    color: #e2e8f0;
    border-right: 1px solid #1e293b;
    overflow-y: auto;
    z-index: 900;
}

.sq-sidebar-inner {
    padding: 20px 14px 26px;
}

.sq-sidebar-title {
    margin: 0 8px 18px;
    color: #94a3b8;
    font-size: 12px;
    font-weight: 950;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.sq-menu-section {
    margin-bottom: 22px;
}

.sq-menu-heading {
    margin: 0 8px 9px;
    color: #64748b;
    font-size: 11px;
    font-weight: 950;
    text-transform: uppercase;
    letter-spacing: 0.07em;
}

.sq-nav {
    display: flex;
    flex-direction: column;
    gap: 7px;
}

.sq-nav-link {
    width: 100%;
    min-height: 46px;
    padding: 10px 12px;
    border-radius: 15px;
    display: flex;
    align-items: center;
    gap: 12px;
    color: #cbd5e1;
    text-decoration: none;
    font-size: 14px;
    font-weight: 850;
    line-height: 1.25;
    border: 1px solid transparent;
}

.sq-nav-link:hover {
    background: rgba(255, 255, 255, 0.08);
    color: #ffffff;
}

.sq-nav-link.active {
    background: #2563eb;
    color: #ffffff;
    box-shadow: 0 14px 26px rgba(37, 99, 235, 0.28);
}

.sq-nav-badge {
    min-width: 31px;
    width: 31px;
    height: 31px;
    border-radius: 11px;
    background: rgba(255, 255, 255, 0.10);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #ffffff;
    font-size: 11px;
    font-weight: 950;
}

.sq-nav-text {
    flex: 1;
}

.sq-version-box {
    margin-top: 25px;
    padding: 15px;
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.sq-version-box strong {
    display: block;
    font-size: 13px;
    font-weight: 950;
}

.sq-version-box span {
    display: block;
    margin-top: 4px;
    color: #94a3b8;
    font-size: 12px;
    font-weight: 700;
}

/* =========================================================
   STRUCTURE CENTRALE
========================================================= */

main {
    margin-left: 280px;
    padding-top: 74px;
    min-height: 100vh;
    background: linear-gradient(180deg, #f6f9fd 0%, #eef3f9 100%);
}

header.bg-white {
    margin-left: 280px;
    padding-top: 74px;
    background: #ffffff;
    border-bottom: 1px solid #dbe4ef;
}

header.bg-white > div,
main > .py-6,
main > .py-8,
.sq-page-wrap {
    width: 100%;
    max-width: 1420px;
    margin-left: auto;
    margin-right: auto;
    padding-left: 34px;
    padding-right: 34px;
}

main > .py-6,
main > .py-8,
.sq-page-wrap {
    padding-top: 30px;
    padding-bottom: 34px;
}

main .max-w-7xl,
main .max-w-6xl,
main .max-w-5xl,
main .max-w-4xl,
main .max-w-3xl {
    width: 100%;
    max-width: 1420px;
}

/* =========================================================
   UTILITAIRES TAILWIND LOCAUX
========================================================= */

.flex { display: flex !important; }
.inline-flex { display: inline-flex !important; }
.grid { display: grid !important; }
.block { display: block !important; }
.hidden { display: none !important; }

.items-center { align-items: center !important; }
.items-start { align-items: flex-start !important; }
.justify-between { justify-content: space-between !important; }
.justify-center { justify-content: center !important; }
.justify-end { justify-content: flex-end !important; }

.flex-col { flex-direction: column !important; }
.flex-wrap { flex-wrap: wrap !important; }

.gap-2 { gap: 8px !important; }
.gap-3 { gap: 12px !important; }
.gap-4 { gap: 16px !important; }
.gap-5 { gap: 20px !important; }
.gap-6 { gap: 24px !important; }

.grid-cols-1 { grid-template-columns: repeat(1, minmax(0, 1fr)) !important; }
.grid-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; }
.grid-cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)) !important; }
.grid-cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)) !important; }

@media (min-width: 768px) {
    .md\:grid-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; }
    .md\:grid-cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)) !important; }
    .md\:grid-cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)) !important; }
}

@media (min-width: 1024px) {
    .lg\:grid-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; }
    .lg\:grid-cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)) !important; }
    .lg\:grid-cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)) !important; }
}

@media (min-width: 1280px) {
    .xl\:grid-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; }
    .xl\:grid-cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)) !important; }
    .xl\:grid-cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)) !important; }
}

.p-4 { padding: 16px !important; }
.p-5 { padding: 20px !important; }
.p-6 { padding: 24px !important; }

.px-4 { padding-left: 16px !important; padding-right: 16px !important; }
.px-5 { padding-left: 20px !important; padding-right: 20px !important; }
.py-2 { padding-top: 8px !important; padding-bottom: 8px !important; }
.py-3 { padding-top: 12px !important; padding-bottom: 12px !important; }
.py-4 { padding-top: 16px !important; padding-bottom: 16px !important; }

.mt-2 { margin-top: 8px !important; }
.mt-3 { margin-top: 12px !important; }
.mt-4 { margin-top: 16px !important; }
.mt-5 { margin-top: 20px !important; }
.mt-6 { margin-top: 24px !important; }
.mb-4 { margin-bottom: 16px !important; }
.mb-6 { margin-bottom: 24px !important; }

.w-full { width: 100% !important; }
.min-w-full { min-width: 100% !important; }

.bg-white { background: #ffffff !important; }
.bg-gray-50 { background: #f8fafc !important; }
.bg-gray-100 { background: #eef3f9 !important; }

.text-xs { font-size: 12px !important; }
.text-sm { font-size: 14px !important; }
.text-lg { font-size: 18px !important; }
.text-xl { font-size: 22px !important; }
.text-2xl { font-size: 28px !important; }
.text-4xl { font-size: 42px !important; }

.font-medium { font-weight: 600 !important; }
.font-semibold { font-weight: 700 !important; }
.font-bold { font-weight: 800 !important; }
.font-black { font-weight: 950 !important; }

.text-left { text-align: left !important; }
.text-right { text-align: right !important; }
.text-center { text-align: center !important; }

/* =========================================================
   CARTES, PANELS, FORMULAIRES
========================================================= */

.bg-white.rounded-xl,
.bg-white.rounded-2xl,
.bg-white.rounded-3xl,
.sq-panel,
.sq-stat-card,
.sq-mini-card {
    background: #ffffff !important;
    border: 1px solid #dbe4ef !important;
    border-radius: 22px !important;
    box-shadow: 0 18px 45px rgba(15, 23, 42, 0.075) !important;
}

.bg-white.rounded-xl,
.bg-white.rounded-2xl,
.bg-white.rounded-3xl {
    overflow: hidden;
}

main h1,
main h2,
main h3,
header h2 {
    color: #0f172a !important;
    font-weight: 950 !important;
    letter-spacing: -0.035em !important;
}

main p,
main small {
    color: #64748b;
    font-weight: 650;
}

main label {
    display: block;
    margin-bottom: 7px;
    color: #334155 !important;
    font-size: 13px !important;
    font-weight: 900 !important;
}

input[type="text"],
input[type="number"],
input[type="email"],
input[type="date"],
input[type="password"],
select,
textarea {
    width: 100%;
    min-height: 46px;
    border: 1px solid #cbd5e1 !important;
    border-radius: 14px !important;
    background: #ffffff !important;
    color: #0f172a !important;
    padding: 10px 14px !important;
    font-size: 14px !important;
    font-weight: 750 !important;
    outline: none !important;
    box-shadow: inset 0 1px 2px rgba(15, 23, 42, 0.04) !important;
}

textarea {
    min-height: 100px;
}

input:focus,
select:focus,
textarea:focus {
    border-color: #2563eb !important;
    box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.13) !important;
}

button,
.sq-btn,
a[class*="bg-blue"],
a[class*="bg-green"],
a[class*="bg-gray"],
a[class*="border"],
a[href*="create"],
a[href*="print"],
a[href*="export"] {
    min-height: 42px !important;
    border-radius: 13px !important;
    padding: 10px 16px !important;
    font-size: 13px !important;
    font-weight: 900 !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 6px !important;
    text-decoration: none !important;
}

main button {
    background: #0f172a !important;
    color: #ffffff !important;
    border: 1px solid #0f172a !important;
    cursor: pointer;
}

main button:hover {
    background: #1e293b !important;
}

/* =========================================================
   TABLEAUX
========================================================= */

table {
    width: 100% !important;
    border-collapse: separate !important;
    border-spacing: 0 !important;
    background: #ffffff !important;
    font-size: 13px !important;
}

thead {
    background: #eef3f9 !important;
}

th {
    padding: 14px 16px !important;
    color: #334155 !important;
    font-size: 12px !important;
    font-weight: 950 !important;
    text-transform: uppercase !important;
    letter-spacing: 0.04em !important;
    border-bottom: 1px solid #dbe4ef !important;
}

td {
    padding: 15px 16px !important;
    color: #334155 !important;
    font-weight: 650 !important;
    border-bottom: 1px solid #edf2f7 !important;
}

tbody tr:hover td {
    background: #f8fafc !important;
}

.overflow-hidden,
.overflow-x-auto,
.sq-table-wrap {
    border-radius: 20px !important;
    overflow: hidden !important;
}

/* =========================================================
   RAPPORTS
========================================================= */

.sq-page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
}

.sq-page-header h2 {
    margin: 0;
    font-size: 25px;
    font-weight: 950;
}

.sq-page-header p {
    margin: 8px 0 0;
    color: #64748b;
    font-size: 14px;
    font-weight: 750;
}

.sq-header-actions {
    display: flex;
    gap: 10px;
}

.sq-page-wrap {
    width: 100%;
    max-width: 1420px;
    margin: 0 auto;
    padding: 30px 36px;
}

.sq-panel {
    padding: 24px;
    margin-bottom: 22px;
}

.sq-filter-grid {
    display: grid !important;
    grid-template-columns: 1fr 1fr auto;
    gap: 16px;
    align-items: end;
}

.sq-stats-grid {
    display: grid !important;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 18px;
    margin-bottom: 22px;
}

.sq-stats-grid.small {
    grid-template-columns: repeat(6, minmax(0, 1fr));
}

.sq-stat-card,
.sq-mini-card {
    padding: 22px;
}

.sq-stat-card span,
.sq-mini-card span {
    display: block;
    color: #64748b;
    font-size: 13px;
    font-weight: 950;
}

.sq-stat-card strong {
    display: block;
    margin-top: 12px;
    font-size: 30px;
    font-weight: 950;
    color: #0f172a;
}

.sq-mini-card strong {
    display: block;
    margin-top: 8px;
    font-size: 19px;
    font-weight: 950;
    color: #0f172a;
}

.sq-stat-card.success strong {
    color: #16a34a;
}

.sq-stat-card.danger strong {
    color: #dc2626;
}

.sq-report-grid {
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 22px;
}

.sq-panel-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    margin-bottom: 16px;
}

.sq-panel-title h3 {
    margin: 0;
    color: #0f172a;
    font-size: 18px;
    font-weight: 950;
}

.sq-panel-title span {
    background: #eef3f9;
    color: #475569;
    border-radius: 999px;
    padding: 7px 11px;
    font-size: 12px;
    font-weight: 900;
}

.sq-empty {
    text-align: center !important;
    color: #64748b !important;
    padding: 26px !important;
}

/* =========================================================
   RESPONSIVE
========================================================= */

@media (max-width: 1200px) {
    .sq-stats-grid,
    .sq-stats-grid.small,
    .sq-report-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 1100px) {
    .sq-quickbar {
        display: none;
    }

    .sq-sidebar {
        width: 88px;
    }

    .sq-sidebar-title,
    .sq-menu-heading,
    .sq-version-box,
    .sq-nav-text {
        display: none;
    }

    .sq-nav-link {
        justify-content: center;
        padding: 10px;
    }

    main,
    header.bg-white {
        margin-left: 88px;
    }
}

@media (max-width: 720px) {
    .sq-sidebar {
        display: none;
    }

    main,
    header.bg-white {
        margin-left: 0;
    }

    .sq-brand-copy,
    .sq-account-name {
        display: none;
    }

    .sq-filter-grid,
    .sq-stats-grid,
    .sq-stats-grid.small,
    .sq-report-grid {
        grid-template-columns: 1fr !important;
    }

    main > .py-6,
    main > .py-8,
    .sq-page-wrap {
        padding-left: 16px;
        padding-right: 16px;
    }
}
