/* Stili del simulatore.
   Filament 5 compila il proprio CSS in fase di build e non conosce le utility
   usate qui: servono classi proprie, registrate come asset del pannello. */

.sim-grid {
    display: grid;
    gap: 1rem;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    margin-bottom: 1.5rem;
}

.sim-kpi {
    border: 1px solid rgb(228 228 231);
    border-radius: 0.75rem;
    padding: 1rem 1.125rem;
    background: rgb(255 255 255);
}

.sim-kpi__label {
    font-size: 0.6875rem;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: rgb(113 113 122);
    margin: 0;
}

.sim-kpi__value {
    font-size: 1.5rem;
    font-weight: 700;
    line-height: 1.15;
    font-variant-numeric: tabular-nums;
    color: rgb(24 24 27);
    margin: 0.25rem 0 0;
}

.sim-kpi__hint {
    font-size: 0.75rem;
    color: rgb(113 113 122);
    margin: 0.25rem 0 0;
}

.sim-kpi--accent { border-color: rgb(16 185 129); background: rgb(236 253 245); }
.sim-kpi--accent .sim-kpi__value { color: rgb(4 120 87); }
.sim-kpi--good { border-color: rgb(16 185 129); }
.sim-kpi--good .sim-kpi__value { color: rgb(4 120 87); }
.sim-kpi--warn { border-color: rgb(245 158 11); background: rgb(255 251 235); }
.sim-kpi--warn .sim-kpi__value { color: rgb(180 83 9); }
.sim-kpi--info .sim-kpi__value { color: rgb(3 105 161); }

.sim-alert {
    border-radius: 0.5rem;
    padding: 0.75rem 1rem;
    font-size: 0.875rem;
    margin-bottom: 1rem;
    border: 1px solid;
}
.sim-alert--warn { border-color: rgb(252 211 77); background: rgb(255 251 235); color: rgb(146 64 14); }
.sim-alert--error { border-color: rgb(252 165 165); background: rgb(254 242 242); color: rgb(153 27 27); }
.sim-alert__title { font-weight: 700; margin: 0 0 0.25rem; }
.sim-alert__body { margin: 0; font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: 0.75rem; }

.sim-cols { display: grid; gap: 1.5rem; grid-template-columns: 1fr; }
@media (min-width: 1280px) { .sim-cols { grid-template-columns: 1fr 1fr; } }

.sim-scroll { overflow-x: auto; }

.sim-table { width: 100%; border-collapse: collapse; font-size: 0.8125rem; }
.sim-table th {
    text-align: left;
    font-size: 0.625rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: rgb(113 113 122);
    padding: 0.5rem 0.75rem 0.5rem 0;
    border-bottom: 1px solid rgb(228 228 231);
    white-space: nowrap;
}
.sim-table td {
    padding: 0.4rem 0.75rem 0.4rem 0;
    border-bottom: 1px solid rgb(244 244 245);
    color: rgb(63 63 70);
    vertical-align: top;
}
.sim-table tr:last-child td { border-bottom: 0; }
.sim-table .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; padding-right: 0; }
.sim-table .mono { font-family: ui-monospace, "SF Mono", Menlo, monospace; }
.sim-table .name { font-weight: 600; color: rgb(24 24 27); }
.sim-table .muted { color: rgb(161 161 170); }
.sim-table .result { font-weight: 700; color: rgb(4 120 87); }

.sim-table tr.is-total td {
    border-top: 2px solid rgb(212 212 216);
    border-bottom: 0;
    padding-top: 0.6rem;
    font-weight: 700;
    color: rgb(24 24 27);
    text-transform: uppercase;
    font-size: 0.6875rem;
    letter-spacing: 0.06em;
}
.sim-table tr.is-total td.num { font-size: 0.875rem; letter-spacing: 0; text-transform: none; }
.sim-table tr.is-price td { color: rgb(4 120 87); border-top: 1px solid rgb(228 228 231); padding-top: 0.6rem; font-weight: 700; }

