/* ===== SeedFlow – stile base ===== */

html, body {
    font-family: 'Inter', 'Segoe UI', 'Roboto', 'Helvetica Neue', Arial, sans-serif;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ===== Transizione di pagina ===== */
.page-fade {
    animation: pageFade .28s ease both;
}

@keyframes pageFade {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: translateY(0); }
}

.content-area { padding-bottom: 32px; }

/* ===== Elenchi: righe a scheda su smartphone e tablet =====
   (stessa soglia di MudTable Breakpoint.Sm: sotto i 960 px la tabella diventa a schede) */
@media (max-width: 959.98px) {
    .card-rows .mud-table-row {
        display: block;
        border: 1px solid #E4E5E3;
        border-radius: 12px;
        margin-bottom: 12px;
        padding: 6px 10px;
        background: #fff;
        box-shadow: 0 2px 6px rgba(0,0,0,0.06);
    }
    /* prima riga (ID) in evidenza come intestazione della scheda */
    .card-rows .mud-table-row .mud-table-cell:first-child {
        background: #EFF0EE;
        border-bottom: 1px solid #DFE0DE;
        margin: -6px -10px 6px;
        padding: 8px 10px;
        border-radius: 12px 12px 0 0;
        font-size: 1.05rem;
    }
    .card-rows .mud-table-cell {
        padding-top: 4px;
        padding-bottom: 4px;
    }
    /* etichetta campo un po' più marcata */
    .card-rows .mud-table-cell::before {
        font-weight: 600;
        color: #6B6E73;
    }
    /* il testo secondario va a capo sotto il valore, allineato a destra */
    .card-rows .mud-table-cell { flex-wrap: wrap; }
    .card-rows .mud-table-cell > .sf-cell-sub { flex-basis: 100%; text-align: right; }
}

/* ===== Suggerimento rotazione (schermata Vista Serra) ===== */
.rotate-hint { display: none; }

@media (max-width: 959.98px) and (orientation: portrait) {
    .rotate-hint {
        display: flex;
        position: fixed;
        inset: 0;
        z-index: 1400;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        text-align: center;
        padding: 24px;
        background: #F6F7F5;
        color: #517732;
    }
    .rotate-hint .mud-icon-root {
        color: #517732;
        animation: rotateHint 2.2s ease-in-out infinite;
    }
}

@keyframes rotateHint {
    0%, 60% { transform: rotate(0deg); }
    80%, 100% { transform: rotate(-90deg); }
}

/* ===== Pulsantoni dashboard ===== */
.dash-tile {
    border-radius: 16px;
    padding: 18px 16px;
    min-height: 120px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 6px;
    color: #fff;
    cursor: pointer;
    box-shadow: 0 6px 16px rgba(0,0,0,0.12);
    transition: transform .12s ease, box-shadow .12s ease, filter .12s ease;
    user-select: none;
}

