/* ===== S.AI.LS — Grafica soft, cornici arancio, logo vela, alta leggibilità ===== */
:root {
    --app-bg: #f8fafc;
    --app-panel-bg: #ffffff;
    --app-border: #e2e8f0;
    --app-border-accent: #94b8d4;
    --app-border-strong: #cbd5e1;
    --app-text: #1e293b;
    --app-text-muted: #475569;
    --app-text-soft: #64748b;
    --app-accent: #0e7ab8;
    --app-accent-hover: #0b6a9e;
    --app-menu-active-bg: #eff6fb;
    --app-menu-active-border: #7eb8dc;
    --app-heading: #0f172a;
    /* Cornici e frame arancio (logo, topbar, sezioni) */
    --app-orange: #ea580c;
    --app-orange-light: #fff7ed;
    --app-orange-border: #c2410c;
    --app-orange-soft: #fed7aa;
    /* Elenchi tabellari su sfondo chiaro: non usare --app-text (nei temi blu/scuri è chiaro) */
    --mysales-table-cell-color: #1e293b;
    --mysales-table-muted-color: #64748b;
    /* Sfondo area tabella nei pannelli (su tema scuro non deve restare bianco puro) */
    --mysales-table-wrap-bg: #ffffff;
}

* {
    box-sizing: border-box;
}

html {
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
}

body {
    margin: 0;
    font-family: "Segoe UI", system-ui, -apple-system, BlinkMacSystemFont, "Helvetica Neue", sans-serif;
    font-size: 14px;
    line-height: 1.45;
    letter-spacing: 0.01em;
    color: var(--app-text);
}

.app-shell {
    background: var(--app-bg);
    color: var(--app-text);
}

/* ----- Topbar: frame superiore arancio ----- */
.topbar {
    background: var(--app-panel-bg);
    border-bottom: 1px solid var(--app-border);
    box-shadow: 0 1px 0 rgba(234, 88, 12, 0.08);
}

.topbar::after {
    content: "";
    display: block;
    height: 3px;
    background: linear-gradient(90deg, var(--app-orange) 0%, var(--app-orange-soft) 100%);
    opacity: 0.95;
}

.topbar-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 10px 20px;
}

.brand {
    display: flex;
    align-items: center;
    gap: 14px;
    line-height: 1.2;
}

/* Logo vela con cornice arancio – ingrandito su tutte le pagine */
.brand-logo-wrap {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 96px;
    height: 96px;
    flex-shrink: 0;
    border: 2px solid var(--app-orange);
    border-radius: 12px;
    background: #fff;
    padding: 9px;
    text-decoration: none;
    transition: box-shadow 0.2s ease, border-color 0.2s ease;
}

.brand-logo-wrap:hover {
    border-color: var(--app-orange-border);
    box-shadow: 0 2px 12px rgba(234, 88, 12, 0.2);
}

.brand-logo-sail {
    display: block;
    width: 100%;
    height: 100%;
}

/* Logo immagine: sfondo trasparente (il template si vede attraverso) */
.app-logo-img-wrap {
    background: transparent;
}
.app-logo-img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
}
.login-logo-img {
    max-width: 100%;
    max-height: 100%;
}

.brand-text {
    display: flex;
    flex-direction: column;
}

.brand-title {
    font-family: Georgia, "Times New Roman", "Palatino Linotype", serif;
    font-size: 1.625rem;
    font-weight: 700;
    color: var(--app-orange);
    letter-spacing: 0.02em;
    line-height: 1.15;
}