.sim-chip {
    display: inline-block;
    border-radius: 0.25rem;
    padding: 0.1rem 0.4rem;
    font-size: 0.625rem;
    font-weight: 600;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    white-space: nowrap;
}
.sim-chip--material { background: rgb(209 250 229); color: rgb(4 120 87); }
.sim-chip--machine { background: rgb(219 234 254); color: rgb(29 78 216); }
.sim-chip--click { background: rgb(237 233 254); color: rgb(109 40 217); }
.sim-chip--labor { background: rgb(254 243 199); color: rgb(146 64 14); }
.sim-chip--other { background: rgb(244 244 245); color: rgb(82 82 91); }

.dark .sim-kpi { background: rgba(255 255 255 / 0.04); border-color: rgba(255 255 255 / 0.1); }
.dark .sim-kpi__value { color: rgb(250 250 250); }
.dark .sim-kpi__label,
.dark .sim-kpi__hint { color: rgb(161 161 170); }
.dark .sim-kpi--accent { background: rgba(6 78 59 / 0.35); border-color: rgb(5 150 105); }
.dark .sim-kpi--accent .sim-kpi__value { color: rgb(110 231 183); }
.dark .sim-kpi--good { border-color: rgb(5 150 105); }
.dark .sim-kpi--good .sim-kpi__value { color: rgb(110 231 183); }
.dark .sim-kpi--warn { background: rgba(120 53 15 / 0.3); border-color: rgb(180 83 9); }
.dark .sim-kpi--warn .sim-kpi__value { color: rgb(252 211 77); }
.dark .sim-kpi--info .sim-kpi__value { color: rgb(125 211 252); }

.dark .sim-alert--warn { background: rgba(120 53 15 / 0.3); border-color: rgb(180 83 9); color: rgb(253 230 138); }
.dark .sim-alert--error { background: rgba(127 29 29 / 0.3); border-color: rgb(185 28 28); color: rgb(254 202 202); }

.dark .sim-table th { color: rgb(161 161 170); border-bottom-color: rgba(255 255 255 / 0.1); }
.dark .sim-table td { color: rgb(212 212 216); border-bottom-color: rgba(255 255 255 / 0.06); }
.dark .sim-table .name { color: rgb(244 244 245); }
.dark .sim-table .muted { color: rgb(113 113 122); }
.dark .sim-table .result { color: rgb(110 231 183); }
.dark .sim-table tr.is-total td { border-top-color: rgba(255 255 255 / 0.2); color: rgb(250 250 250); }
.dark .sim-table tr.is-price td { color: rgb(110 231 183); border-top-color: rgba(255 255 255 / 0.1); }

.dark .sim-chip--material { background: rgba(6 78 59 / 0.6); color: rgb(110 231 183); }
.dark .sim-chip--machine { background: rgba(30 58 138 / 0.6); color: rgb(147 197 253); }
.dark .sim-chip--click { background: rgba(76 29 149 / 0.6); color: rgb(196 181 253); }
.dark .sim-chip--labor { background: rgba(120 53 15 / 0.6); color: rgb(252 211 77); }
.dark .sim-chip--other { background: rgba(255 255 255 / 0.1); color: rgb(212 212 216); }

/* ---------------------------------------------------------------- preventivatore */
.pv-cols { display: grid; gap: 1.5rem; grid-template-columns: 1fr; align-items: start; }
@media (min-width: 1280px) { .pv-cols { grid-template-columns: 1fr 360px; } }

