/* =============================================================================
   INTERFACE INDUSTRIES — FEUILLE DE STYLE PRINCIPALE (ERP & PILOTAGE ATELIER)
   Direction artistique : Industriel Premium — Vert Sombre (#183d36 / #175b4a),
   Blanc, Gris Clair (#f4f6f4), Citron Vert (#d9eb9e), Rouge Alerte (#aa343c), Ambre (#916008)
   ============================================================================= */

:root {
    --ink: #1c272c;
    --muted: #5e747c;
    --line: #d7e3e6;
    --paper: #f1f6f7;
    --green: #1a8292;
    --green-dark: #0e282e;
    --green-hover: #136e7c;
    --lime: #38b3c4;
    --cyan-accent: #38b3c4;
    --red: #ba3232;
    --red-bg: #fdebeb;
    --amber: #c07711;
    --amber-bg: #fff3df;
    --good-bg: #e1f4f7;
    --blue: #146877;
    --blue-bg: #e7f5f7;
    --radius: 10px;
    --radius-sm: 7px;
    --shadow-sm: 0 1px 4px rgba(14, 40, 46, 0.07);
    --shadow-md: 0 6px 20px rgba(14, 40, 46, 0.12);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font: 14px/1.5 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
    color: var(--ink);
    background: var(--paper);
    -webkit-font-smoothing: antialiased;
}

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

a:hover {
    text-decoration: underline;
}

button, input, select, textarea, .btn {
    font: inherit;
}

button, .btn {
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    border: 1px solid var(--line);
    background: #fff;
    border-radius: var(--radius-sm);
    padding: 9px 14px;
    color: var(--ink);
    font-weight: 500;
    text-decoration: none;
    transition: all 0.15s ease;
    white-space: nowrap;
}

button:hover, .btn:hover {
    border-color: #72988a;
    background: #f9fbf9;
    text-decoration: none;
}

button:focus-visible, .btn:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible {
    outline: 3px solid #96bdbc;
    outline-offset: 2px;
}

.primary, button.primary, .btn.primary {
    background: var(--green);
    border-color: var(--green);
    color: #fff;
}

.primary:hover, button.primary:hover, .btn.primary:hover {
    background: var(--green-hover);
    border-color: var(--green-hover);
    color: #fff;
}

.danger, button.danger, .btn.danger {
    color: var(--red);
    border-color: #eed2d5;
    background: #fff;
}

.danger:hover, button.danger:hover, .btn.danger:hover {
    background: var(--red-bg);
    border-color: var(--red);
}

.small, .btn.small {
    padding: 5px 10px;
    font-size: 12px;
    border-radius: 6px;
}

input, select, textarea {
    border: 1px solid #d2dbd7;
    background: #fff;
    border-radius: 7px;
    padding: 9px 11px;
    color: var(--ink);
}

input[type="search"] {
    min-width: 220px;
}

textarea {
    resize: vertical;
    min-height: 76px;
}

/* =============================================================================
   STRUCTURE SHELL & BARRE LATÉRALE (SIDEBAR)
   ============================================================================= */

.shell {
    display: grid;
    grid-template-columns: 245px 1fr;
    min-height: 100vh;
}

aside.sidebar {
    background: var(--green-dark);
    color: #fff;
    padding: 26px 18px;
    display: flex;
    flex-direction: column;
    gap: 20px;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
}

.brand-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.brand {
    font-weight: 800;
    font-size: 19px;
    letter-spacing: -0.5px;
    color: #fff;
    text-decoration: none;
}

.brand:hover {
    text-decoration: none;
}

.brand span {
    display: block;
    font-size: 10px;
    letter-spacing: 2.5px;
    color: #b8cfbf;
    margin-top: 6px;
    font-weight: 600;
}

.mobile-menu-btn {
    display: none;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #fff;
    padding: 7px 11px;
}

.nav {
    display: grid;
    gap: 4px;
}

.nav a {
    display: flex;
    align-items: center;
    gap: 10px;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: #d0dfd9;
    text-align: left;
    padding: 10px 12px;
    font-size: 13.5px;
    font-weight: 500;
    text-decoration: none;
    transition: background 0.15s, color 0.15s;
}

