/* The panel ships no compiled Tailwind theme: custom markup uses Filament components, fi-* and nxt-* classes only. */

/* Detail pages: labels step back so values carry the reading order. */
.fi-body .fi-in-entry {
    row-gap: 0.25rem;
}

.fi-body .fi-in-entry .fi-in-entry-label {
    font-size: 0.75rem;
    line-height: 1rem;
    color: var(--gray-500);
}

.dark .fi-body .fi-in-entry .fi-in-entry-label {
    color: var(--gray-400);
}

/* Placeholders (missing values, input hints): Filament's gray-400 reads at 2.6:1 on white, gray-500 at 4.7:1. */
.fi-body ::placeholder,
.fi-body .fi-in-placeholder,
.fi-body .fi-ta-placeholder,
.fi-body .fi-select-input-placeholder {
    color: var(--gray-500);
}

.dark .fi-body ::placeholder,
.dark .fi-body .fi-in-placeholder,
.dark .fi-body .fi-ta-placeholder,
.dark .fi-body .fi-select-input-placeholder {
    color: var(--gray-400);
}

/* Long texts read at a measure; TextEntry::multiline() keeps their line breaks. */
.nxt-multiline {
    max-width: 75ch;
}

/* Filament's precompiled CSS has no font-mono utility; code fields rely on it. */
.fi-body .font-mono {
    font-family: var(--font-mono);
    font-size: 0.8125rem;
}

/* Role matrix: children indented under their parent module (--nxt-depth set per row). */
.nxt-matrix-row {
    padding-inline-start: calc(var(--nxt-depth, 0) * 1.75rem);
}

/* Home: module tiles (resources/views/filament/widgets/module-tiles.blade.php), one section per navigation group. */
.nxt-module-tiles {
    display: grid;
    gap: 1.5rem;
}

.nxt-tiles-heading {
    margin-bottom: 0.75rem;
    font-size: 0.875rem;
    line-height: 1.25rem;
    font-weight: 600;
    color: var(--gray-500);
}

.dark .nxt-tiles-heading {
    color: var(--gray-400);
}

.nxt-tiles {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 14rem), 1fr));
    gap: 0.75rem;
}

.nxt-tile {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    min-height: 4rem;
    padding: 0.75rem 1rem;
    border-radius: 0.75rem;
    background-color: #FFFFFF;
    box-shadow: 0 1px 2px 0 rgb(0 0 0 / 0.05), 0 0 0 1px color-mix(in oklab, var(--gray-950) 5%, transparent);
    color: var(--gray-950);
    font-size: 0.875rem;
    line-height: 1.25rem;
    font-weight: 500;
    transition: box-shadow 150ms ease-out;
}

.nxt-tile:hover {
    box-shadow: 0 1px 2px 0 rgb(0 0 0 / 0.05), 0 0 0 1px var(--primary-600);
}

.nxt-tile:focus-visible {
    outline: 2px solid var(--primary-600);
    outline-offset: 2px;
}

.dark .nxt-tile {
    background-color: var(--gray-900);
    box-shadow: 0 0 0 1px rgb(255 255 255 / 0.1);
    color: #FFFFFF;
}

.dark .nxt-tile:hover {
    box-shadow: 0 0 0 1px var(--primary-400);
}

.dark .nxt-tile:focus-visible {
    outline-color: var(--primary-400);
}

.nxt-tile-icon {
    flex-shrink: 0;
    box-sizing: content-box;
    padding: 0.5rem;
    border-radius: 0.5rem;
    background-color: var(--primary-50);
    color: var(--primary-600);
}

.dark .nxt-tile-icon {
    background-color: color-mix(in oklab, var(--primary-400) 10%, transparent);
    color: var(--primary-400);
}

.nxt-tile-label {
    flex: 1;
    min-width: 0;
}