.brand-sub {
    margin-top: 2px;
    font-size: 0.65rem;
    color: var(--app-text-soft);
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

/* ----- Menu: carattere leggibile, linee di definizione ----- */
.menu {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    align-items: center;
}

.menu-item {
    position: relative;
}

/*
 * Ponte invisibile sotto la voce: il .menu-item in altezza coincide solo con il trigger,
 * mentre il .submenu è position:absolute; spostando il mouse nel gap si perdeva :hover.
 * Il pseudo-elemento estende l’area sensibile fino al sottomenu (stessa min-width).
 */
.menu-item:not(.menu-item--collapsible)::before {
    content: "";
    position: absolute;
    left: 0;
    top: 100%;
    width: 100%;
    min-width: 200px;
    height: 14px;
    z-index: 29;
}

.menu-link {
    display: inline-block;
    text-decoration: none;
    font-size: 12px;
    font-weight: 600;
    color: var(--app-text-muted);
    padding: 8px 12px;
    border-radius: 8px;
    letter-spacing: 0.02em;
    border: 1px solid transparent;
    transition: color 0.2s ease, background 0.2s ease, border-color 0.2s ease;
}

.menu-link:hover {
    color: var(--app-heading);
    background: #f1f5f9;
    border-color: var(--app-border);
}

.menu-link-active {
    color: var(--app-orange-border);
    background: var(--app-orange-light);
    border: 1px solid var(--app-orange-soft);
}

.submenu {
    display: none;
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    min-width: 200px;
    border: 1px solid var(--app-border);
    border-radius: 10px;
    background: var(--app-panel-bg);
    box-shadow: 0 10px 24px rgba(15, 23, 42, 0.08);
    z-index: 30;
    overflow: hidden;
}

.menu-item:hover .submenu,
.menu-item:focus-within .submenu {
    display: block;
}

/* Gestione: chiuso di default, si apre al clic */
.menu-item--collapsible .submenu {
    display: none;
}
.menu-item--collapsible:hover .submenu,
.menu-item--collapsible:focus-within .submenu {
    display: none;
}
.menu-item--collapsible.is-open .submenu {
    display: block;
}
.menu-link-toggle {
    cursor: pointer;
    border: 1px solid transparent;
    font: inherit;
    background: transparent;
    width: 100%;
    text-align: left;
    padding: 8px 12px;
    border-radius: 8px;
}

.submenu-link {
    display: block;
    padding: 8px 12px;
    font-size: 12px;
    color: var(--app-text);
    text-decoration: none;
    border-bottom: 1px solid var(--app-border);
    transition: background 0.15s ease, color 0.15s ease;
}

.submenu-link:last-child {
    border-bottom: 0;
}

.submenu-link:hover {
    background: var(--app-orange-light);
    color: var(--app-orange-border);
}

.top-icons {
    display: flex;
    align-items: center;
    gap: 10px;
}

.top-icons a {
    font-size: 13px;
    color: var(--app-text-soft);
    text-decoration: none;
}

.top-icons a:hover {
    color: var(--app-accent);
}

.top-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--app-border-accent);
    opacity: 0.7;
}

.top-logout {
    font-size: 13px;
    color: var(--app-text-soft);
    text-decoration: none;
    font-weight: 500;
}

.top-logout:hover {
    color: var(--app-accent);
}

/* ----- Main e page head ----- */
main {
    padding: 18px 24px 28px;
}

@media (min-width: 1024px) {
    main {
        padding-left: 40px;
        padding-right: 40px;
    }
}

/* ----- Page head: enfatizzata con cornice e colore di fondo ----- */
.page-head {
    margin-bottom: 12px;
    padding: 10px 16px;
    background: var(--app-orange-light);
    border: 1px solid var(--app-orange-soft);
    border-left: 4px solid var(--app-orange);
    border-radius: 10px;
}

.page-title {
    margin: 0;
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--app-orange);
    letter-spacing: -0.02em;
    line-height: 1.3;
}

.page-breadcrumb {
    margin: 2px 0 0;
    font-size: 12px;
    color: var(--app-orange-border);
    line-height: 1.3;
}

.page-head.page-head--split {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 10px 16px;
}

.page-head.page-head--split .page-head__main {
    flex: 1 1 auto;
    min-width: 0;
}

.page-head.page-head--split .page-head__extra {
    flex: 0 1 auto;
    max-width: 100%;
}

/* ----- Panel: cornice arancio sinistra, area definita ----- */
.panel {
    background: var(--app-panel-bg);
    border: 1px solid var(--app-border);
    border-radius: 12px;
    padding: 22px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.04);
    border-left: 4px solid var(--app-orange);
}

.page-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    justify-content: flex-end;
    margin-bottom: 20px;
}