.nav a i {
    width: 18px;
    text-align: center;
    font-size: 14px;
    opacity: 0.85;
}

.nav a:hover {
    background: rgba(255, 255, 255, 0.08);
    color: #fff;
}

.nav a.active {
    background: #31574b;
    color: #fff;
    font-weight: 600;
}

.nav-badge {
    margin-left: auto;
    background: var(--red);
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    padding: 2px 7px;
    border-radius: 99px;
}

.aside-note {
    margin-top: auto;
    background: rgba(0, 0, 0, 0.16);
    border-radius: 10px;
    padding: 14px;
    color: #c0d1c9;
    font-size: 12px;
    line-height: 1.6;
}

.aside-note strong {
    display: block;
    color: var(--lime);
    margin-bottom: 6px;
}

.user-box {
    border-top: 1px solid rgba(255, 255, 255, 0.12);
    padding-top: 14px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    font-size: 12px;
    color: #d0dfd9;
}

.user-box .user-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.role-pill {
    background: var(--lime);
    color: var(--ink);
    font-size: 10px;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 4px;
}

/* =============================================================================
   ZONE PRINCIPALE (MAIN) & EN-TÊTE
   ============================================================================= */

main.main-content {
    min-width: 0;
    padding: 28px 34px 24px;
    max-width: 1920px;
    width: 100%;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
}

header.top-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 16px;
    margin-bottom: 24px;
    flex-wrap: wrap;
}

.eyebrow {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 2px;
    color: var(--green);
    font-weight: 700;
}

h1 {
    font-size: 28px;
    letter-spacing: -0.8px;
    margin: 6px 0 4px;
    line-height: 1.2;
}

h2 {
    font-size: 17px;
    margin: 0;
    letter-spacing: -0.2px;
}

h3 {
    font-size: 15px;
    margin: 0;
}

.muted {
    color: var(--muted);
}

.actions {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
}

/* =============================================================================
   CARTES KPI (STATS) & GRILLES
   ============================================================================= */

.stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(195px, 1fr));
    gap: 14px;
    margin: 16px 0 22px;
}

.stat {
    background: #fff;
    border: 1px solid var(--line);
    padding: 16px 18px;
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    position: relative;
    overflow: hidden;
}

.stat .stat-label {
    font-size: 12.5px;
    color: var(--muted);
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.stat strong {
    display: block;
    font-size: 28px;
    font-weight: 700;
    margin: 10px 0 4px;
    color: var(--ink);
}

.stat small {
    color: var(--muted);
    font-size: 11.5px;
}

.stat.stat-danger {
    border-left: 4px solid var(--red);
}

.stat.stat-warn {
    border-left: 4px solid var(--amber);
}

.stat.stat-good {
    border-left: 4px solid var(--green);
}

/* =============================================================================
   PANNEAUX, BARRES D'OUTILS & TABLEAUX
   ============================================================================= */

.toolbar {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    align-items: center;
    flex-wrap: wrap;
    margin: 18px 0 14px;
}

.filter-bar {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 14px 16px;
    margin-bottom: 18px;
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
}

.panel {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    margin-bottom: 22px;
}

.panel-head {
    padding: 18px 20px;
    border-bottom: 1px solid var(--line);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 15px;
    flex-wrap: wrap;
}

.panel-body {
    padding: 20px;
}

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

table {
    border-collapse: collapse;
    width: 100%;
    text-align: left;
}

th {
    background: #f7f9f7;
    color: #5b6d66;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    padding: 13px 15px;
    white-space: nowrap;
    border-bottom: 1px solid var(--line);
}

td {
    padding: 15px;
    border-top: 1px solid #edf0ed;
    vertical-align: middle;
}

tr:hover td {
    background: #fafcfa;
}

td b {
    display: block;
    margin-bottom: 3px;
}

td small {
    color: var(--muted);
    font-size: 12px;
}

/* =============================================================================
   BADGES, BARRES DE PROGRESSION & ALERTES
   ============================================================================= */

.badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    white-space: nowrap;
    border-radius: 6px;
    padding: 5px 9px;
    font-size: 11.5px;
    font-weight: 600;
    background: #edf2ee;
    color: #4d6359;
}