/* Panel footer (resources/views/filament/footer.blade.php). */
.nxt-footer {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
    padding: 1.5rem 1rem;
    font-size: 0.75rem;
    line-height: 1rem;
    color: var(--gray-500);
}

.dark .nxt-footer {
    color: var(--gray-400);
}

.nxt-footer-link:hover,
.nxt-footer-link:focus-visible {
    color: var(--primary-600);
    text-decoration: underline;
}

.dark .nxt-footer-link:hover,
.dark .nxt-footer-link:focus-visible {
    color: var(--primary-400);
}

/* "Novità" page: CHANGELOG.md rendered as HTML. */
.nxt-changelog {
    max-width: 75ch;
    font-size: 0.875rem;
    line-height: 1.5rem;
    color: var(--gray-700);
}

.dark .nxt-changelog {
    color: var(--gray-300);
}

.nxt-changelog h2 {
    margin-top: 2rem;
    font-size: 1.125rem;
    line-height: 1.75rem;
    font-weight: 600;
    color: var(--gray-950);
}

.nxt-changelog h2:first-of-type {
    margin-top: 1rem;
}

.nxt-changelog h3 {
    margin-top: 1rem;
    font-weight: 600;
    color: var(--gray-950);
}

.dark .nxt-changelog h2,
.dark .nxt-changelog h3 {
    color: #FFFFFF;
}

.nxt-changelog ul {
    margin-top: 0.25rem;
    padding-inline-start: 1.25rem;
    list-style: disc;
}

.nxt-changelog li + li {
    margin-top: 0.25rem;
}

.nxt-changelog a {
    color: var(--primary-600);
    text-decoration: underline;
}

.dark .nxt-changelog a {
    color: var(--primary-400);
}

/* Bulk send preview: the WhatsApp text exactly as sent, line breaks included. */
.nxt-wa-preview {
    max-width: 60ch;
    padding: 0.75rem 1rem;
    border-radius: 0.75rem;
    background-color: var(--gray-50);
    border: 1px solid var(--gray-200);
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    font-size: 0.875rem;
    line-height: 1.5;
}

.dark .nxt-wa-preview {
    background-color: var(--gray-900);
    border-color: var(--gray-700);
}

/* Message text outside the editor: merge tags by label (MessageTemplate::withVisiblePlaceholders). */
.nxt-merge-tag {
    white-space: nowrap;
    color: var(--primary-600);
}

.dark .nxt-merge-tag {
    color: var(--primary-400);
}

/* Login page: other ways to sign in under the password form. */
.nxt-login-alternatives {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
}

.nxt-login-alternatives .fi-btn {
    width: 100%;
}

.nxt-login-divider {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    width: 100%;
    font-size: 0.875rem;
    color: var(--gray-500);
}

.nxt-login-divider::before,
.nxt-login-divider::after {
    content: "";
    flex: 1;
    border-top: 1px solid var(--gray-200);
}

.dark .nxt-login-divider::before,
.dark .nxt-login-divider::after {
    border-top-color: var(--gray-700);
}