/* ----- Bottoni ----- */
.btn {
    border-radius: 8px;
    padding: 7px 14px;
    font-size: 12px;
    font-weight: 600;
    border: 1px solid transparent;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    line-height: 1.25;
    transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

.btn-primary {
    background: var(--app-accent);
    color: #ffffff;
    border-color: var(--app-accent-hover);
}

.btn-primary:hover {
    background: var(--app-accent-hover);
}

.btn-warning {
    background: #d97706;
    color: #ffffff;
    border-color: #b45309;
}

/* ----- Filtri: cornice arancio, layout compatto (flex + wrap) ----- */
.filters {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px 10px;
    margin-bottom: 12px;
    padding: 10px 14px;
    background: var(--app-orange-light);
    border: 2px solid var(--app-orange-soft);
    border-radius: 10px;
}

.filters .field {
    flex: 1 1 170px;
    min-width: min(100%, 120px);
    width: auto;
    max-width: 100%;
}

.filters input.field[type="date"],
.filters input[type="date"].field {
    flex: 0 1 152px;
    min-width: 132px;
    max-width: 170px;
}

/* Raggruppa Cerca + Reset (o Aggiorna + Esporta) sulla stessa riga */
.filters-actions {
    display: inline-flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    flex: 0 0 auto;
}

.filters .btn {
    height: 36px;
    padding: 6px 14px;
    font-size: 13px;
    flex-shrink: 0;
}

/* Filtri compatti (Contratti attivati, Recuperi, ecc.) — poco ingombro verticale */
.filters.filters-compact {
    gap: 6px 8px;
    margin-bottom: 8px;
    padding: 6px 10px;
}
.filters.filters-compact .field {
    height: 32px;
    font-size: 12px;
    padding: 0 8px;
}
.filters.filters-compact .btn {
    height: 32px;
    padding: 4px 10px;
    font-size: 12px;
}
.filters.filters-compact .field.field-search-narrow {
    min-width: 140px;
    max-width: 220px;
}

/* Select fase elaborazione CRM2 (Contratti attivati): non espandersi su tutta la riga */
.filters.filters-compact select.field.field-elab-phase {
    flex: 0 1 200px;
    min-width: 160px;
    max-width: 220px;
    width: auto;
}

/* Link di navigazione tra elenchi CRM (es. contratti) */
.btn-nav-sm {
    font-size: 11px !important;
    font-weight: 600;
    padding: 4px 10px !important;
    line-height: 1.25 !important;
    border-radius: 6px;
}

.field {
    width: 100%;
    height: 36px;
    border-radius: 8px;
    border: 1px solid var(--app-border);
    background: var(--app-panel-bg);
    color: var(--app-text);
    padding: 0 10px;
    font-size: 13px;
}

/* Policy (form utente): select multipli più grandi e gestibili */
.policy-menu-select,
.policy-gruppi-select {
    min-width: 280px;
    min-height: 220px !important;
}

.field:focus {
    outline: none;
    border-color: var(--app-orange);
    box-shadow: 0 0 0 2px rgba(234, 88, 12, 0.15);
}

/* ----- Tabelle: cornice arancio e intestazione evidenziata (img4) ----- */
.table-wrap {
    overflow: auto;
    border-radius: 10px;
    border: 2px solid var(--app-orange-soft);
    border-top: 3px solid var(--app-orange);
}

.dark-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 980px;
    font-size: 13px;
}

.dark-table th,
.dark-table td {
    padding: 12px 14px;
    text-align: left;
    border-bottom: 1px solid var(--app-border);
}

.dark-table thead th {
    background: var(--app-orange-light);
    color: var(--app-text-muted);
    font-weight: 600;
    font-size: 12px;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    border-bottom: 3px solid var(--app-orange);
}

.dark-table tbody tr:nth-child(odd) {
    background: var(--app-panel-bg);
}

.dark-table tbody tr:nth-child(even) {
    background: #fafbfc;
}

.dark-table tbody tr:hover {
    background: #f1f5f9;
}

.dark-table tbody tr:last-child td {
    border-bottom: none;
}

.dark-table td .btn {
    padding: 6px 12px;
    font-size: 12px;
}

.status-pill {
    display: inline-block;
    border-radius: 999px;
    padding: 3px 10px;
    font-size: 12px;
    font-weight: 600;
}

.status-blue {
    background: #dbeafe;
    color: #1d4ed8;
}

.status-violet {
    background: #ede9fe;
    color: #6d28d9;
}

.status-orange {
    background: #ffedd5;
    color: #c2410c;
}

