/* ── Simply — Edit mode border ────────────────────────────────────
   Tre approcci sovrapposti per garantire visibilità su qualsiasi
   layout Filament:
   1. body::after pseudo-element (originale, può essere coperto)
   2. Outline CSS sul body (più affidabile, non coperto da overlay)
   3. Box-shadow inset sul .fi-main (target del contenuto principale)
   ──────────────────────────────────────────────────────────────── */
body.simply-edit-mode::after {
    content: '';
    position: fixed;
    inset: 0;
    border: 3px solid #f97316;
    pointer-events: none;
    z-index: 99999;
    border-radius: 0;
}
/* Banner edit mode in alto a destra come ulteriore feedback visivo */
body.simply-edit-mode::before {
    content: '✏ MODIFICA ATTIVA';
    position: fixed;
    top: 10px;
    right: 10px;
    background: #f97316;
    color: white;
    font-family: system-ui, -apple-system, sans-serif;
    font-size: 11px;
    font-weight: 700;
    padding: 4px 12px;
    border-radius: 4px;
    z-index: 99999;
    pointer-events: none;
    box-shadow: 0 2px 8px rgba(249,115,22,.4);
    letter-spacing: .04em;
}

/* Simply — Compact table rows */
.fi-ta-row .fi-ta-cell {
    padding-top: 0.15rem !important;
    padding-bottom: 0.15rem !important;
    font-size: 0.75rem !important;
    line-height: 1rem !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
}
.fi-ta-row .fi-ta-cell > div,
.fi-ta-row .fi-ta-cell > span,
.fi-ta-row .fi-ta-cell > a {
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
}
.fi-ta-row .fi-ta-cell:nth-child(3) {
    max-width: 250px !important;
}
.fi-ta-header-cell {
    padding-top: 0.35rem !important;
    padding-bottom: 0.35rem !important;
    font-size: 0.72rem !important;
}
.fi-ta-row .fi-badge {
    padding: 0 0.3rem !important;
    font-size: 0.65rem !important;
    line-height: 1.2rem !important;
}
.fi-ta-row .fi-ta-cell svg {
    width: 0.9rem !important;
    height: 0.9rem !important;
}

/* Simply — Active row highlight (keyboard nav + sidebar) */
tr.fi-ta-row.simply-row-active > td {
    background: rgb(var(--primary-50)) !important;
}
.dark tr.fi-ta-row.simply-row-active > td {
    background: rgba(var(--primary-900), .35) !important;
}

/* ── DROP_583 — azioni Filament dentro le toolbar custom dei documenti ──
   Un'azione Filament (Invia, Crea spedizione) messa in mezzo ai pulsanti
   `.sdoc-btn` arrivava piu' ALTA e "spessa" dei vicini, rompendo la linea
   della barra (segnalato da Raffaele). Qui le si riporta esattamente alle
   misure di .sdoc-btn: stesso padding, font, raggio e altezza. */
.sdoc-invia-documento .fi-btn,
.sdoc-crea-spedizione .fi-btn {
    padding: 5px 12px !important;
    font-size: 0.75rem !important;
    font-weight: 500 !important;
    border-radius: 7px !important;
    min-height: 0 !important;
    line-height: 1.2 !important;
    gap: 5px !important;
}
.sdoc-invia-documento .fi-btn .fi-btn-icon,
.sdoc-crea-spedizione .fi-btn .fi-btn-icon {
    width: 13px !important;
    height: 13px !important;
}
/* il wrapper non deve aggiungere altezza propria */
.sdoc-invia-documento,
.sdoc-crea-spedizione {
    display: inline-flex;
    align-items: center;
}

/* ── REGISTRO #873 — the read-only banner of the document pages (partial avviso-sola-lettura).
   On a phone: one short line instead of the long sentence. ── */
.sp-sola-lettura {
    background: #fef3c7; border-bottom: 1px solid #fde68a; color: #92400e;
    padding: 5px 16px; font-size: .72rem; line-height: 1.35;
    display: flex; align-items: center; gap: 8px; flex-shrink: 0;
}
.sp-sola-lettura > svg { width: 12px; flex-shrink: 0; }
.sp-sola-lettura kbd { font-family: inherit; font-size: .68rem; padding: 0 4px; border: 1px solid #fcd34d; border-radius: 3px; background: #fffbeb; }
.sp-sola-lettura-breve { display: none; }
.dark .sp-sola-lettura { background: #451a03; border-color: #78350f; color: #fde68a; }
@media (max-width: 640px) {
    .sp-sola-lettura { padding: 3px 12px; font-size: .7rem; }
    .sp-sola-lettura-esteso { display: none; }
    .sp-sola-lettura-breve { display: inline; }
}

/* ── REGISTRO #873 — an amount never breaks between «€» and its digits: the totals of documents
   and orders go to a new line whole, as a pair label + amount. ── */
.sdoc-total-value, .wo-sdoc-total-value { white-space: nowrap; }
.sdoc-totals, .wo-sdoc-totals { flex-wrap: wrap; row-gap: 8px; }

/* ── REGISTRO #879 — the chip «ⓘ N» of the header notes and its list (partial avvisi-in-testata).
   Same height as the header badges; the list sits over the page, inside the screen. ── */
.sp-avvisi { display: inline-flex; align-items: center; }
.sp-avvisi-chip {
    display: inline-flex; align-items: center; gap: 4px; min-height: 26px;
    padding: 3px 10px; border-radius: 12px; cursor: pointer;
    font-size: .72rem; font-weight: 600; white-space: nowrap;
    background: #eff6ff; color: #1d4ed8; border: 1px solid #bfdbfe;
}
.sp-avvisi-chip[aria-expanded="true"] { background: #dbeafe; }
.dark .sp-avvisi-chip { background: #1e3a8a33; color: #93c5fd; border-color: #1e40af; }
.sp-avvisi-elenco {
    position: fixed; z-index: 60; display: flex; flex-direction: column; gap: 6px;
    padding: 10px; border-radius: 10px; background: #fff; border: 1px solid #e5e7eb;
    box-shadow: 0 10px 25px rgba(15, 23, 42, .15); max-height: 60vh; overflow-y: auto;
}
.dark .sp-avvisi-elenco { background: #111827; border-color: #374151; }
/* each note keeps its markup; in the list it may wrap and loses the side margin it had in the bar */
.sp-avvisi-voce > * { margin-left: 0 !important; white-space: normal !important; max-width: 100%; font-size: .72rem !important; }
/* in the list the hover text is written under the note: on a phone there is no hover */
.sp-avvisi-voce > [title] { flex-wrap: wrap; }
.sp-avvisi-voce > [title]::after {
    content: attr(title); flex-basis: 100%; display: block; margin-top: 3px;
    font-size: .68rem; font-weight: 400; line-height: 1.35; opacity: .85;
}