.nxt-microsoft-label {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

/* Global search groups are lower-case plural labels: capitalise the first word only ("Liste di distribuzione"). */
.fi-global-search-result-group-header {
    text-transform: none;
}

.fi-global-search-result-group-header::first-letter {
    text-transform: uppercase;
}

/* Record locked elsewhere (LocksRecord): warning shown as the edit page subheading. */
.nxt-lock-notice {
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    border-radius: 0.75rem;
    background-color: var(--warning-50);
    box-shadow: 0 0 0 1px var(--warning-200);
    color: var(--warning-800);
    font-size: 0.875rem;
    line-height: 1.25rem;
    font-weight: 500;
}

.nxt-lock-notice-icon {
    flex-shrink: 0;
    color: var(--warning-600);
}

.dark .nxt-lock-notice {
    background-color: color-mix(in oklab, var(--warning-400) 10%, transparent);
    box-shadow: 0 0 0 1px color-mix(in oklab, var(--warning-400) 25%, transparent);
    color: var(--warning-300);
}

.dark .nxt-lock-notice-icon {
    color: var(--warning-400);
}

/* File viewer («Apri»): the file fits the modal; PDFs and text get a tall frame. */
.nxt-file-viewer {
    display: grid;
    justify-items: start;
    gap: 0.75rem;
}

.nxt-file-viewer img,
.nxt-file-viewer video {
    justify-self: center;
    max-width: 100%;
    max-height: 75vh;
}

.nxt-file-viewer audio,
.nxt-file-viewer iframe {
    width: 100%;
}

.nxt-file-viewer iframe {
    height: 75vh;
    border: 1px solid var(--gray-200);
    border-radius: 0.5rem;
    background-color: #fff;
}

.dark .nxt-file-viewer iframe {
    border-color: var(--gray-700);
}

/* Hover preview of an image thumbnail in the file tables. */
.nxt-file-preview {
    display: block;
    max-width: 18rem;
    max-height: 18rem;
}

/* Form components for the apps (app/Filament/Forms/Components, scripts in public/js/fields). */
.nxt-signature,
.nxt-camera,
.nxt-location,
.nxt-scanner {
    display: grid;
    gap: 0.75rem;
}

.nxt-field-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
}

.nxt-field-toolbar-grow {
    flex: 1 1 12rem;
    min-width: 0;
}

.nxt-field-hint,
.nxt-field-error {
    font-size: 0.875rem;
    line-height: 1.25rem;
    color: var(--gray-500);
}

.nxt-field-error {
    color: var(--danger-600);
}

.dark .nxt-field-hint {
    color: var(--gray-400);
}

.dark .nxt-field-error {
    color: var(--danger-400);
}

/* Ink is drawn on white paper in both themes; the PNG keeps the configured background. */
.nxt-signature-canvas {
    width: 100%;
    max-width: 36rem;
    height: 12rem;
    border-radius: 0.5rem;
    background-color: #FFFFFF;
    box-shadow: 0 0 0 1px var(--gray-300);
    touch-action: none;
    cursor: crosshair;
}

.dark .nxt-signature-canvas {
    box-shadow: 0 0 0 1px var(--gray-600);
}

.nxt-camera-media {
    width: 100%;
    max-width: 36rem;
    max-height: 24rem;
    border-radius: 0.5rem;
    object-fit: contain;
    background-color: var(--gray-950);
}

/* MapLibre controls carry their own z-index: keep them below the topbar, dropdowns and modals. */
.nxt-location-map {
    position: relative;
    z-index: 0;
    isolation: isolate;
    height: 20rem;
    border-radius: 0.5rem;
    box-shadow: 0 0 0 1px var(--gray-300);
}

.dark .nxt-location-map {
    box-shadow: 0 0 0 1px var(--gray-600);
}

/* Inline, the SVG would sit on the text baseline and lift the pin's tip off the point. */
.nxt-location-pin svg {
    display: block;
}

.nxt-rating {
    display: flex;
    gap: 0.25rem;
}

.nxt-rating-star {
    position: relative;
    display: inline-flex;
    cursor: pointer;
    color: var(--gray-300);
}

.nxt-rating-star svg {
    width: 1.75rem;
    height: 1.75rem;
    fill: currentColor;
}

.nxt-rating-star input {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
}

.nxt-rating-star:has(input:focus-visible) {
    border-radius: 0.25rem;
    outline: 2px solid var(--primary-600);
    outline-offset: 2px;
}

.nxt-rating-star-on {
    color: var(--warning-500);
}

.dark .nxt-rating-star {
    color: var(--gray-600);
}

.dark .nxt-rating-star-on {
    color: var(--warning-400);
}

.nxt-rating-disabled .nxt-rating-star {
    cursor: default;
}