.pv-live {
    border: 1.5px solid rgb(16 185 129);
    border-radius: 0.75rem;
    overflow: hidden;
    position: sticky;
    top: 5rem;
}
.pv-live__body { padding: 1.25rem; background: rgb(236 253 245); }
.pv-live__label { font-size: 0.625rem; font-weight: 600; letter-spacing: 0.1em; text-transform: uppercase; color: rgb(4 120 87); margin: 0; }
.pv-live__price { font-size: 2rem; font-weight: 800; color: rgb(4 88 63); line-height: 1.1; margin: 0.25rem 0 0; font-variant-numeric: tabular-nums; }
.pv-live__rows { list-style: none; margin: 1rem 0 0; padding: 1rem 0 0; border-top: 1px solid rgb(167 243 208); display: flex; flex-direction: column; gap: 0.4rem; }
.pv-live__rows li { display: flex; justify-content: space-between; gap: 1rem; font-size: 0.8125rem; color: rgb(6 78 59); }
.pv-live__rows strong { font-variant-numeric: tabular-nums; }
.pv-live__foot { padding: 1rem 1.25rem; background: rgb(255 255 255); border-top: 1px solid rgb(228 228 231); }

.pv-rows { border: 1px solid rgb(228 228 231); border-radius: 0.75rem; overflow: hidden; background: rgb(255 255 255); }
.pv-row { display: grid; grid-template-columns: 1fr auto; gap: 1rem; padding: 0.875rem 1.125rem; border-bottom: 1px solid rgb(244 244 245); align-items: start; }
.pv-row:last-child { border-bottom: 0; }
.pv-row__name { font-weight: 600; font-size: 0.875rem; color: rgb(24 24 27); }
.pv-row__spec { font-size: 0.75rem; color: rgb(113 113 122); margin-top: 0.15rem; }
.pv-row__price { text-align: right; font-variant-numeric: tabular-nums; }
.pv-row__price b { display: block; font-size: 0.9375rem; color: rgb(24 24 27); }
.pv-row__price span { font-size: 0.6875rem; color: rgb(113 113 122); }
.pv-total { display: flex; justify-content: space-between; gap: 1rem; padding: 1rem 1.125rem; background: rgb(249 250 251); border-top: 2px solid rgb(212 212 216); font-weight: 700; }
.pv-total span:last-child { font-variant-numeric: tabular-nums; }

.pv-empty { padding: 2rem 1.125rem; text-align: center; color: rgb(113 113 122); font-size: 0.875rem; }

.dark .pv-live__body { background: rgba(6 78 59 / 0.3); }
.dark .pv-live__price { color: rgb(110 231 183); }
.dark .pv-live__label { color: rgb(110 231 183); }
.dark .pv-live__rows { border-top-color: rgba(16 185 129 / 0.3); }
.dark .pv-live__rows li { color: rgb(209 250 229); }
.dark .pv-live__foot { background: rgba(255 255 255 / 0.03); border-top-color: rgba(255 255 255 / 0.1); }
.dark .pv-rows { background: rgba(255 255 255 / 0.03); border-color: rgba(255 255 255 / 0.1); }
.dark .pv-row { border-bottom-color: rgba(255 255 255 / 0.06); }
.dark .pv-row__name, .dark .pv-row__price b { color: rgb(244 244 245); }
.dark .pv-row__spec, .dark .pv-row__price span, .dark .pv-empty { color: rgb(161 161 170); }
.dark .pv-total { background: rgba(255 255 255 / 0.05); border-top-color: rgba(255 255 255 / 0.2); }

/* Rimozione riga: bersaglio grande e con etichetta, non un'icona da indovinare. */
.pv-remove {
    display: inline-flex; align-items: center; gap: 0.375rem;
    min-height: 40px; padding: 0 0.875rem;
    border: 1px solid rgb(228 228 231); border-radius: 8px;
    background: rgb(255 255 255); color: rgb(113 113 122);
    font-size: 0.8125rem; font-weight: 600; font-family: inherit;
    cursor: pointer; white-space: nowrap;
    transition: border-color .12s, color .12s, background-color .12s;
}
.pv-remove svg { width: 16px; height: 16px; flex: none; }
.pv-remove:hover { border-color: rgb(220 38 38); color: rgb(185 28 28); background: rgb(254 242 242); }
.pv-remove:active { transform: scale(.97); }
.pv-remove[disabled] { opacity: .5; cursor: wait; }