/* ----- Armonizzazione pagine con classi Tailwind dark (manteniamo soft) ----- */
.panel [class*="bg-slate-"] {
    background: var(--app-panel-bg) !important;
    border-color: var(--app-border) !important;
}

.panel [class*="text-slate-"] {
    color: var(--app-text-muted) !important;
}

.panel [class*="text-sky-"],
.panel [class*="text-cyan-"],
.panel [class*="text-violet-"],
.panel [class*="text-amber-"] {
    color: var(--app-accent) !important;
}

.panel [class*="border-slate-"] {
    border-color: var(--app-border) !important;
}

/* ===== Login: sfondo bianco, cornice arancio ===== */
.login-page {
    background: #fff;
    min-height: 100vh;
}

.login-main {
    margin-left: auto;
    margin-right: auto;
    display: flex;
    min-height: 100vh;
    width: 100%;
    max-width: none;
    align-items: center;
    justify-content: center;
    padding: 0;
    box-sizing: border-box;
}

.login-shell {
    width: 100%;
    display: grid;
    grid-template-columns: 1fr 2fr;
    align-items: center;
    gap: 0;
    min-height: 100vh;
}

.login-page .login-panel {
    width: 100%;
    margin: 0;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(160deg, #0284c7 0%, #0369a1 45%, #075985 100%);
    border-radius: 0;
    padding: 1rem;
    grid-column: 1;
    grid-row: 1;
}

.login-form > * + * {
    margin-top: 1.25rem;
}

.login-panel {
    background: transparent;
    border: 0;
    border-radius: 0;
    padding: 0;
    box-shadow: none;
    color: var(--app-text);
}

.login-card {
    background: rgba(255, 255, 255, 0.96);
    border: 1px solid rgba(255, 255, 255, 0.7);
    border-radius: 14px;
    padding: 0.95rem 0.9rem;
    box-shadow: 0 10px 28px rgba(2, 6, 23, 0.16);
    width: 100%;
    max-width: 260px;
}

.login-select {
    width: 100%;
    height: 46px;
    border-radius: 12px;
    border: 1px solid var(--app-border);
    background: var(--app-panel-bg);
    color: var(--app-text);
    padding: 0 14px;
    font-size: 0.95rem;
}

.login-logo-wrap {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    margin-bottom: 0;
    opacity: 0.6;
    grid-column: 2;
    grid-row: 1;
}
.login-logo-box {
    width: min(30vw, 420px);
    height: min(32vw, 460px);
    background: transparent;
    border: 0;
    border-radius: 0;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 0.5rem;
    box-shadow: none;
}
.login-logo-sail,
.login-logo-box .app-logo-img {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: contain;
}
.login-logo-text {
    font-size: clamp(2rem, 4vw, 3.4rem);
    line-height: 1.1;
    font-weight: 700;
    letter-spacing: 0.02em;
    color: #0f172a;
    text-shadow: 0 2px 12px rgba(15, 23, 42, 0.22);
    margin: 0;
}
.login-logo-sub {
    margin-top: 0.25rem;
    font-size: 0.8rem;
    line-height: 1;
    color: #1e293b;
    font-weight: 600;
    margin: 0;
}

.login-title {
    font-size: 1.2rem;
    font-weight: 600;
    color: #0f172a;
    margin: 0 0 0.9rem 0;
}

.login-label {
    display: inline-block;
    margin-bottom: 0.5rem;
    font-size: 0.76rem;
    font-weight: 500;
    color: var(--app-heading);
}

.login-input {
    width: 100%;
    height: 38px;
    border-radius: 10px;
    border: 1px solid var(--app-border);
    background: var(--app-panel-bg);
    color: var(--app-text);
    padding: 0 14px;
    font-size: 0.88rem;
}

.login-input::placeholder {
    color: var(--app-text-soft);
}

.login-input:focus {
    outline: none;
    border-color: var(--app-orange);
    box-shadow: 0 0 0 2px rgba(234, 88, 12, 0.15);
}

.login-button {
    width: 100%;
    height: 40px;
    margin-top: 0.5rem;
    border-radius: 10px;
    border: 2px solid var(--app-orange-border);
    background: var(--app-orange);
    color: #fff;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s, border-color 0.2s;
}
.login-button:hover {
    background: var(--app-orange-border);
    border-color: var(--app-orange);
}

.login-error {
    margin-bottom: 1rem;
    padding: 0.75rem 1rem;
    border-radius: 10px;
    border: 1px solid #fecaca;
    background: #fef2f2;
    color: #b91c1c;
    font-size: 0.82rem;
}

@media (max-width: 991.98px) {
    .login-shell {
        grid-template-columns: 1fr;
        gap: 0.5rem;
        min-height: auto;
    }

    .login-page .login-panel {
        min-height: auto;
        max-width: 360px;
        margin-left: auto;
        margin-right: auto;
        border-radius: 18px;
        grid-column: auto;
        grid-row: auto;
    }

    .login-logo-wrap {
        min-height: 0;
        opacity: 0.72;
        margin-bottom: 0.35rem;
        grid-column: auto;
        grid-row: auto;
    }

    .login-logo-box {
        width: 140px;
        height: 140px;
    }
}

/* ===== Dashboard: griglia ordinata e linee di separazione ===== */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 12px;
    margin-bottom: 1.5rem;
}

