:root {
    --admin-orange: #c47a1a;
    --admin-orange-dark: #a86512;
    --sidebar-width: 240px;
}

* {
    box-sizing: border-box;
}

html,
body {
    width: 100%;
    min-height: 100%;
    overflow-x: hidden;
}

body {
    margin: 0;
    font-family: 'Segoe UI', system-ui, sans-serif;
    background: #f5f6f8;
    color: #212529;
}

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

.admin-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: var(--sidebar-width);
    height: 100vh;
    background: var(--admin-orange);
    color: #fff;
    overflow-y: auto;
    overflow-x: hidden;
    z-index: 1000;
    padding: 16px 0;
}

.admin-sidebar .brand {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 20px 20px;
    text-decoration: none;
    color: #fff;
}

.admin-sidebar .brand img,
.admin-sidebar .brand .logo-circle {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    box-shadow: 0 2px 8px rgba(0,0,0,.12);
}

.admin-sidebar .brand .logo-circle svg {
    width: 24px;
    height: 24px;
}

.admin-sidebar .brand .brand-name {
    font-size: 1.15rem;
    font-weight: 800;
    line-height: 1.15;
    color: #fff;
}

.admin-sidebar .brand .brand-name span {
    color: #fbbf24;
}

.admin-sidebar .brand .brand-sub {
    font-size: 0.68rem;
    font-weight: 600;
    letter-spacing: 2px;
    color: rgba(255,255,255,.85);
    text-transform: uppercase;
    margin-top: 2px;
}

/* Navigation */

.admin-sidebar .nav-link {
    display: flex;
    align-items: center;
    gap: 12px;

    width: calc(100% - 20px);
    height: 64px;
    min-height: 64px;

    padding: 0 16px;
    margin: 8px 10px;

    background-color: transparent;
    color: rgba(255,255,255,.92);

    text-decoration: none;
    font-size: .95rem;
    font-weight: 400;

    border-left: 4px solid transparent;
    border-radius: 8px;

    box-sizing: border-box;

    transition:
        background-color .2s ease,
        color .2s ease,
        border-left-color .2s ease;
}

.admin-sidebar .nav-link:hover,
.admin-sidebar .nav-link.active {
    background-color: #fff;
    color: var(--admin-orange);
    font-weight: 600;
    border-left-color: var(--admin-orange);
}

/* =========================================================
   MAIN
   ========================================================= */

.admin-main {
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    min-width: 0;
}

/* =========================================================
   HEADER
   ========================================================= */

.admin-header {
    background: #fff;
    padding: 14px 28px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    border-bottom: 1px solid #e9ecef;
    min-width: 0;
}

.admin-header .welcome {
    font-size: 1.15rem;
    font-weight: 500;
    min-width: 0;
}

.admin-header .search-box {
    display: flex;
    align-items: center;
    background: #f1f3f5;
    border-radius: 24px;
    padding: 8px 16px;
    min-width: 260px;
    flex: 1 1 260px;
    max-width: 420px;
}

.admin-header .search-box input {
    border: none;
    background: transparent;
    outline: none;
    width: 100%;
    min-width: 0;
    font-size: 0.9rem;
}

/* =========================================================
   CONTENT
   ========================================================= */

.admin-content {
    padding: 24px 28px;
    min-width: 0;
}

/* =========================================================
   CARDS
   ========================================================= */

.stat-card {
    background: #fff;
    border-radius: 14px;
    padding: 20px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.05);
    height: 100%;
    min-width: 0;
}

.stat-card .stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    margin-bottom: 12px;
}

.stat-card .stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    margin: 0;
    overflow-wrap: anywhere;
}

.stat-card .stat-label {
    color: #6c757d;
    font-size: 0.875rem;
    margin: 0;
}

.stat-card .stat-sub {
    font-size: 0.8rem;
    margin-top: 4px;
}

.stat-sub.up { color: #198754; }
.stat-sub.down { color: #dc3545; }
.stat-sub.warn { color: #e67e22; }
.stat-sub.danger { color: #dc3545; }

/* =========================================================
   TABLES
   ========================================================= */

.admin-table-wrap {
    background: #fff;
    border-radius: 14px;
    padding: 20px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.05);
    width: 100%;
    min-width: 0;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.admin-table-wrap table {
    width: 100%;
    min-width: 680px;
    border-collapse: collapse;
}

.admin-table-wrap th {
    text-align: left;
    padding: 10px 12px;
    font-size: 0.8rem;
    color: #6c757d;
    border-bottom: 1px solid #e9ecef;
    font-weight: 600;
    white-space: nowrap;
}

.admin-table-wrap td {
    padding: 12px;
    border-bottom: 1px solid #f1f3f5;
    font-size: 0.9rem;
}

.badge-status {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 500;
    white-space: nowrap;
}

.badge-good { background: #d1e7dd; color: #0f5132; }
.badge-low { background: #fff3cd; color: #664d03; }
.badge-out { background: #f8d7da; color: #842029; }
.badge-done { background: #d1e7dd; color: #0f5132; }

/* =========================================================
   GLOBAL SAFETY (toujours actif, pas lié à un écran précis)
   ========================================================= */

.admin-main,
.admin-content,
.admin-header,
.admin-sidebar,
.admin-table-wrap,
.admin-header > div {
    min-width: 0;
}

.admin-header > div:last-child {
    display: flex;
    align-items: center;
    gap: 14px;
    min-width: 0;
}

.admin-header input,
.admin-content input,
.admin-content select,
.admin-content textarea,
.admin-content button {
    max-width: 100%;
}

img, svg, video, canvas { max-width: 100%; }

/* Tout le responsive (tablette / mobile) est géré exclusivement
   dans public/css/responsive.css, chargé après ce fichier. */