.dash-tile .mud-icon-root { color: #fff; }

.dash-tile:hover { transform: translateY(-3px); box-shadow: 0 12px 24px rgba(0,0,0,0.18); filter: saturate(1.05); }
.dash-tile:active { transform: scale(0.96); }

.dash-tile-title { font-weight: 700; font-size: 1.05rem; line-height: 1.2; }
.dash-tile-sub { font-size: 0.78rem; opacity: 0.92; }

/* ===== Dashboard: saluto, sezione "Da fare adesso" ===== */
.dash-saluto { display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px 12px; margin: 4px 0 16px; }
.dash-saluto-nome { font-size: 1.35rem; font-weight: 700; color: #1E1F21; }
.dash-saluto-data { font-size: 0.9rem; color: #6B6E73; display: inline-block; }
.dash-saluto-data::first-letter { text-transform: uppercase; }   /* "Domenica 4 ottobre": maiuscola solo la prima */

.dash-sezione { font-size: 0.78rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: #6B6E73; margin: 18px 0 8px; }

.dash-kpi-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px; margin-bottom: 18px; }
.dash-kpi {
    display: flex; align-items: center; gap: 12px;
    background: #fff; border: 1px solid #E4E5E3; border-radius: 12px; padding: 10px 14px;
    cursor: pointer; user-select: none; transition: box-shadow .12s ease, transform .08s ease;
}
.dash-kpi:hover { box-shadow: 0 4px 12px rgba(0,0,0,0.08); }
.dash-kpi:active { transform: scale(0.98); }
.dash-kpi-icon { color: #9A9DA1; }
.dash-kpi-testo { flex: 1; min-width: 0; }
.dash-kpi-label { font-size: 0.8rem; font-weight: 600; color: #5F6065; }
.dash-kpi-valore { font-size: 1.5rem; font-weight: 800; line-height: 1.1; }
.dash-kpi-unita { font-size: 0.78rem; color: #6B6E73; }
.dash-kpi-zero { font-size: 0.85rem; color: #16A34A; font-weight: 600; margin-top: 2px; }
.dash-kpi-freccia { font-size: 1.6rem; color: #CFD1D3; line-height: 1; }
.dash-kpi.zero { background: #F8F9F7; }
.dash-kpi.zero .dash-kpi-label { color: #9A9DA1; }
.dash-kpi.attivo { border-color: #517732; background: #F3F8EF; }
.dash-kpi.attivo .dash-kpi-icon, .dash-kpi.attivo .dash-kpi-valore { color: #517732; }
.dash-kpi.allarme { border-color: #EF4444; background: #FEF2F2; }
.dash-kpi.allarme .dash-kpi-icon, .dash-kpi.allarme .dash-kpi-valore { color: #B91C1C; }

@media (max-width: 599.98px) {
    .dash-kpi-grid { grid-template-columns: 1fr 1fr; gap: 8px; }
    .dash-kpi { padding: 8px 10px; gap: 8px; }
    .dash-kpi-icon, .dash-kpi-freccia { display: none; }
}

/* ===== Pulsante principale (hero) della dashboard ===== */
.dash-hero {
    border-radius: 20px;
    padding: 26px 28px;
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    box-shadow: 0 10px 26px rgba(0,0,0,0.18);
    transition: transform .12s ease, box-shadow .12s ease, filter .12s ease;
    user-select: none;
}

.dash-hero:hover { transform: translateY(-3px); box-shadow: 0 16px 34px rgba(0,0,0,0.24); filter: saturate(1.05); }
.dash-hero:active { transform: scale(0.98); }

.dash-hero-left { display: flex; align-items: center; gap: 18px; min-width: 0; }
.dash-hero .mud-icon-root { color: #fff; }
.dash-hero-title { font-weight: 800; font-size: 1.7rem; line-height: 1.15; }
.dash-hero-sub { font-size: 0.92rem; opacity: 0.92; margin-top: 2px; }

.dash-hero-badge {
    flex: 0 0 auto;
    min-width: 64px;
    text-align: center;
    background: rgba(255,255,255,0.22);
    border-radius: 14px;
    padding: 10px 14px;
    font-weight: 800;
    font-size: 1.9rem;
    line-height: 1;
}
.dash-hero-badge-label { display: block; font-size: 0.62rem; font-weight: 600; opacity: 0.9; margin-top: 4px; }

@media (max-width: 600px) {
    .dash-hero-title { font-size: 1.35rem; }
    .dash-hero { padding: 20px; }
}

/* ===== Statistiche (KPI card + barre) ===== */
.stat-card {
    border-radius: 14px;
    padding: 16px 18px;
    height: 100%;
    background: #fff;
    border: 1px solid #E6E7E5;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}
.stat-card.accent { color: #fff; border: none; }
.stat-label { font-size: 0.8rem; opacity: 0.85; font-weight: 600; }
.stat-value { font-size: 1.9rem; font-weight: 800; line-height: 1.1; margin-top: 4px; }
.stat-sub { font-size: 0.75rem; opacity: 0.8; margin-top: 2px; }

.stat-bar-row { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.stat-bar-name { flex: 0 0 40%; font-size: 0.85rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.stat-bar-track { flex: 1; background: #EFF0EE; border-radius: 6px; height: 18px; overflow: hidden; }
.stat-bar-fill { height: 100%; border-radius: 6px; background: linear-gradient(90deg,#517732,#22C55E); min-width: 2px; }
.stat-bar-value { flex: 0 0 auto; font-size: 0.82rem; font-weight: 700; min-width: 46px; text-align: right; }

.stat-cols { display: flex; align-items: flex-end; gap: 6px; height: 160px; padding-top: 8px; overflow-x: auto; }
.stat-col { display: flex; flex-direction: column; align-items: center; justify-content: flex-end; flex: 1 0 34px; height: 100%; }
.stat-col-bar { width: 60%; min-width: 14px; background: linear-gradient(180deg,#22C55E,#517732); border-radius: 5px 5px 0 0; min-height: 2px; }
.stat-col-val { font-size: 0.66rem; font-weight: 700; margin-bottom: 3px; color: #45474B; }
.stat-col-lbl { font-size: 0.66rem; color: #6B6E73; margin-top: 4px; white-space: nowrap; }

/* ===== Barra di navigazione inferiore (mobile) ===== */
.mobile-bottom-nav {
    display: none;
    position: fixed;
    left: 0; right: 0; bottom: 0;
    z-index: 1200;
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: saturate(180%) blur(12px);
    -webkit-backdrop-filter: saturate(180%) blur(12px);
    border-top: 1px solid #E6E7E5;
    padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
    justify-content: space-around;
    align-items: stretch;
    gap: 2px;
}

.mobile-bottom-nav .bnav {
    flex: 1 1 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    padding: 4px 2px;
    text-decoration: none;
    color: #6B6E73;
    font-size: 11px;
    font-weight: 500;
    border-radius: 10px;
    transition: color .15s ease, background-color .15s ease, transform .08s ease;
}

.mobile-bottom-nav .bnav:active { transform: scale(0.92); }

.mobile-bottom-nav .bnav.active {
    color: #517732;
    background: #ECF4E6;
}

/* Mostra la barra e lascia spazio sotto il contenuto solo su schermi piccoli */
@media (max-width: 959.98px) {
    .mobile-bottom-nav { display: flex; }
    .content-area { padding-bottom: 84px !important; }
}

/* Telefono in orizzontale: lo schermo è troppo basso, la barra in basso si nasconde (resta il menu ☰) */
@media (max-width: 959.98px) and (max-height: 500px) and (orientation: landscape) {
    .mobile-bottom-nav { display: none; }
    .content-area { padding-bottom: 24px !important; }
    .sf-actionbar { bottom: 8px !important; }
}

/* ===== Pagine di lavoro: sezioni, riepilogo, barra azioni ===== */
.sf-form { max-width: 1000px; }
/* pagine con tabelle larghe (es. righe dell'ordine): sfruttano gli schermi dei PC */
.sf-form-larga { max-width: 1440px; }
/* data di trapianto e giorni di crescita: affiancati su PC, uno sotto l'altro su smartphone */
.sf-trapianto { display: grid; grid-template-columns: 1fr; gap: 4px; }
@media (min-width: 960px) {
    .sf-una-riga { white-space: nowrap; }
    .sf-trapianto { grid-template-columns: minmax(150px, 1fr) 120px; gap: 10px; align-items: end; }
}

.sf-section {
    background: #fff;
    border: 1px solid #E4E5E3;
    border-radius: 14px;
    padding: 16px 18px;
    margin-bottom: 16px;
}
.sf-section.evidenza {
    border-color: #517732;
    box-shadow: 0 0 0 3px rgba(81, 119, 50, 0.08);
}

.sf-section-head { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; min-height: 30px; }
.sf-section-head.sf-clickable { cursor: pointer; user-select: none; margin-bottom: 0; }
.sf-section-head.sf-clickable + .mud-grid { margin-top: 10px; }
.sf-section-title { font-weight: 600; font-size: 1.05rem; color: #2B2D30; }
.sf-head-text { flex: 1; min-width: 0; display: flex; align-items: baseline; flex-wrap: wrap; column-gap: 10px; }
.sf-section-sub { font-size: 0.85rem; color: #6B6E73; }

.sf-step {
    flex: 0 0 auto;
    width: 26px; height: 26px;
    border-radius: 50%;
    background: #517732; color: #fff;
    font-weight: 700; font-size: 0.85rem;
    display: inline-flex; align-items: center; justify-content: center;
}
.sf-step.muted { background: #CFD1D3; }

.sf-seme { margin-bottom: 14px; }
.sf-seme-nome { font-size: 1.35rem; font-weight: 700; color: #1E1F21; line-height: 1.2; }
.sf-seme-varieta { font-weight: 500; color: #5F6065; }

.sf-kv {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(165px, 1fr));
    gap: 14px 20px;
}
.sf-kv-label { font-size: 0.72rem; font-weight: 600; color: #6B6E73; text-transform: uppercase; letter-spacing: .03em; }
.sf-kv-value { font-size: 1rem; font-weight: 600; color: #2B2D30; margin-top: 2px; }
.sf-kv-value.vuoto { color: #DC2626; font-weight: 500; }

/* anteprima calcolata accanto al pulsante Aggiungi */
.sf-anteprima { font-size: 0.92rem; color: #2B2D30; text-align: right; line-height: 1.3; }
.sf-anteprima-sub { display: block; font-size: 0.75rem; color: #6B6E73; }

/* barra comandi compatta */
.sf-toolbar { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 16px; padding: 10px 14px; }
.sf-week-label { font-weight: 600; min-width: 150px; text-align: center; }

/* selettore a segmenti (es. Settimana | Tutte) */
.sf-seg { display: inline-flex; border: 1px solid #517732; border-radius: 8px; overflow: hidden; }
.sf-seg button {
    border: none; background: #fff; color: #517732; cursor: pointer;
    font: inherit; font-size: 0.85rem; font-weight: 600; padding: 6px 14px;
}
.sf-seg button + button { border-left: 1px solid #517732; }
.sf-seg button.on { background: #517732; color: #fff; }
.sf-seg-big { display: flex; width: 100%; }
.sf-seg-big button { flex: 1; padding: 12px 10px; font-size: 0.95rem; }

/* Da seminare: intestazione del giorno e schede lavoro */
.sf-day-head {
    display: flex; align-items: center; gap: 8px;
    margin: 18px 0 8px; color: #45474B;
}
.sf-day-head .mud-icon-root { color: #517732; }
.sf-day-name { font-weight: 700; font-size: 1.02rem; }
.sf-day-head.oggi .sf-day-name { color: #517732; }
.sf-day-tot { font-size: 0.82rem; color: #6B6E73; }

.sf-task-list { display: flex; flex-direction: column; gap: 8px; }
.sf-task {
    display: flex; align-items: center; gap: 14px;
    background: #fff; border: 1px solid #E4E5E3; border-radius: 12px; padding: 10px 14px;
}
.sf-task-qta {
    flex: 0 0 auto; min-width: 64px; text-align: center;
    background: #F3F8EF; border-radius: 10px; padding: 6px 8px; line-height: 1.1;
}
.sf-task-num { display: block; font-size: 1.45rem; font-weight: 800; color: #517732; }
.sf-task-unit { font-size: 0.7rem; color: #6B6E73; }
.sf-task-body { flex: 1; min-width: 0; }
.sf-task-title { font-weight: 700; color: #1E1F21; }
.sf-task-actions { flex: 0 0 auto; display: flex; align-items: center; gap: 4px; }
.sf-task-num small { font-size: 0.85rem; font-weight: 600; color: #6B6E73; }
.sf-task.anomalia { border-color: #FCA5A5; background: #FFF7F7; }
.sf-task.anomalia .sf-task-qta { background: #FEE2E2; }
.sf-task.anomalia .sf-task-num { color: #B91C1C; }

/* pulsante principale grande (es. Scansiona) */
.sf-big-btn { min-height: 56px; font-size: 1rem !important; border-radius: 14px !important; }
/* "Leggi QR code" in dashboard: su telefono a tutta larghezza */
.dash-qr { min-width: 260px; }
@media (max-width: 599.98px) { .dash-qr { width: 100%; } }
/* pannello del QR: azioni grandi, una sotto l'altra */
.sf-qr-azioni { display: flex; flex-direction: column; gap: 10px; }

@media (max-width: 599.98px) {
    .sf-task { flex-wrap: wrap; }
    .sf-task-actions { width: 100%; justify-content: flex-end; border-top: 1px solid #EFF0EE; padding-top: 8px; }
}

/* schede selezionabili (es. semine da inserire nel DDT) */
.sf-pick-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 10px; }
.sf-pick {
    border: 1px solid #E4E5E3; border-radius: 12px; padding: 10px 12px;
    cursor: pointer; user-select: none; background: #fff;
    transition: border-color .12s ease, box-shadow .12s ease, background-color .12s ease;
}
.sf-pick:hover { border-color: #9A9DA1; }
.sf-pick.selected { border-color: #517732; background: #F3F8EF; box-shadow: 0 0 0 2px rgba(81, 119, 50, 0.15); }
.sf-pick-id { font-size: 0.8rem; font-weight: 700; color: #6B6E73; }
.sf-pick-qta { font-weight: 700; color: #1E1F21; }
.sf-pick-qta small { font-weight: 500; color: #6B6E73; }
.sf-pick-title { font-weight: 700; margin: 6px 0 2px; color: #1E1F21; }

/* tabelle con riga cliccabile (apre la scheda) */
.sf-table-click .mud-table-body .mud-table-row { cursor: pointer; }
.sf-zero { color: #9A9DA1; }
/* riquadro "esempio" calcolato al volo */
.sf-esempio {
    display: flex; gap: 8px; align-items: flex-start;
    background: #F3F8EF; border: 1px dashed #517732; border-radius: 10px;
    padding: 10px 12px; font-size: 0.88rem; color: #45474B;
}
.sf-esempio .mud-icon-root { color: #517732; margin-top: 2px; }

/* elenco puntato semplice dentro una sezione */
.sf-elenco { margin: 0 0 8px; padding-left: 20px; font-size: 0.92rem; color: #45474B; }
.sf-elenco li { margin-bottom: 4px; }

/* iniziali dell'operatore (pagina account) */
.sf-avatar {
    flex: 0 0 auto; width: 56px; height: 56px; border-radius: 50%;
    background: linear-gradient(135deg, #517732, #22C55E); color: #fff;
    display: flex; align-items: center; justify-content: center;
    font-weight: 800; font-size: 1.3rem;
}

/* giorni della settimana (calendario semina) */
.sf-giorni { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 8px; }
.sf-giorno {
    border: 1px solid; border-radius: 12px; padding: 10px 4px; cursor: pointer;
    font: inherit; display: flex; flex-direction: column; align-items: center; gap: 2px;
    transition: background-color .12s ease, transform .08s ease;
}
.sf-giorno:active { transform: scale(0.96); }
.sf-giorno:disabled { opacity: .6; cursor: wait; }
.sf-giorno.aperto { background: #F3F8EF; border-color: #517732; color: #517732; }
.sf-giorno.chiuso { background: #FEF2F2; border-color: #EF4444; color: #B91C1C; }
.sf-giorno-nome { font-weight: 700; font-size: 0.95rem; }
.sf-giorno-stato { font-size: 0.72rem; }
@media (max-width: 599.98px) {
    .sf-giorni { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

/* pillole modificabili (es. tunnel delle serre) */
.sf-pill {
    display: inline-flex; align-items: center; gap: 2px;
    border: 1px solid #E4E5E3; border-radius: 20px; padding: 2px 4px 2px 14px; background: #fff;
    font-size: 0.9rem; white-space: nowrap;
}
.sf-pill-add { border-radius: 20px !important; }

.sf-qta-piu { color: #15803D; }
.sf-qta-meno { color: #B91C1C; }

/* titoli di sezione dentro le finestre di modifica */
.sf-dlg-title {
    font-size: 0.75rem; font-weight: 700; letter-spacing: .05em; text-transform: uppercase;
    color: #517732; margin: 20px 0 6px; padding-bottom: 4px; border-bottom: 1px solid #E4E5E3;
}
.sf-dlg-title:first-child { margin-top: 0; }

/* riquadro di inserimento in linea (es. nuovo periodo) */
.sf-inline-edit { background: #F6F7F5; border: 1px solid #E4E5E3; border-radius: 10px; padding: 8px 12px; margin-top: 10px; }

/* testo secondario dentro una cella di tabella */
.sf-cell-sub { font-size: 0.72rem; color: #6B6E73; }

/* riga dei totali sotto una tabella */
.sf-totali {
    display: flex; flex-wrap: wrap; gap: 6px 24px; justify-content: flex-end;
    border-top: 2px solid #E4E5E3;
    margin-top: 4px; padding: 10px 8px 0;
    font-size: 0.92rem; color: #45474B;
}
.sf-totali > span:first-child { margin-right: auto; font-weight: 600; color: #6B6E73; text-transform: uppercase; font-size: 0.75rem; align-self: center; }

.sf-actionbar {
    position: sticky;
    bottom: 12px;
    z-index: 20;
    display: flex; align-items: center; gap: 8px;
    background: rgba(255, 255, 255, 0.96);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border: 1px solid #E4E5E3;
    border-radius: 14px;
    padding: 10px 12px 10px 16px;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.10);
}
.sf-actionbar-info { flex: 1; min-width: 0; font-size: 0.9rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sf-mancanti { color: #B45309; }

/* sopra la barra di navigazione inferiore su smartphone/tablet */
@media (max-width: 959.98px) {
    .sf-actionbar { bottom: calc(76px + env(safe-area-inset-bottom)); }
}
@media (max-width: 599.98px) {
    .sf-section { padding: 14px; }
    .sf-actionbar-info { white-space: normal; font-size: 0.82rem; }
}

h1:focus {
    outline: none;
}

/* AppBar flat con bordo inferiore (look moderno) */
.appbar-border {
    border-bottom: 1px solid #E6E7E5;
}

/* Drawer con bordo destro sottile invece dell'ombra */
.drawer-border {
    border-right: 1px solid #E6E7E5;
}

/* Drawer a colonna: logo fisso in alto, menu scrollabile sotto */
.mud-drawer .mud-drawer-content {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.nav-scroll {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
}

/* ===== Validazione form ===== */
.valid.modified:not([type=checkbox]) {
    outline: 1px solid #16A34A;
}

.invalid {
    outline: 1px solid #DC2626;
}

.validation-message {
    color: #DC2626;
}

/* ===== Blazor error UI ===== */
#blazor-error-ui {
    background: lightyellow;
    bottom: 0;
    box-shadow: 0 -1px 2px rgba(0, 0, 0, 0.2);
    display: none;
    left: 0;
    padding: 0.6rem 1.25rem 0.7rem 1.25rem;
    position: fixed;
    width: 100%;
    z-index: 1000;
}

    #blazor-error-ui .dismiss {
        cursor: pointer;
        position: absolute;
        right: 0.75rem;
        top: 0.5rem;
    }

.blazor-error-boundary {
    background: #b32121;
    padding: 1rem;
    color: white;
}

    .blazor-error-boundary::after {
        content: "Si è verificato un errore.";
    }

/* finestra del ruolo: funzioni raggruppate come nel menu */
.sf-ruolo-gruppi { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px 20px; }
.sf-ruolo-gruppo { border: 1px solid var(--mud-palette-lines-default); border-radius: 10px; padding: 6px 10px 8px; }
.sf-ruolo-voci { padding-left: 26px; display: flex; flex-direction: column; }
@media (max-width: 599.98px) { .sf-ruolo-gruppi { grid-template-columns: 1fr; } }

/* ===== Statistiche: schede con classifiche a barre ===== */
.sf-rank-card { height: 100%; margin-bottom: 0; }
.sf-rank-row { display: flex; align-items: center; gap: 12px; padding: 8px 0; border-top: 1px solid #F0F1EF; }
.sf-rank-list > .sf-rank-row:first-child { border-top: none; padding-top: 0; }
.sf-rank-n {
    flex: 0 0 auto;
    width: 24px; height: 24px; border-radius: 50%;
    background: #EEF0EC; color: #5F6065;
    font-size: 0.75rem; font-weight: 700;
    display: inline-flex; align-items: center; justify-content: center;
}
.sf-rank-body { flex: 1; min-width: 0; }
.sf-rank-line { display: flex; align-items: baseline; gap: 8px; margin-bottom: 5px; }
.sf-rank-nome { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 0.9rem; color: #2B2D30; }
.sf-rank-val { white-space: nowrap; font-size: 0.9rem; }
.sf-rank-pct { display: inline-block; min-width: 42px; text-align: right; font-size: 0.78rem; color: #6B6E73; }
.sf-rank-track { height: 6px; border-radius: 3px; background: #EEF0EC; overflow: hidden; }
.sf-rank-fill { height: 100%; border-radius: 3px; }
.sf-rank-click { cursor: pointer; margin: 0 -10px; padding-left: 10px; padding-right: 10px; border-radius: 10px; }
.sf-rank-click:hover { background: #F6F7F5; }
.sf-rank-click.sel { background: #EEF4E8; box-shadow: inset 3px 0 0 var(--sf-rank-sel, #517732); }

/* ===== Natura dei semi: gruppi da sistemare ===== */
.sf-natura-gruppo { padding: 10px 0; border-top: 1px solid #F0F1EF; }
.sf-natura-gruppo:first-of-type { border-top: none; }
.sf-natura-semi { margin: 6px 0 0 44px; display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }


/* Etichette della semina: nascoste, le stampa js/etichette.js in una pagina a parte (A4 o rotolo) */
.sf-etichette { display: none; }


/* ===== Gruppi di semine (stessa semina fatta con più buste): testata + una riga per semina ===== */
.sf-gruppo-testata { background: #EAF3FB !important; }
.sf-gruppo-testata > td:first-child { box-shadow: inset 4px 0 0 #5B9BD5; }
.sf-gruppo-titolo { display: inline-flex; align-items: center; gap: 4px; font-weight: 700; color: #2F6A9E; white-space: nowrap; }
.sf-gruppo-figlia { background: #F5F9FD; cursor: pointer; }
.sf-gruppo-figlia:hover { background: #EAF3FB; }
.sf-gruppo-figlia > td:first-child { box-shadow: inset 4px 0 0 #A9CBEA; padding-left: 20px !important; }
.sf-gruppo-ramo { color: #7FAAD3; }
.sf-cell-sub-inline { font-size: .8rem; color: #6B6E73; }
@media (max-width: 959.98px) {
    /* su smartphone le semine del gruppo sono schede rientrate, attaccate sotto la testata */
    .card-rows .mud-table-row.sf-gruppo-testata { border-color: #5B9BD5; border-width: 2px; }
    .card-rows .mud-table-row.sf-gruppo-testata .mud-table-cell:first-child { background: #D9E9F7; }
    .card-rows .mud-table-row.sf-gruppo-figlia { margin-left: 18px; border-left: 4px solid #A9CBEA; margin-top: -6px; }
    .card-rows .mud-table-row.sf-gruppo-figlia .mud-table-cell:first-child { box-shadow: none; padding-left: 10px !important; }
}

.sf-gruppo-box { border: 2px solid #5B9BD5; border-radius: 12px; background: #F1F7FC; padding: 12px 14px; margin-bottom: 16px; }
.sf-gruppo-box-head { display: flex; align-items: center; gap: 10px; color: #2F6A9E; }
.sf-gruppo-box-titolo { font-weight: 700; font-size: 1.05rem; }
.sf-gruppo-box-sub { font-size: .85rem; color: #45474B; }
.sf-gruppo-box-semine { display: flex; flex-direction: column; gap: 6px; margin-top: 10px; }
.sf-gruppo-box-semina {
    display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
    background: #fff; border: 1px solid #CFE2F3; border-left: 4px solid #A9CBEA; border-radius: 8px;
    padding: 6px 10px; cursor: pointer;
}
.sf-gruppo-box-semina:hover { background: #EAF3FB; }
.sf-gruppo-box-semina.corrente { border-left-color: #5B9BD5; background: #DCEBF8; cursor: default; }

/* Nuovo DDT: semine di un gruppo sotto la loro testata, su tutta la larghezza */
.sf-pick-gruppo { grid-column: 1 / -1; border: 2px solid #5B9BD5; border-radius: 12px; background: #F1F7FC; padding: 10px; }
.sf-pick-gruppo-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 10px; color: #2F6A9E; }
.sf-pick-gruppo-head b { color: #1E1F21; }

/* Posizioni consigliate (finestra Assegna posizione) */
.sf-proposte { display: flex; flex-direction: column; gap: 6px; }
.sf-proposta { border: 1px solid #DFE0DE; border-left: 4px solid #A9C38F; border-radius: 8px; padding: 8px 10px; cursor: pointer; background: #fff; }
.sf-proposta:hover { background: #F3F8EF; }
.sf-proposta.scelta { border-color: #517732; border-left-color: #517732; background: #EEF5E8; }

/* Serre: misure del tunnel staccate dal nome */
.sf-pill .sf-cell-sub-inline { margin-left: 6px; }

/* ===== Assegna posizione: mini Vista serra ===== */
.sf-mappa-serre { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 6px 0 12px; }
.sf-mappa-serra {
    display: flex; flex-direction: column; align-items: flex-start; gap: 1px; cursor: pointer;
    border: 1px solid #CFD1D3; border-radius: 10px; padding: 6px 12px; background: #F2F3F1; color: #45474B; font: inherit;
}
.sf-mappa-serra span { font-size: .75rem; opacity: .85; }
.sf-mappa-serra.on { background: #517732; border-color: #517732; color: #fff; }
.sf-mappa-tunnel { display: flex; gap: 10px; overflow-x: auto; padding: 4px 2px 8px; background: #eceff1; border-radius: 10px; }
.sf-mappa-col {
    flex: 0 0 150px; display: flex; flex-direction: column; gap: 6px; cursor: pointer;
    background: #fff; border: 2px solid transparent; border-radius: 10px; padding: 8px; box-shadow: 0 1px 3px rgba(0,0,0,.12);
}
.sf-mappa-col:hover { border-color: #A9C38F; }
.sf-mappa-col.scelto { border-color: #517732; box-shadow: 0 0 0 3px rgba(81,119,50,.2); }
.sf-mappa-col.escluso { opacity: .55; }
.sf-mappa-testa { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.sf-mappa-stella { background: #FFF3C4; color: #8A6D00; border-radius: 6px; padding: 0 5px; font-size: .75rem; font-weight: 700; }
.sf-mappa-qui { background: #E3F0FB; color: #2F6A9E; border-radius: 6px; padding: 0 5px; font-size: .7rem; }
.sf-mappa-barra { height: 190px; display: flex; flex-direction: column; gap: 2px; border-radius: 6px; overflow: hidden; background: #F5F6F4; padding: 2px; }
.sf-mappa-barra .seg { min-height: 3px; border-radius: 3px; }
.sf-mappa-barra .seg.semina-verde { background: #2e7d32; }
.sf-mappa-barra .seg.semina-giallo { background: #fbc02d; }
.sf-mappa-barra .seg.semina-arancio { background: #e65100; }
.sf-mappa-barra .seg.semina-rosso { background: #b71c1c; }
.sf-mappa-barra .seg.nuova {
    min-height: 10px; border: 2px dashed #517732;
    background: repeating-linear-gradient(45deg, #DDEBCF, #DDEBCF 6px, #F3F8EF 6px, #F3F8EF 12px);
}
.sf-mappa-barra .seg.libero { background: transparent; }
.sf-mappa-numeri { display: flex; justify-content: space-between; gap: 4px; font-size: .75rem; color: #45474B; flex-wrap: wrap; }
.sf-mappa-senza { height: 190px; display: flex; align-items: center; justify-content: center; text-align: center; font-size: .8rem; color: #78909c; border: 2px dashed #CFD8DC; border-radius: 6px; }
.sf-mappa-motivo { font-size: .72rem; color: #45474B; line-height: 1.25; }
.sf-mappa-motivo.escluso { color: #b71c1c; font-weight: 600; }

/* ===== Designer della serra: piantina a box ===== */
.sf-piantina { border: 3px solid #546e7a; border-radius: 8px; overflow: hidden; background: #eceff1; }
.sf-piantina-etichetta { background: #546e7a; color: #cfd8dc; font-size: .72rem; padding: 4px 10px; letter-spacing: .05em; }
.sf-piantina-griglia { display: grid; gap: 4px; padding: 6px; overflow-x: auto; }
.sf-piantina-tunnel { text-align: center; font-size: .75rem; font-weight: 700; color: #45474B; display: flex; flex-direction: column; }
.sf-piantina-tunnel small { font-weight: 400; font-size: .68rem; color: #6B6E73; }
.sf-piantina-fila { display: flex; flex-direction: column; align-items: center; justify-content: center; font-weight: 700; color: #45474B; }
.sf-piantina-fila small { font-weight: 400; font-size: .68rem; color: #6B6E73; }
.sf-piantina-box {
    display: flex; flex-direction: column; align-items: center; justify-content: center; cursor: pointer;
    background: #fff; border: 1px solid #CFD8DC; border-radius: 6px; user-select: none;
}
.sf-piantina-box:hover { border-color: #517732; }
.sf-piantina-box small { font-size: .68rem; color: #6B6E73; }
.sf-piantina-box.fuori { background: repeating-linear-gradient(45deg, #ECEFF1, #ECEFF1 6px, #DDE2E5 6px, #DDE2E5 12px); color: #90A4AE; }
.sf-piantina-vuota { height: 220px; display: flex; align-items: center; justify-content: center; border: 2px dashed #CFD8DC; border-radius: 8px; color: #78909c; }

/* Assegna posizione, serre a box: i box del tunnel impilati (fondo in alto, ingresso in basso) */
.sf-mappa-boxcol { display: flex; flex-direction: column; gap: 4px; }
.sf-mappa-boxriga { display: flex; gap: 4px; }
.sf-mappa-boxriga > .sf-mappa-box { min-width: 0; }
.sf-mappa-box {
    min-height: 52px; display: flex; flex-direction: column; gap: 2px; padding: 3px 5px; overflow: hidden;
    border: 1px solid #CFD8DC; border-radius: 6px; background: #FAFBFA; cursor: pointer;
}
.sf-mappa-box:hover { border-color: #A9C38F; }
.sf-mappa-box.scelto { border: 2px solid #517732; background: #F3F8EF; }
.sf-mappa-box.escluso { opacity: .6; background: repeating-linear-gradient(45deg, #F5F6F4, #F5F6F4 6px, #ECEFF1 6px, #ECEFF1 12px); }
.sf-mappa-box-testa { display: flex; align-items: center; gap: 4px; font-size: .8rem; }
.sf-mappa-box-barra { flex: 1; min-height: 8px; display: flex; gap: 1px; border-radius: 3px; overflow: hidden; background: #EEF0EE; }
.sf-mappa-box-barra .seg { min-width: 3px; }
.sf-mappa-box-barra .seg.semina-verde { background: #2e7d32; }
.sf-mappa-box-barra .seg.semina-giallo { background: #fbc02d; }
.sf-mappa-box-barra .seg.semina-arancio { background: #e65100; }
.sf-mappa-box-barra .seg.semina-rosso { background: #b71c1c; }
.sf-mappa-box-barra .seg.nuova { background: repeating-linear-gradient(45deg, #A9C38F, #A9C38F 4px, #DDEBCF 4px, #DDEBCF 8px); }
.sf-mappa-box small { font-size: .68rem; color: #6B6E73; white-space: nowrap; }
.sf-mappa-senzabox { font-size: .7rem; color: #8A6D00; background: #FFF3C4; border-radius: 6px; padding: 1px 6px; align-self: flex-start; }
.sf-avviso-pos { font-size: .75rem; font-weight: 600; color: #8A6D00; background: #FFF3C4; border-radius: 6px; padding: 1px 6px; margin-top: 2px; display: inline-block; }

/* posizioni consigliate ben visibili */
.sf-mappa-col.consigliato { border-color: #F2C94C; }
.sf-mappa-box.consigliato { border: 2px solid #F2C94C; background: #FFFBEA; box-shadow: 0 0 0 2px rgba(242,201,76,.25); }
.sf-mappa-box.consigliato.scelto { border-color: #517732; background: #F3F8EF; }
.sf-mappa-stella.grande { font-size: .85rem; padding: 1px 7px; background: #F2C94C; color: #3d2f00; }
.sf-mappa-col.consigliato.scelto { border-color: #517732; }

/* Supporti del tunnel (dialog) */
.sf-supporto-riga { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 4px 6px; border-radius: 6px; border: 1px solid #e0e0e0; margin-bottom: 4px; background: #fff; }
.sf-supporto-riga.fuori { background: #f5f5f5; opacity: .7; }
.sf-tunnel-anteprima { display: inline-flex; flex-direction: column; gap: 3px; padding: 4px; border: 2px solid #90a4ae; border-radius: 8px; background: #fafafa; }
.sf-tunnel-riga { display: flex; gap: 3px; align-self: center; }
.sf-piantina:has(.sf-tunnel-anteprima) { width: fit-content; margin: 0 auto; }
.sf-piantina .sf-tunnel-anteprima { display: flex; border: 0; border-radius: 0; }
.sf-tunnel-anteprima.sfora { outline: 2px solid #d32f2f; outline-offset: -2px; }
.sf-tunnel-vuoto { display: flex; align-items: center; justify-content: center; font-size: 11px; color: #78909c; text-align: center; border-radius: 4px;
    background: repeating-linear-gradient(45deg, #f5f5f5, #f5f5f5 6px, #e8ecef 6px, #e8ecef 12px); overflow: hidden; }
/* Scarti di una semina (dialog) */
.sf-scarto-riga { padding: 4px 6px; border-bottom: 1px solid #eceff1; font-size: .85rem; }
.sf-perdita-riga { padding: 3px 0; border-bottom: 1px solid #f0f2f3; font-size: .85rem; }
/* Registro modifiche e storico della semina */
.sf-registro-dettagli { font-size: .8rem; color: #45474B; overflow-wrap: anywhere; }
.sf-storico-riga { padding: 6px 0; border-bottom: 1px solid #eceff1; }


/* ===== Assistente SeedFlow (Shared/ChatAssistente.razor) ===== */
.sf-chat-pulsante {
    position: fixed; right: 20px; bottom: 20px; z-index: 1300;
    width: 64px; height: 64px; border-radius: 50%; padding: 0; overflow: hidden;
    border: 3px solid #517732; background: #fff; cursor: pointer;
    box-shadow: 0 4px 14px rgba(0,0,0,.25); transition: transform .15s;
}
.sf-chat-pulsante:hover { transform: scale(1.06); }
.sf-chat-pulsante seedflow-avatar { width: 100%; height: 100%; display: block; }
.sf-chat-riquadro {
    position: fixed; right: 20px; bottom: 96px; z-index: 1300;
    width: 400px; height: 600px; max-height: calc(100vh - 120px);
    display: flex; flex-direction: column; background: #fff; border-radius: 14px; overflow: hidden;
    box-shadow: 0 8px 30px rgba(0,0,0,.25); font-size: .9rem;
}
.sf-chat-riquadro.grande { width: 520px; height: 720px; }
.sf-chat-riquadro.massima { width: min(760px, calc(100vw - 40px)); height: calc(100vh - 120px); }
.sf-chat-riquadro.testo-grande { font-size: 1.05rem; }
.sf-chat-testata { display: flex; align-items: center; gap: 8px; padding: 6px 8px; background: #517732; color: #fff; }
.sf-chat-testata-avatar { width: 40px; height: 40px; border-radius: 50%; overflow: hidden; background: #fff; display: block; }
.sf-chat-titolo { flex: 1; font-weight: 600; }
.sf-chat-testata .sf-chat-icona { color: #fff !important; }
.sf-chat-pannello { flex: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; }
.sf-chat-pannello-titolo { font-weight: 600; font-size: 1.05em; margin-bottom: 12px; }
.sf-chat-opzione-titolo { font-size: .85em; color: #555; margin-bottom: 4px; }
.sf-chat-scelta-avatar { border: 2px solid #ddd; border-radius: 12px; background: #fff; padding: 10px; cursor: pointer; }
.sf-chat-scelta-avatar:hover { border-color: #517732; }
.sf-chat-scelta-avatar seedflow-avatar { width: 110px; height: 110px; display: block; }
.sf-chat-messaggi { flex: 1; overflow-y: auto; padding: 10px; background: #f6f8f4; display: flex; flex-direction: column; gap: 8px; }
.sf-chat-riga { display: flex; gap: 6px; align-items: flex-start; }
.sf-chat-avatar { width: 30px; height: 30px; border-radius: 50%; object-fit: cover; flex-shrink: 0; }
.sf-chat-msg { padding: 8px 11px; border-radius: 12px; white-space: pre-wrap; word-break: break-word; max-width: 85%; }
.sf-chat-msg.utente { align-self: flex-end; background: #517732; color: #fff; border-bottom-right-radius: 3px; }
.sf-chat-msg.assistente { background: #fff; border: 1px solid #e2e6dd; border-bottom-left-radius: 3px; }
.sf-chat-voto { margin-top: 4px; text-align: right; }
.sf-chat-voto button { border: none; background: none; cursor: pointer; opacity: .35; font-size: .9em; }
.sf-chat-voto button:hover, .sf-chat-voto button.scelto { opacity: 1; }
.sf-chat-nota { display: flex; gap: 4px; align-items: center; margin-left: 36px; }
.sf-chat-rapidi { display: flex; flex-wrap: wrap; gap: 6px; margin-left: 36px; }
.sf-chat-scheda { background: #fff; border: 1px solid #b9cfa6; border-radius: 10px; padding: 10px; margin-left: 36px; }
.sf-chat-scheda.creato { border-color: #517732; background: #eef5e8; }
.sf-chat-scheda-titolo { font-weight: 600; margin-bottom: 6px; color: #3d5a26; }
.sf-chat-opzione { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 5px 0; border-top: 1px solid #eee; }
.sf-chat-riga-ordine { padding: 4px 0; border-top: 1px solid #eee; }
.sf-chat-invio { display: flex; gap: 6px; align-items: center; padding: 8px; border-top: 1px solid #e2e6dd; }
.sf-chat-input { flex: 1; min-width: 0; resize: none; font: inherit; padding: 6px 8px; border: 1px solid #ccc; border-radius: 8px; }
.sf-chat-input:focus { outline: none; border-color: #517732; }

@media (max-width: 959.98px) {
    /* sopra la barra di navigazione inferiore */
    .sf-chat-pulsante { bottom: 76px; right: 12px; width: 54px; height: 54px; }
    .sf-chat-pulsante.aperto { display: none; }
    /* sul telefono il riquadro occupa tutto lo schermo */
    .sf-chat-riquadro, .sf-chat-riquadro.grande, .sf-chat-riquadro.massima {
        inset: 0; width: 100%; height: 100%; max-height: none; border-radius: 0; z-index: 1400;
    }
}