.badge.bad {
    background: var(--red-bg);
    color: var(--red);
}

.badge.warn {
    background: var(--amber-bg);
    color: var(--amber);
}

.badge.good {
    background: var(--good-bg);
    color: var(--green);
}

.badge.info {
    background: var(--blue-bg);
    color: var(--blue);
}

.badge.muted-badge {
    background: #eceff0;
    color: #68777d;
}

.progress {
    width: 100px;
    background: #e9eee9;
    border-radius: 9px;
    height: 6px;
    margin-top: 6px;
    overflow: hidden;
}

.progress i {
    display: block;
    background: var(--green);
    height: 100%;
    border-radius: 9px;
}

.notice {
    padding: 13px 16px;
    background: #eef2e9;
    border-left: 4px solid var(--green);
    border-radius: 8px;
    font-size: 12.5px;
    line-height: 1.6;
    margin: 14px 0;
}

.alert {
    padding: 13px 16px;
    border-radius: 8px;
    margin-bottom: 16px;
    font-size: 13px;
    border: 1px solid transparent;
}

.alert-success {
    background: var(--good-bg);
    color: var(--green);
    border-color: #c2dfd0;
}

.alert-danger {
    background: var(--red-bg);
    color: var(--red);
    border-color: #f1c6cb;
}

.alert-warning {
    background: var(--amber-bg);
    color: var(--amber);
    border-color: #f5dfb0;
}

/* =============================================================================
   CALENDRIER 14 JOURS & CALENDRIER MENSUEL / HEBDOMADAIRE
   ============================================================================= */

.calendar {
    display: grid;
    grid-template-columns: repeat(7, minmax(140px, 1fr));
    width: 100%;
}

.month-heading {
    padding: 12px 10px;
    background: #edf3ec;
    font-weight: 700;
    font-size: 12px;
    border-bottom: 1px solid var(--line);
    border-right: 1px solid var(--line);
}

.day {
    border-right: 1px solid var(--line);
    border-bottom: 1px solid var(--line);
    padding: 10px;
    min-height: 145px;
    background: #fff;
}

.day:nth-child(7n) {
    border-right: 0;
}

.day.outside {
    background: #f6f8f6;
    color: #99a39c;
}

.day.weekend:not(.is-today) {
    background: #f9fbf9;
}

.day.is-today {
    background: #f4fae7;
    box-shadow: inset 0 0 0 2px #79a35d;
}