/* BarcodeColumn / BarcodeEntry: dark modules on white, scaled down to the available width. */
.nxt-barcode svg,
.nxt-qr-code svg {
    display: block;
    max-width: 100%;
    height: auto;
}

.nxt-qr-code svg {
    width: 8rem;
}

.fi-ta .nxt-qr-code svg {
    width: 4rem;
}

/* Previous / next record on view and edit pages (resources/views/filament/record-navigation.blade.php). */
.nxt-record-nav {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

/* A record outside the list: the empty navigation stays in the page only so later renders keep it empty. */
.nxt-record-nav:not(:has(*)) {
    display: none;
}

/* Resizable table columns (public/js/nxt-grid.js): the right edge of each header is the drag handle. */
.fi-ta-header-cell[data-nxt-column] {
    position: relative;
}

.fi-ta-header-cell[data-nxt-column]::after {
    content: "";
    position: absolute;
    inset-block: 0;
    right: 0;
    width: 6px;
    cursor: col-resize;
}

.fi-ta-header-cell[data-nxt-column]:hover::after {
    background-color: var(--gray-200);
}

.dark .fi-ta-header-cell[data-nxt-column]:hover::after {
    background-color: var(--gray-700);
}

/* A dragged width: table cells ignore max-width, so their content is narrowed instead. */
.nxt-col-sized {
    width: var(--nxt-col-width);
    min-width: var(--nxt-col-width);
    max-width: var(--nxt-col-width);
    overflow: hidden;
}

.nxt-col-sized > * {
    max-width: var(--nxt-col-width);
    overflow: hidden;
    text-overflow: ellipsis;
}

.nxt-col-resizing,
.nxt-col-resizing * {
    cursor: col-resize !important;
    user-select: none;
}

/* Masterdata bulk insert grid (resources/views/filament/masterdata/bulk-grid.blade.php, public/js/nxt-bulk-grid.js). */
.nxt-bulk-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem 1.5rem;
}

.nxt-bulk-hint,
.nxt-bulk-note {
    font-size: 0.875rem;
    line-height: 1.25rem;
    color: var(--gray-500);
}

.nxt-bulk-note {
    display: block;
    font-size: 0.75rem;
    font-weight: 400;
}

.nxt-bulk-option {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
}

.nxt-bulk {
    display: grid;
    gap: 0.75rem;
}

.nxt-bulk-errors {
    padding: 0.5rem 0.75rem;
    border-radius: 0.5rem;
    font-size: 0.875rem;
    background-color: var(--danger-50);
    color: var(--danger-700);
}

.nxt-bulk-scroll {
    overflow: auto;
    max-height: 70vh;
    border-radius: 0.75rem;
    background-color: white;
    box-shadow: 0 1px 2px 0 rgb(0 0 0 / 0.05), 0 0 0 1px color-mix(in oklab, var(--gray-950) 5%, transparent);
}

.nxt-bulk-table {
    width: max-content;
    min-width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
}

.nxt-bulk-table th,
.nxt-bulk-table td {
    position: relative;
    padding: 0;
    border: 1px solid var(--gray-200);
    text-align: start;
}

.nxt-bulk-table thead th {
    position: sticky;
    top: 0;
    z-index: 1;
    min-width: 11rem;
    padding: 0.5rem 0.625rem;
    font-weight: 600;
    background-color: var(--gray-50);
}

.nxt-bulk-table thead th.nxt-bulk-kind-boolean {
    min-width: 6rem;
}

.nxt-bulk-table thead th.nxt-bulk-kind-date,
.nxt-bulk-table thead th.nxt-bulk-kind-integer,
.nxt-bulk-table thead th.nxt-bulk-kind-number {
    min-width: 8.5rem;
}