.dashboard-card {
    display: block;
    background: var(--app-panel-bg);
    border-radius: 10px;
    padding: 0.32rem 0.72rem;
    border: 1px solid var(--app-border);
    text-decoration: none;
    color: inherit;
    transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
    position: relative;
    overflow: hidden;
}

.dashboard-card-link:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(15, 23, 42, 0.06);
    border-color: var(--app-border-strong);
}

/* Badge senza sfondo: solo testo in evidenza per migliore leggibilità */
.dashboard-badge {
    background: none !important;
    padding: 0 !important;
    font-size: 0.65rem !important;
    font-weight: 700 !important;
    margin-bottom: 0.05rem !important;
    line-height: 1.15;
    letter-spacing: 0.03em;
    -webkit-font-smoothing: antialiased;
    font-smoothing: antialiased;
}

.dashboard-card-value {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--app-heading);
    line-height: 1.05;
    -webkit-font-smoothing: antialiased;
    font-smoothing: antialiased;
    text-shadow: none;
    letter-spacing: -0.02em;
}

.dashboard-card-label {
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--app-text);
    margin-top: 0.06rem;
    line-height: 1.25;
    -webkit-font-smoothing: antialiased;
    font-smoothing: antialiased;
}

/* Produzione giornaliera: badge intestazione + griglia operatori */
.produzione-giornaliera-wrap {
    margin-top: 0;
    margin-bottom: 2rem;
    border: 2px solid var(--app-orange-soft);
    border-top: 4px solid var(--app-orange);
    border-radius: 12px;
    overflow: hidden;
    background: var(--app-panel-bg);
    box-shadow: 0 1px 3px rgba(234, 88, 12, 0.08);
}

.produzione-giornaliera-header-btn {
    display: block;
    width: 100%;
    padding: 0.75rem 1.25rem;
    background: var(--app-orange-light);
    border: none;
    border-bottom: 2px solid var(--app-orange-soft);
    cursor: pointer;
    text-align: left;
    font: inherit;
}

.produzione-giornaliera-header-btn:hover {
    background: #ffedd5;
}

.produzione-giornaliera-header-hint {
    display: block;
    font-size: 0.7rem;
    color: var(--app-text-muted);
    margin-top: 2px;
}

.produzione-giornaliera-badge {
    display: inline-block;
    font-size: 1rem;
    font-weight: 700;
    color: var(--app-orange);
    letter-spacing: 0.02em;
}

/* Griglia 4 o 5 colonne (tipo 4x6 o 5x8) */
.produzione-giornaliera-grid {
    display: grid;
    gap: 14px;
    padding: 1.25rem;
}

.produzione-giornaliera-grid-cols-4 {
    grid-template-columns: repeat(4, 1fr);
}

.produzione-giornaliera-grid-cols-5 {
    grid-template-columns: repeat(5, 1fr);
}

/* Anteprima a scorrimento: caratteri più piccoli (il modal mantiene dimensioni normali) */
.produzione-scroll-viewport .produzione-giornaliera-cell-name {
    font-size: 11px;
    margin-bottom: 2px;
}
.produzione-scroll-viewport .produzione-giornaliera-cell-nr {
    font-size: 12px;
}
.produzione-scroll-viewport .produzione-giornaliera-cell-tipo {
    font-size: 10px;
}
.produzione-scroll-viewport .produzione-trend {
    font-size: 1.1rem;
}
.produzione-scroll-viewport .produzione-giornaliera-cell {
    padding: 8px 10px;
}