.day-label {
    font-size: 12px;
    color: var(--muted);
    padding: 2px 2px 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.today-label {
    font-size: 10px;
    color: var(--green);
    font-weight: 700;
    background: var(--lime);
    padding: 2px 6px;
    border-radius: 4px;
}

.delivery {
    display: block;
    width: 100%;
    text-align: left;
    background: #edf3ec;
    border-left: 3px solid var(--green);
    padding: 8px 10px;
    border-radius: 5px;
    margin-bottom: 7px;
    font-size: 11.5px;
    color: var(--ink);
    text-decoration: none;
    transition: transform 0.1s;
}

.delivery:hover {
    transform: translateY(-1px);
    text-decoration: none;
    background: #e2ede0;
}

.delivery b {
    display: block;
    margin-bottom: 3px;
    color: var(--ink);
}

.delivery small {
    color: var(--muted);
    display: block;
}

.delivery.over {
    background: var(--red-bg);
    border-left-color: var(--red);
}

.delivery.completed {
    border-left-color: #658593;
    background: #eef3f6;
    opacity: 0.85;
}

.delivery-task-pill {
    display: block;
    background: #fff8e6;
    border-left: 3px solid var(--amber);
    padding: 5px 8px;
    border-radius: 4px;
    margin-bottom: 5px;
    font-size: 11px;
    color: var(--ink);
}

/* =============================================================================
   PLANNING DU JOUR (COLONNES COLLABORATEURS / SWIMLANES ILLIMITÉES)
   ============================================================================= */

.team-lanes {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 16px;
    margin-top: 16px;
    align-items: start;
}

.lane {
    background: #eaf0e9;
    border: 1px solid #dce5dc;
    border-radius: var(--radius);
    min-height: 320px;
    padding: 14px;
    display: flex;
    flex-direction: column;
}

.lane-title {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 2px 0 14px;
    padding-bottom: 10px;
    border-bottom: 1px solid rgba(25, 45, 53, 0.08);
}

.avatar {
    background: var(--green);
    color: #fff;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    font-weight: 700;
    font-size: 14px;
    flex-shrink: 0;
}

.lane-title-info {
    flex: 1;
    min-width: 0;
}

.lane-title-info input.quick-emp-name {
    width: 100%;
    border: 0;
    background: transparent;
    padding: 2px 4px;
    font-weight: 700;
    font-size: 14px;
    color: var(--ink);
}

.lane-title-info input.quick-emp-name:focus {
    background: #fff;
    border: 1px solid var(--green);
}

.lane-title-info small {
    display: block;
    padding-left: 4px;
    font-size: 11px;
    color: var(--muted);
}

.task-card {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 9px;
    padding: 14px;
    margin-bottom: 10px;
    box-shadow: 0 2px 4px rgba(23, 59, 48, 0.04);
    transition: box-shadow 0.15s;
}

.task-card:hover {
    box-shadow: var(--shadow-md);
}

.task-card.priority-URGENTE {
    border-left: 4px solid var(--red);
}

.task-card.priority-HAUTE {
    border-left: 4px solid var(--amber);
}

.task-card.priority-NORMALE {
    border-left: 4px solid var(--green);
}

.task-card.done {
    opacity: 0.65;
    background: #f9fbf9;
}

.task-card.done h3 {
    text-decoration: line-through;
}

.task-card h3 {
    font-size: 14px;
    line-height: 1.45;
    margin: 9px 0 6px;
}

.task-card p {
    font-size: 12px;
    margin: 4px 0;
    color: var(--muted);
    white-space: pre-wrap;
}

.task-card .task-footer {
    margin-top: 12px;
    padding-top: 10px;
    border-top: 1px solid #f0f3f0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

.day-empty {
    padding: 28px 10px;
    color: #75877d;
    text-align: center;
    font-size: 12px;
    line-height: 1.7;
}

/* =============================================================================
   PIPELINE DES 12 ÉTAPES DE PRODUCTION
   ============================================================================= */

.stages-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
    gap: 12px;
}

.stage-card {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 13px;
    position: relative;
}

.stage-card.stage-done {
    border-left: 4px solid var(--green);
    background: #f6fbf8;
}

.stage-card.stage-active {
    border-left: 4px solid var(--amber);
    box-shadow: 0 0 0 2px rgba(23, 91, 74, 0.12);
}

.stage-card.stage-blocked {
    border-left: 4px solid var(--red);
    background: #fdf6f7;
}

/* =============================================================================
   GRAPHIQUES DU TABLEAU DE BORD & GRILLES 2 COLONNES
   ============================================================================= */

.grid-2 {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 18px;
    margin-bottom: 20px;
}

.grid-3 {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 18px;
    margin-bottom: 20px;
}

.chart-box {
    min-height: 250px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.bar-chart-row {
    display: grid;
    grid-template-columns: 155px 1fr 55px;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
    font-size: 12.5px;
}

.bar-track {
    background: #edf2ee;
    height: 12px;
    border-radius: 99px;
    overflow: hidden;
}

.bar-fill {
    background: var(--green);
    height: 100%;
    border-radius: 99px;
}

/* =============================================================================
   MODALES (<dialog>) & FORMULAIRES
   ============================================================================= */

dialog {
    border: 1px solid var(--line);
    border-radius: 14px;
    width: min(680px, 94vw);
    padding: 24px;
    max-height: 90vh;
    overflow: auto;
    box-shadow: 0 20px 80px rgba(22, 53, 43, 0.3);
}

dialog::backdrop {
    background: rgba(18, 47, 40, 0.45);
    backdrop-filter: blur(3px);
}

.form-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 18px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--line);
}

.fields {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
}

