/* ============================================================
   STILE GENERALE
============================================================ */

body {
    font-family: Arial, sans-serif;
    margin: 0;
    padding: 0;
    background: #ffffff;
    color: #333;
}

h1, h2, h3 {
    margin: 10px 0;
}

/* Pulsanti principali */
.btn {
    background: #143452;
    color: white;
    padding: 12px 18px;
    margin: 6px 0;                 /* ✅ spaziatura verticale */
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-weight: bold;
    font-size: 15px;
    letter-spacing: 0.3px;
}

.btn:hover {
    opacity: 0.9;
}

.btn.big {
    width: 100%;
    padding: 16px 20px;
    font-size: 17px;
}

.btn.full {
    width: 100%;
}

.btn.save { background: #0c6b3e; }
.btn.cancel { background: #8c1b1b; }

/* ============================================================
   HOME / GRIGLIA PRINCIPALE
============================================================ */

.home-grid {
    display: grid !important;
    grid-template-columns: 1fr 1fr !important;
    gap: 20px !important;
    padding: 20px !important;
    align-items: start;
}

.panel {
    width: 100%;
    box-sizing: border-box;
    background: #fff;
    padding: 26px;
    border-radius: 6px;
    border: 1px solid #ddd;
}

/* ============================================================
   STATO MATERIE PRIME (Home)
============================================================ */

.mp-list {
    max-height: calc(11 * 36px);
    overflow-y: auto;
    padding-right: 6px;
    border: 1px solid #ddd;
}

.mp-list::-webkit-scrollbar {
    width: 10px;
}

.mp-list::-webkit-scrollbar-track {
    background: #efefef;
    border-radius: 6px;
}

.mp-list::-webkit-scrollbar-thumb {
    background: #b0b0b0;
    border-radius: 6px;
}

.mp-list::-webkit-scrollbar-thumb:hover {
    background: #909090;
}

.mp-row {
    border-bottom: 1px solid #eee;
    padding: 6px 0;
    height: 36px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

/* Nome + descrizione */
.mp-name {
    font-weight: 700;        /* ✅ grassetto */
    color: #143452;          /* ✅ blu */
    font-size: 14px;
}

/* Barra spessa */
.mp-bar {
    background: #ddd;
    border-radius: 6px;
    height: 14px;            /* ✅ più spessa */
    width: 100%;
    margin: 4px 0;
}

/* Se la giacenza è sotto MIN → barra rossa */
.alert-red .mp-fill {
    background: #c62828 !important;   /* rosso più evidente */
}

/* Se è tra MIN e RIORDINO → barra gialla */
.alert-yellow .mp-fill {
    background: #e0a800 !important;   /* giallo warning */
}

.mp-fill {
    background: #143452;
    height: 100%;
    border-radius: 6px;
    transition: width 0.3s ease;
}

/* Giacenza (rimasto come originale) */
.mp-qty {
    font-size: 13px;
    font-weight: 500;
    color: #333;
}

/* ============================================================
   CALENDARIO GIORNALIERO
============================================================ */

.cal-container {
    display: grid;
    grid-template-columns: 80px 1fr 1fr;
    border: 1px solid #ccc;
}

.cal-header {
    background: #e9ecef;
    padding: 6px;
    font-weight: bold;
    border-bottom: 1px solid #ccc;
    text-align: center;
}

.cal-time {
    padding: 6px;
    border-bottom: 1px solid #eee;
    background: #fafafa;
    font-weight: bold;
}

.cal-cell {
    height: 36px;
    border-bottom: 1px solid #eee;
    border-left: 1px solid #eee;
    cursor: pointer;
    background: white;
    position: relative;
}

.cal-cell:hover {
    background: #f2f2f2;
}

/* Blocchi produzione */
.prod-block {
    width: 100%;
    height: 100%;
    background: #143452;
    color: white;
    font-size: 12px;
    border-radius: 4px;
    padding: 2px;
    box-sizing: border-box;
}

.pb-nome { font-size: 11px; }
.pb-dos  { font-size: 10px; }

/* ============================================================
   CALENDARIO SETTIMANALE + SCROLL + COLORI
============================================================ */

#view {
    width: 100%;
    overflow-x: auto;
    overflow-y: hidden;
}

.cal-multi {
    display: block;
    width: 100%;            /* ✅ tutta la pagina */
    min-width: 100%;
    max-width: 100%;
    padding: 0;
    border-collapse: collapse;
    table-layout: fixed;
    overflow-x: auto;
    overflow-y: auto;
    max-height: 70vh;
}

.cal-multi th,
.cal-multi td {
    border: 1px solid #ccc;
    padding: 0;
    white-space: nowrap;
}

/* Colonne di linea con larghezza fissa */
.th-linea,
.cal-multi td {
    width: 120px;
    min-width: 120px;
    max-width: 120px;
}

/* Intestazioni */
.th-ora {
    width: 60px;
    background: #fafafa;
    font-weight: bold;
}

.th-giorno {
    background: #dfe4ea;
    font-weight: bold;
    text-align: center;
    font-size: 14px;
}

.td-ora {
    background: #f9f9f9;
    font-weight: bold;
    text-align: center;
    font-size: 12px;
}

/* Sticky header */
.cal-multi thead {
    position: sticky;
    top: 0;
    z-index: 5;
}

/* Weekend + Festivi */
.cal-weekend .cal-cell,
.cal-festivo .cal-cell,
td.cal-weekend .cal-cell,
td.cal-festivo .cal-cell {
    background: #f0f0f0 !important;
}

.cal-festivo .cal-cell,
td.cal-festivo .cal-cell {
    background: #e8e8e8 !important;
}

.cal-weekend .th-giorno,
.cal-festivo .th-giorno {
    background: #d4d4d4 !important;
}

/* ============================================================
   POPUP INSERIMENTO PRODUZIONE
============================================================ */

.popup-bg {
    position: fixed;
    inset: 0;
    background: #00000070;
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9000;
}

.popup {
    background: white;
    padding: 20px;
    border-radius: 6px;
    width: 320px;
    box-shadow: 0 0 10px #0004;
}

.popup-buttons {
    display: flex;
    justify-content: space-between;
    margin-top: 20px;
}

.popup input,
.popup select {
    width: 100%;
    padding: 6px;
    margin: 8px 0;
}

/* ============================================================
   ARRIVI MP (🚚)
============================================================ */

.arrivo-cell {
    background: #f2fafc !important;
}

.arrivo-icon {
    position: absolute;
    right: 4px;
    bottom: 4px;
    font-size: 14px;
}

/* ============================================================
   DRAG & DROP
============================================================ */

.prod-block.dragging {
    opacity: 0.5;
}

/* ============================================================
   TABELLE GENERALI (MAGAZZINO, RICETTE, TURNI)
============================================================ */

table {
    width: 100%;
    border-collapse: collapse;
}

th, td {
    padding: 6px;
    border: 1px solid #ddd;
}
``