/* Anteprima a scorrimento (simula produzione sulla griglia) */
.produzione-scroll-viewport {
    overflow: hidden;
    height: 220px;
    position: relative;
}

.produzione-scroll-track {
    display: flex;
    flex-direction: column;
    gap: 14px;
    animation: produzione-scroll-up 35s linear infinite;
}

.produzione-scroll-track:hover {
    animation-play-state: paused;
}

@keyframes produzione-scroll-up {
    0% { transform: translateY(0); }
    100% { transform: translateY(-50%); }
}

.produzione-scroll-grid-copy {
    flex-shrink: 0;
    padding: 0 1.25rem;
}

.produzione-scroll-grid-copy:first-child {
    padding-top: 1.25rem;
}

.produzione-scroll-grid-copy:last-child {
    padding-bottom: 1.25rem;
}

.produzione-giornaliera-cell {
    background: #fff;
    border: 1px solid var(--app-border);
    border-left: 4px solid var(--app-orange);
    border-radius: 10px;
    padding: 14px 16px;
    transition: box-shadow 0.2s ease, border-color 0.2s ease;
}

.produzione-giornaliera-cell:hover {
    box-shadow: 0 4px 12px rgba(234, 88, 12, 0.1);
    border-color: var(--app-orange-soft);
}

.produzione-giornaliera-cell-name {
    font-weight: 700;
    font-size: 14px;
    color: var(--app-heading);
    margin-bottom: 6px;
    line-height: 1.3;
}

.produzione-giornaliera-cell-nr-wrap {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 4px;
}

.produzione-giornaliera-cell-nr {
    font-size: 15px;
    font-weight: 600;
    color: var(--app-orange);
}

/* Frecce andamento vs giorno precedente (come img1) */
.produzione-trend {
    font-size: 1.5rem;
    font-weight: 700;
    line-height: 1;
}

.produzione-trend-up {
    color: #15803d;
}

.produzione-trend-down {
    color: #b91c1c;
}

.produzione-trend-stable {
    color: #2563eb;
}

.produzione-giornaliera-cell-tipo {
    font-size: 12px;
    color: var(--app-text-muted);
    line-height: 1.35;
    word-break: break-word;
}

.produzione-prodotto-item {
    display: block;
    margin-bottom: 2px;
}
.produzione-prodotto-item:last-child {
    margin-bottom: 0;
}

.produzione-giornaliera-empty {
    grid-column: 1 / -1;
    padding: 1.5rem;
    text-align: center;
    color: var(--app-text-muted);
    font-size: 14px;
}

/* Modal Produzione a tutta pagina */
.produzione-modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 10001;
    background: rgba(15, 23, 42, 0.85);
    display: none;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    overflow: auto;
}

.produzione-modal-overlay.is-open {
    display: flex;
}

.produzione-modal-inner {
    background: var(--app-panel-bg);
    border-radius: 12px;
    border: 2px solid var(--app-orange-soft);
    border-top: 4px solid var(--app-orange);
    width: 98vw;
    max-width: 98vw;
    height: 95vh;
    max-height: 95vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.produzione-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.5rem;
    background: var(--app-orange-light);
    border-bottom: 2px solid var(--app-orange-soft);
    flex-shrink: 0;
}

.produzione-modal-title {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--app-orange);
}