.fields label, .stack-form label {
    display: grid;
    gap: 6px;
    font-size: 12px;
    font-weight: 700;
    color: var(--ink);
}

.fields input, .fields select, .fields textarea,
.stack-form input, .stack-form select, .stack-form textarea {
    width: 100%;
    font-size: 13.5px;
    font-weight: 400;
}

.wide {
    grid-column: 1 / -1;
}

.form-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 22px;
    padding-top: 14px;
    border-top: 1px solid var(--line);
    gap: 10px;
}

/* =============================================================================
   PAGE DE CONNEXION (LOGIN)
   ============================================================================= */

.login-body {
    min-height: 100vh;
    display: grid;
    place-items: center;
    background: linear-gradient(135deg, #183d36 0%, #0f2924 100%);
    padding: 20px;
}

.login-card {
    background: #fff;
    border-radius: 16px;
    width: min(460px, 94vw);
    padding: 34px 32px;
    box-shadow: 0 25px 70px rgba(0, 0, 0, 0.35);
}

.brand-badge {
    display: inline-block;
    background: var(--green-dark);
    color: #fff;
    padding: 8px 14px;
    border-radius: 8px;
    font-weight: 800;
    font-size: 15px;
    margin-bottom: 14px;
}

.brand-badge span {
    color: var(--lime);
    font-weight: 600;
    letter-spacing: 1.5px;
    font-size: 11px;
    margin-left: 6px;
}

.stack-form {
    display: grid;
    gap: 14px;
    margin-top: 18px;
}

.demo-credentials {
    margin-top: 20px;
    padding: 12px 14px;
    background: #f4f7f4;
    border: 1px solid var(--line);
    border-radius: 8px;
    font-size: 12px;
}

/* =============================================================================
   PIED DE PAGE & TOAST
   ============================================================================= */

footer.app-footer {
    margin-top: auto;
    padding-top: 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 14px;
    font-size: 11.5px;
    color: #78877e;
}

.toast {
    position: fixed;
    bottom: 24px;
    right: 24px;
    background: var(--ink);
    color: #fff;
    padding: 13px 18px;
    border-radius: 9px;
    z-index: 1000;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.2);
}

.hidden {
    display: none !important;
}

/* =============================================================================
   RESPONSIVE DESIGN (TABLETTES, IPHONE & SMARTPHONES ANDROID)
   ============================================================================= */

@media (max-width: 680px) {
    .shell {
        grid-template-columns: 1fr;
    }

    aside.sidebar {
        position: relative;
        height: auto;
        padding: 16px 20px;
    }

    .mobile-menu-btn {
        display: inline-flex;
    }

    .sidebar-collapsible {
        display: none;
    }

    .sidebar-collapsible.open {
        display: flex;
        flex-direction: column;
        gap: 14px;
        margin-top: 12px;
    }

    main.main-content {
        padding: 20px 16px;
    }

    .grid-2, .grid-3 {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 650px) {
    header.top-header {
        flex-direction: column;
        align-items: stretch;
    }

    h1 {
        font-size: 23px;
    }

    .stats {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }

    .fields {
        grid-template-columns: 1fr;
    }

    .wide {
        grid-column: auto;
    }

    .filter-bar {
        flex-direction: column;
        align-items: stretch;
    }

    .filter-bar input, .filter-bar select, .filter-bar .btn {
        width: 100%;
    }

    .team-lanes {
        grid-template-columns: 1fr;
    }
}

/* =============================================================================
   FEUILLE D'IMPRESSION (@media print) POUR LE POINT DU MATIN & LES RAPPORTS
   ============================================================================= */

@media print {
    aside.sidebar,
    header.top-header .actions,
    .filter-bar,
    .toolbar .actions,
    footer.app-footer,
    button,
    .btn,
    .no-print {
        display: none !important;
    }

    .shell {
        display: block;
    }

    main.main-content {
        padding: 0;
    }

    body {
        background: #fff;
        font-size: 10pt;
    }

    .panel, .task-card, .lane, .stat {
        box-shadow: none !important;
        break-inside: avoid;
    }

    .team-lanes {
        grid-template-columns: repeat(3, 1fr);
        gap: 10px;
    }
}