.nxt-bulk-heading {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.nxt-bulk-required {
    color: var(--danger-600);
    text-decoration: none;
}

.nxt-bulk-fill,
.nxt-bulk-remove {
    display: inline-flex;
    margin-inline-start: auto;
    padding: 0.125rem;
    border-radius: 0.375rem;
    color: var(--gray-400);
}

.nxt-bulk-fill:hover,
.nxt-bulk-remove:hover {
    color: var(--primary-600);
    background-color: var(--gray-100);
}

.nxt-bulk-fill .fi-icon,
.nxt-bulk-remove .fi-icon {
    width: 1rem;
    height: 1rem;
}

.nxt-bulk-table .nxt-bulk-number {
    min-width: 3rem;
    padding: 0 0.5rem;
    text-align: end;
    font-weight: 400;
    font-variant-numeric: tabular-nums;
    color: var(--gray-500);
    background-color: var(--gray-50);
}

.nxt-bulk-input {
    display: block;
    width: 100%;
    min-height: 2.25rem;
    padding: 0.375rem 0.625rem;
    border: 0;
    background: transparent;
    font-size: 0.875rem;
    color: inherit;
}

.nxt-bulk-input:focus {
    outline: none;
}

.nxt-bulk-check {
    margin: 0.625rem;
}

.nxt-bulk-active {
    outline: 2px solid var(--primary-600);
    outline-offset: -2px;
}

.nxt-bulk-dragged {
    background-color: var(--primary-50);
}

.nxt-bulk-dragging,
.nxt-bulk-dragging * {
    cursor: crosshair;
    user-select: none;
}

/* Fill handle: the bottom-right corner of the active cell, as in a spreadsheet. */
.nxt-bulk-handle {
    position: absolute;
    right: -4px;
    bottom: -4px;
    z-index: 2;
    width: 8px;
    height: 8px;
    border: 1px solid white;
    background-color: var(--primary-600);
    cursor: crosshair;
    touch-action: none;
}

.nxt-bulk-row-error .nxt-bulk-number {
    font-weight: 600;
    color: var(--danger-700);
    background-color: var(--danger-50);
}

.nxt-bulk-actions {
    min-width: 2.5rem;
    padding: 0 0.375rem;
}

.nxt-bulk-table td.nxt-bulk-actions {
    white-space: nowrap;
}

.nxt-bulk-table td.nxt-bulk-actions > * {
    vertical-align: middle;
}

.nxt-bulk-error {
    margin-inline-end: 0.5rem;
    font-size: 0.75rem;
    color: var(--danger-700);
}

.dark .nxt-bulk-hint,
.dark .nxt-bulk-note,
.dark .nxt-bulk-table .nxt-bulk-number {
    color: var(--gray-400);
}

.dark .nxt-bulk-errors {
    background-color: color-mix(in oklab, var(--danger-400) 10%, transparent);
    color: var(--danger-400);
}

.dark .nxt-bulk-scroll {
    background-color: var(--gray-900);
    box-shadow: 0 0 0 1px color-mix(in oklab, white 10%, transparent);
}

.dark .nxt-bulk-table th,
.dark .nxt-bulk-table td {
    border-color: var(--gray-700);
}

.dark .nxt-bulk-table thead th,
.dark .nxt-bulk-table .nxt-bulk-number {
    background-color: var(--gray-800);
}

.dark .nxt-bulk-input option {
    background-color: var(--gray-900);
}

.dark .nxt-bulk-active {
    outline-color: var(--primary-400);
}

.dark .nxt-bulk-dragged {
    background-color: color-mix(in oklab, var(--primary-400) 15%, transparent);
}

.dark .nxt-bulk-fill:hover,
.dark .nxt-bulk-remove:hover {
    color: var(--primary-400);
    background-color: var(--gray-800);
}

.dark .nxt-bulk-row-error .nxt-bulk-number,
.dark .nxt-bulk-error {
    color: var(--danger-400);
}

.dark .nxt-bulk-row-error .nxt-bulk-number {
    background-color: color-mix(in oklab, var(--danger-400) 10%, transparent);
}