.produzione-modal-close {
    width: 36px;
    height: 36px;
    border: none;
    background: var(--app-orange-soft);
    color: var(--app-orange);
    font-size: 1.5rem;
    line-height: 1;
    cursor: pointer;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.produzione-modal-close:hover {
    background: var(--app-orange);
    color: #fff;
}

.produzione-modal-body {
    padding: 1.5rem;
    overflow: auto;
    flex: 1;
}

.produzione-modal-grid.produzione-giornaliera-grid-cols-4 {
    grid-template-columns: repeat(4, 1fr);
}

.produzione-modal-grid.produzione-giornaliera-grid-cols-5 {
    grid-template-columns: repeat(5, 1fr);
}

@media (max-width: 900px) {
    .produzione-giornaliera-grid-cols-4,
    .produzione-giornaliera-grid-cols-5 {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 500px) {
    .produzione-giornaliera-grid-cols-4,
    .produzione-giornaliera-grid-cols-5 {
        grid-template-columns: 1fr;
    }
}

/* Hero dashboard: sfondo bianco, cornice arancio (stessa logica altre pagine) */
.dash-hero {
    background: var(--app-panel-bg);
    border: 2px solid var(--app-orange-soft);
    border-radius: 12px;
    overflow: hidden;
    margin-bottom: 1.75rem;
    border-top: 4px solid var(--app-orange);
    box-shadow: 0 1px 3px rgba(234, 88, 12, 0.08);
}

.dash-hero-bg {
    display: none;
}

.dash-hero-content {
    padding: 1.25rem 1.5rem;
    background: var(--app-orange-light);
}

.dash-hero-title {
    color: var(--app-orange) !important;
}

.dash-hero-sub {
    color: var(--app-orange-border) !important;
}

/* Badge hero (img1): dati neri, cornici badge arancio – altezza aumentata */
.dash-badge {
    color: #0f172a !important;
    border: 2px solid var(--app-orange) !important;
    font-weight: 700;
    padding: 0.35rem 0.75rem !important;
    font-size: 0.8rem !important;
    line-height: 1.25;
}

.dash-badge-light {
    background: #fff !important;
}

.dash-badge-cyan {
    background: #e0f2fe !important;
}

.dash-badge-ok {
    background: #dcfce7 !important;
}

.dash-badge-mid {
    background: #fef9c3 !important;
}

.dash-badge-low {
    background: #fee2e2 !important;
}

/* Card Obiettivo mese (img2): sfondo arancio, carattere adeguato */
.dashboard-card-obiettivo {
    background: linear-gradient(135deg, var(--app-orange) 0%, var(--app-orange-border) 100%) !important;
    border-color: var(--app-orange-border) !important;
}

.dashboard-card-obiettivo::before {
    background: rgba(255,255,255,0.4) !important;
}

.dashboard-card-obiettivo .dashboard-card-value-light,
.dashboard-card-obiettivo .dashboard-card-label-light,
.dashboard-card-obiettivo .dashboard-obiettivo-pct,
.dashboard-card-obiettivo .dashboard-obiettivo-hint,
.dashboard-card-obiettivo .dashboard-obiettivo-kpi-pill {
    color: #fff !important;
}
.dashboard-card-obiettivo .dashboard-obiettivo-pct {
    font-size: 0.8rem;
    margin-top: 0.2rem;
    line-height: 1.2;
}
.dashboard-card-obiettivo .dashboard-obiettivo-hint {
    font-size: 0.75rem;
    opacity: 0.9;
    margin-top: 0.12rem;
    line-height: 1.25;
}

.dashboard-card-obiettivo .dashboard-badge-obiettivo {
    background: none !important;
    color: #fff !important;
    border: none !important;
}

.dashboard-card-obiettivo .dashboard-progress-wrap {
    margin-top: 0.25rem;
    background: rgba(0,0,0,0.2) !important;
}

.dashboard-card-obiettivo .dashboard-progress-bar {
    background: #fff !important;
}

/* Goals: linea di separazione dall’area sopra */
.dash-goals-row {
    display: flex;
    flex-wrap: wrap;
    gap: 1.5rem;
    align-items: flex-start;
}

.dash-goals-row .goals-panel {
    flex: 1;
    min-width: 320px;
}

.dash-goals-row .produzione-giornaliera-wrap {
    flex: 0 1 420px;
    margin-bottom: 0;
}

.goals-sidial-wrap {
    margin-top: 1.75rem;
    padding-top: 1.75rem;
    border-top: 2px solid var(--app-orange-soft);
}

/* Goals panel: cornice arancio */
.goals-panel {
    border: 1px solid var(--app-border);
    border-top: 3px solid var(--app-orange);
    border-radius: 12px;
}

.goals-header {
    border-bottom: 2px solid var(--app-orange-soft);
}

@media (max-width: 1024px) {
    .topbar-inner {
        flex-direction: column;
        align-items: flex-start;
    }

    .brand-title {
        font-size: 26px;
    }
}