.dark .pv-remove { background: rgba(255 255 255 / 0.04); border-color: rgba(255 255 255 / 0.12); color: rgb(161 161 170); }
.dark .pv-remove:hover { border-color: rgb(248 113 113); color: rgb(252 165 165); background: rgba(127 29 29 / 0.25); }

/* ---------------------------------------------------------------- carico produttivo */
.carico-giorni { display: grid; gap: 0.75rem; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); margin-bottom: 1.5rem; }
.carico-giorno { border: 1px solid rgb(228 228 231); border-radius: 0.625rem; padding: 0.875rem; }
.carico-giorno--success { border-color: rgb(167 243 208); background: rgb(240 253 244); }
.carico-giorno--warning { border-color: rgb(253 230 138); background: rgb(255 251 235); }
.carico-giorno--danger { border-color: rgb(254 202 202); background: rgb(254 242 242); }
.carico-giorno__data { font-size: 0.6875rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: rgb(113 113 122); margin: 0; }
.carico-giorno__pct { font-size: 1.5rem; font-weight: 800; margin: 0.125rem 0 0.5rem; color: rgb(24 24 27); font-variant-numeric: tabular-nums; }
.carico-giorno__meta { font-size: 0.75rem; color: rgb(113 113 122); margin: 0.5rem 0 0; font-variant-numeric: tabular-nums; }
.carico-giorno__alert { font-size: 0.6875rem; font-weight: 700; color: rgb(185 28 28); margin: 0.25rem 0 0; }

.carico-barra { height: 6px; border-radius: 999px; background: rgb(228 228 231); overflow: hidden; }
.carico-barra span { display: block; height: 100%; background: rgb(16 185 129); border-radius: 999px; }
.carico-barra--warning span { background: rgb(245 158 11); }
.carico-barra--danger span { background: rgb(239 68 68); }

.carico-titolo { font-size: 0.6875rem; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; color: rgb(113 113 122); margin: 0 0 0.75rem; }
.carico-macchine { display: flex; flex-direction: column; gap: 0.5rem; }
.carico-macchina { display: grid; grid-template-columns: 1fr 120px 44px 80px; gap: 0.75rem; align-items: center; font-size: 0.8125rem; }
.carico-macchina__nome { font-weight: 600; color: rgb(24 24 27); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.carico-macchina__pct { text-align: right; font-variant-numeric: tabular-nums; font-weight: 700; color: rgb(24 24 27); }
.carico-macchina__libero { text-align: right; color: rgb(113 113 122); font-variant-numeric: tabular-nums; }
@media (max-width: 640px) { .carico-macchina { grid-template-columns: 1fr 60px; } .carico-macchina .carico-barra, .carico-macchina__libero { display: none; } }

.dark .carico-giorno { background: rgba(255 255 255 / 0.03); border-color: rgba(255 255 255 / 0.1); }
.dark .carico-giorno--success { background: rgba(6 78 59 / 0.25); border-color: rgba(16 185 129 / 0.4); }
.dark .carico-giorno--warning { background: rgba(120 53 15 / 0.25); border-color: rgba(245 158 11 / 0.4); }
.dark .carico-giorno--danger { background: rgba(127 29 29 / 0.25); border-color: rgba(239 68 68 / 0.4); }
.dark .carico-giorno__pct, .dark .carico-macchina__nome, .dark .carico-macchina__pct { color: rgb(244 244 245); }
.dark .carico-giorno__meta, .dark .carico-macchina__libero, .dark .carico-titolo { color: rgb(161 161 170); }
.dark .carico-barra { background: rgba(255 255 255 / 0.1); }

/* Riga di preventivo fuori soglia: si vede prima di premere Salva. */
.pv-row__alert {
    margin: .35rem 0 0;
    font-size: .75rem;
    font-weight: 600;
    color: rgb(185 28 28);
}
.pv-row__alert--warn { color: rgb(180 83 9); }
.dark .pv-row__alert { color: rgb(252 165 165); }
.dark .pv-row__alert--warn { color: rgb(253 186 116); }
