:root {
    --md-sys-color-primary: #007be0;
    --md-sys-color-on-primary: #ffffff;
    --md-sys-color-primary-container: #d6ebff;
    --md-sys-color-on-primary-container: #003258;
    --md-sys-color-secondary: #111111;
    --md-sys-color-on-secondary: #ffffff;
    --md-sys-color-secondary-container: #e8e8e8;
    --md-sys-color-on-secondary-container: #1a1a1a;
    --md-sys-color-error: #b3261e;
    --md-sys-color-on-error: #ffffff;
    --md-sys-color-error-container: #f9dedc;
    --md-sys-color-surface: #ffffff;
    --md-sys-color-surface-dim: #f4f6f8;
    --md-sys-color-surface-container: #f7f9fb;
    --md-sys-color-surface-container-high: #eef2f6;
    --md-sys-color-on-surface: #000000;
    --md-sys-color-on-surface-variant: #5a6570;
    --md-sys-color-outline: #c5ced6;
    --md-sys-color-outline-variant: #e3e8ed;
    --md-sys-color-cancel: #6b7280;
    --md-sys-color-success: #0f7b3f;
    --md-sys-color-warn: #9a6700;

    --md-sys-shape-corner-xs: 6px;
    --md-sys-shape-corner-sm: 10px;
    --md-sys-shape-corner-md: 16px;
    --md-sys-shape-corner-lg: 24px;
    --md-sys-shape-corner-full: 999px;

    --md-sys-elevation-1: 0 1px 2px rgba(0, 0, 0, 0.06), 0 1px 3px rgba(0, 0, 0, 0.08);
    --md-sys-elevation-2: 0 4px 16px rgba(0, 0, 0, 0.08);

    --app-nav-width: 220px;
    --app-nav-width-collapsed: 72px;
    --app-font: "Figtree", "Segoe UI", sans-serif;
    --app-topbar-height: 4.25rem;
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

/* Fallback se lo style inline in head non basta */
[v-cloak] {
    display: none !important;
}

html {
    font-size: 15px; /* −1px rispetto al default browser (16px): scala tutti i rem */
}

html,
body {
    margin: 0;
    min-height: 100%;
    font-family: var(--app-font);
    color: var(--md-sys-color-on-surface);
    background:
        radial-gradient(circle at top left, rgba(0, 123, 224, 0.08), transparent 34%),
        linear-gradient(180deg, #f8fafc 0%, #ffffff 48%, #f5f7fa 100%);
}

a {
    color: inherit;
    text-decoration: none;
}

button,
input,
select {
    font: inherit;
}

h1,
h2,
h3,
p {
    margin: 0;
}

.material-symbols-outlined {
    font-variation-settings: "FILL" 0, "wght" 400, "GRAD" 0, "opsz" 24;
    line-height: 1;
}

/* ── Buttons ─────────────────────────────────────────────── */

.md-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    min-height: 44px;
    padding: 0 1.15rem;
    border: 0;
    border-radius: var(--md-sys-shape-corner-full);
    cursor: pointer;
    font-weight: 600;
    letter-spacing: 0.01em;
    transition: box-shadow 0.15s ease, background 0.15s ease, opacity 0.15s ease, color 0.15s ease;
}

.md-btn:hover {
    filter: brightness(0.96);
}

.md-btn:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

.md-btn--block {
    width: 100%;
}

.md-btn--filled.md-btn--primary {
    background: var(--md-sys-color-primary);
    color: var(--md-sys-color-on-primary);
    box-shadow: var(--md-sys-elevation-1);
}

.md-btn--filled.md-btn--black {
    background: var(--md-sys-color-secondary);
    color: var(--md-sys-color-on-secondary);
}

.md-btn--tonal {
    background: var(--md-sys-color-primary-container);
    color: var(--md-sys-color-on-primary-container);
}

.md-btn--text {
    background: transparent;
    color: var(--md-sys-color-on-surface);
}

.md-btn--text.md-btn--blue {
    color: var(--md-sys-color-primary);
}

.md-btn--text.md-btn--cancel {
    color: var(--md-sys-color-cancel);
}

.md-btn--danger {
    background: var(--md-sys-color-error);
    color: var(--md-sys-color-on-error);
}

.md-icon-btn {
    width: 44px;
    height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 0;
    border-radius: var(--md-sys-shape-corner-full);
    background: transparent;
    cursor: pointer;
    color: inherit;
    transition: background 0.15s ease, color 0.15s ease;
}

.md-icon-btn--ghost:hover {
    background: rgba(0, 0, 0, 0.05);
}

.md-icon-btn--primary {
    color: var(--md-sys-color-primary);
}

.md-icon-btn--primary:hover {
    background: rgba(0, 123, 224, 0.1);
}

.md-icon-btn--danger {
    color: var(--md-sys-color-error);
}

.md-icon-btn--danger:hover {
    background: rgba(179, 38, 30, 0.1);
}

/* ── Surfaces / fields ───────────────────────────────────── */

.md-surface {
    background: var(--md-sys-color-surface);
    border: 1px solid var(--md-sys-color-outline-variant);
    border-radius: var(--md-sys-shape-corner-md);
    box-shadow: var(--md-sys-elevation-1);
}

.md-field {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.md-field > label,
.md-field > span {
    font-size: 0.75rem;
    font-weight: 500;
    letter-spacing: 0.01em;
    line-height: 1.2;
    color: var(--md-sys-color-on-surface-variant);
}

.md-field input,
.md-field select {
    min-height: 44px;
    padding: 0 0.9rem;
    border: 1px solid var(--md-sys-color-outline);
    border-radius: var(--md-sys-shape-corner-sm);
    background: #fff;
}

.md-field input:focus,
.md-field select:focus {
    outline: 2px solid rgba(0, 123, 224, 0.28);
    border-color: var(--md-sys-color-primary);
}

.md-switch {
    display: inline-flex;
    align-items: center;
    gap: 0.65rem;
    font-weight: 500;
}

.md-chip,
.md-badge {
    display: inline-flex;
    align-items: center;
    min-height: 28px;
    padding: 0 0.7rem;
    border-radius: var(--md-sys-shape-corner-full);
    font-size: 0.75rem;
    font-weight: 600;
}

.md-chip {
    background: var(--md-sys-color-surface-container-high);
}

.md-chip--accent {
    background: rgba(0, 123, 224, 0.12);
    color: var(--md-sys-color-primary);
}

.md-badge--success {
    background: rgba(15, 123, 63, 0.12);
    color: var(--md-sys-color-success);
}

.md-badge--danger {
    background: rgba(179, 38, 30, 0.12);
    color: var(--md-sys-color-error);
}

.md-badge--warn {
    background: #fff4d6;
    color: var(--md-sys-color-warn);
}

.md-alert {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 0.65rem 0.75rem 1rem;
    border-radius: var(--md-sys-shape-corner-sm);
    margin-bottom: 1rem;
}

.md-alert > .material-symbols-outlined:first-child {
    flex: 0 0 auto;
}

.md-alert__text {
    flex: 1 1 auto;
    min-width: 0;
    line-height: 1.4;
}

.md-alert__dismiss {
    flex: 0 0 auto;
    width: 36px;
    height: 36px;
    margin-left: auto;
    color: inherit;
    opacity: 0.72;
}

.md-alert__dismiss:hover {
    opacity: 1;
    background: rgba(0, 0, 0, 0.06);
}

.md-alert--error {
    background: var(--md-sys-color-error-container);
    color: #6f1d18;
}

.md-alert--success {
    background: #e5f7ec;
    color: var(--md-sys-color-success);
}

.md-alert--info {
    background: var(--md-sys-color-primary-container);
    color: var(--md-sys-color-on-primary-container);
}

.md-alert--warning {
    background: #fff4e5;
    color: #7a4b00;
}

.md-table {
    width: 100%;
    border-collapse: collapse;
}

.md-table th,
.md-table td {
    padding: 0.95rem 1rem;
    text-align: left;
    border-bottom: 1px solid var(--md-sys-color-outline-variant);
    vertical-align: middle;
}

.md-table th {
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--md-sys-color-on-surface-variant);
}

.td-actions,
.md-table__actions {
    width: 1%;
    text-align: right;
    white-space: nowrap;
}

.td-actions .md-icon-btn,
.md-table__actions .md-icon-btn {
    width: 40px;
    height: 40px;
}

/* ── MD3 alert dialog + snackbar (sostituiscono confirm/alert nativi) ─ */

.md-dialog-scrim {
    position: fixed;
    inset: 0;
    z-index: 80;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.25rem;
    background: rgba(7, 16, 24, 0.48);
    animation: fade-in 0.16s ease;
}

.nested-editor-dialog-scrim {
    position: fixed;
    inset: 0;
    z-index: 70;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.25rem;
    background: rgba(7, 16, 24, 0.48);
    animation: fade-in 0.16s ease;
}

.nested-editor-dialog {
    display: flex;
    flex-direction: column;
    width: min(1180px, calc(100vw - 2rem));
    max-height: min(90vh, calc(100vh - 2rem));
    margin: auto;
    overflow: hidden;
    border-radius: 1.5rem;
    background: #fff;
    box-shadow: 0 20px 56px rgba(7, 16, 24, 0.24);
    animation: md-dialog-in 0.18s ease;
}

.nested-editor-dialog__header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    padding: 1.15rem 1.25rem 1rem;
    border-bottom: 1px solid var(--md-sys-color-outline-variant);
}

.nested-editor-dialog__heading {
    display: flex;
    align-items: flex-start;
    gap: 0.85rem;
}

.nested-editor-dialog__icon {
    display: grid;
    place-items: center;
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 50%;
    background: rgba(0, 123, 224, 0.12);
    color: var(--md-sys-color-primary);
}

.nested-editor-dialog__heading h2 {
    margin: 0;
    font-size: 1.15rem;
}

.nested-editor-dialog__heading p {
    margin: 0.2rem 0 0;
    color: var(--md-sys-color-on-surface-variant);
    font-size: 0.9rem;
}

.nested-editor-dialog__body {
    flex: 1 1 auto;
    overflow: auto;
    padding: 1rem 1.25rem;
}

.nested-editor-dialog__footer {
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
    padding: 0.85rem 1.25rem 1.1rem;
    border-top: 1px solid var(--md-sys-color-outline-variant);
}

.stock-rule-field__card {
    display: flex;
    flex-direction: column;
    gap: 0.9rem;
    padding: 1.15rem 1.25rem;
    border: 1px solid var(--md-sys-color-outline-variant);
    border-radius: var(--md-sys-shape-corner-md);
    background: var(--md-sys-color-surface-container);
}

.stock-rule-field__card--empty {
    background: var(--md-sys-color-surface);
    border-style: dashed;
}

.stock-rule-field__card-head {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.85rem 1rem;
}

.stock-rule-field__card-title {
    display: flex;
    align-items: flex-start;
    gap: 0.85rem;
    min-width: 0;
    flex: 1 1 16rem;
}

.stock-rule-field__icon {
    display: grid;
    place-items: center;
    flex: 0 0 auto;
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 50%;
    background: rgba(0, 123, 224, 0.12);
    color: var(--md-sys-color-primary);
    font-size: 1.25rem;
}

.stock-rule-field__card--empty .stock-rule-field__icon {
    background: var(--md-sys-color-surface-container-high);
    color: var(--md-sys-color-on-surface-variant);
}

.stock-rule-field__card-title h4 {
    margin: 0;
    font-size: 1.05rem;
    font-weight: 700;
}

.stock-rule-field__card-title p {
    margin: 0.2rem 0 0;
    color: var(--md-sys-color-on-surface-variant);
    font-size: 0.88rem;
    line-height: 1.4;
}

.stock-rule-field__owned-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
}

.stock-rule-field__summary {
    display: flex;
    align-items: flex-start;
    gap: 0.55rem;
    padding: 0.75rem 0.9rem;
    border-radius: var(--md-sys-shape-corner-sm);
    background: var(--md-sys-color-primary-container);
    color: var(--md-sys-color-on-primary-container);
}

.stock-rule-field__summary .material-symbols-outlined {
    margin-top: 0.05rem;
    font-size: 1.15rem;
}

.stock-rule-field__summary p {
    margin: 0;
    font-size: 0.92rem;
    line-height: 1.45;
}

.stock-rule-field__pick {
    min-width: 0;
}

.stock-rule-field__card .md-ms.has-value .md-ms__trigger {
    background: #fff;
    box-shadow: none;
}

.stock-rule-field__card .md-ms.has-value .md-ms__value:not(.is-placeholder),
.stock-rule-field__card .md-ms.has-value .md-ms__actions {
    color: var(--md-sys-color-on-surface);
}

@media (max-width: 640px) {
    .stock-rule-field__card-head {
        flex-direction: column;
    }
}

.stock-rule-usage-summary {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.stock-rule-usage-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.4rem 0.75rem;
    border-radius: 999px;
    background: rgba(0, 123, 224, 0.1);
    color: var(--md-sys-color-primary);
    font-size: 0.9rem;
}

.stock-rule-usage-chip--warn {
    background: #fff4d6;
    color: var(--md-sys-color-warn);
}

.md-dialog {
    width: min(100%, 28rem);
    padding: 1.5rem 1.5rem 1.25rem;
    border-radius: 1.75rem;
    background: #fff;
    box-shadow: 0 16px 48px rgba(7, 16, 24, 0.22);
    animation: md-dialog-in 0.18s ease;
}

.md-dialog--wide {
    width: min(100%, 36rem);
}

.md-dialog--eurotax {
    display: flex;
    flex-direction: column;
    width: min(100%, 52rem);
    max-height: min(90vh, 48rem);
    padding: 0;
    overflow: hidden;
}

.eurotax-dialog__header,
.eurotax-dialog__heading,
.eurotax-dialog__footer {
    display: flex;
    align-items: center;
}

.eurotax-dialog__header {
    justify-content: space-between;
    gap: 1rem;
    padding: 1.25rem 1.35rem 1rem;
    border-bottom: 1px solid var(--md-sys-color-outline-variant);
}

.eurotax-dialog__heading {
    align-items: flex-start;
    gap: 0.85rem;
}

.eurotax-dialog__heading .md-dialog__icon {
    flex: 0 0 auto;
    margin: 0;
    background: rgba(0, 123, 224, 0.12);
    color: var(--md-sys-color-primary);
}

.eurotax-dialog__heading .md-dialog__title {
    margin-bottom: 0.2rem;
}

.eurotax-dialog__tabs {
    display: flex;
    gap: 0;
    padding: 0 1.35rem;
    border-bottom: 1px solid var(--md-sys-color-outline-variant);
}

.eurotax-dialog__tabs button {
    padding: 0.8rem 1rem;
    border: 0;
    border-bottom: 2px solid transparent;
    background: transparent;
    color: var(--md-sys-color-on-surface-variant);
    font: inherit;
    font-weight: 700;
    cursor: pointer;
}

.eurotax-dialog__tabs button.is-active {
    border-bottom-color: var(--md-sys-color-primary);
    color: var(--md-sys-color-primary);
}

.eurotax-dialog__body {
    flex: 1 1 auto;
    min-height: 0;
    overflow: auto;
    padding: 1rem 1.35rem;
}

.eurotax-dialog__fieldset {
    min-width: 0;
    margin: 0;
    padding: 0;
    border: 0;
}

.eurotax-dialog__fieldset legend {
    margin-bottom: 0.8rem;
    font-weight: 750;
}

.eurotax-dialog__grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.9rem;
}

.eurotax-dialog__grid .md-field {
    margin: 0;
}

.eurotax-dialog__version {
    grid-column: 1 / -1;
}

.eurotax-dialog__loading {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.45rem;
    margin: 0.8rem 0;
    color: var(--md-sys-color-on-surface-variant);
}

.eurotax-dialog__footer {
    justify-content: flex-end;
    gap: 0.5rem;
    padding: 0.85rem 1.35rem 1.1rem;
    border-top: 1px solid var(--md-sys-color-outline-variant);
}

@media (max-width: 640px) {
    .eurotax-dialog__grid {
        grid-template-columns: 1fr;
    }

    .eurotax-dialog__version {
        grid-column: auto;
    }
}

.md-dialog__icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.75rem;
    height: 2.75rem;
    margin-bottom: 0.85rem;
    border-radius: var(--md-sys-shape-corner-full);
    background: var(--md-sys-color-error-container);
    color: var(--md-sys-color-error);
}

.md-dialog--info .md-dialog__icon,
.md-dialog--success .md-dialog__icon {
    background: rgba(0, 123, 224, 0.12);
    color: var(--md-sys-color-primary);
}

.md-dialog--success .md-dialog__icon {
    background: #e5f7ec;
    color: var(--md-sys-color-success);
}

.md-dialog__icon .material-symbols-outlined {
    font-size: 1.45rem;
}

.md-dialog__title {
    margin: 0 0 0.5rem;
    font-size: 1.35rem;
    font-weight: 700;
    line-height: 1.25;
    color: var(--md-sys-color-on-surface);
}

.md-dialog__body {
    margin: 0;
    font-size: 0.95rem;
    line-height: 1.45;
    color: var(--md-sys-color-on-surface-variant);
}

.md-dialog__actions {
    display: flex;
    justify-content: flex-end;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 1.5rem;
}

.md-snackbar-host {
    position: fixed;
    left: 50%;
    bottom: 1.25rem;
    z-index: 90;
    display: flex;
    justify-content: center;
    width: min(calc(100% - 2rem), 32rem);
    transform: translateX(-50%);
    pointer-events: none;
}

.md-snackbar {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    width: 100%;
    min-height: 3rem;
    padding: 0.65rem 0.75rem 0.65rem 1rem;
    border-radius: 0.85rem;
    background: #2b3340;
    color: #fff;
    box-shadow: 0 10px 28px rgba(7, 16, 24, 0.28);
    pointer-events: auto;
    animation: md-snackbar-in 0.2s ease;
}

.md-snackbar .material-symbols-outlined {
    flex: 0 0 auto;
    font-size: 1.25rem;
}

.md-snackbar__message {
    flex: 1 1 auto;
    font-size: 0.92rem;
    line-height: 1.35;
}

.md-snackbar__action {
    color: #9fceff !important;
    min-height: 2rem;
    padding-inline: 0.55rem;
}

.md-snackbar__dismiss {
    color: #fff;
    width: 36px;
    height: 36px;
}

.md-snackbar__dismiss:hover {
    background: rgba(255, 255, 255, 0.12);
}

.md-snackbar--success .material-symbols-outlined {
    color: #7ddea0;
}

.md-snackbar--error .material-symbols-outlined {
    color: #ffb4ab;
}

.md-snackbar--warning .material-symbols-outlined {
    color: #ffd591;
}

.md-snackbar--info .material-symbols-outlined {
    color: #9fceff;
}

@keyframes md-dialog-in {
    from { opacity: 0; transform: translateY(10px) scale(0.98); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes md-snackbar-in {
    from { opacity: 0; transform: translateY(12px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ── App shell ───────────────────────────────────────────── */

.app-shell {
    display: flex;
    align-items: stretch;
    min-height: 100vh;
}

.app-nav {
    position: sticky;
    top: 0;
    height: 100vh;
    width: var(--app-nav-width);
    min-width: var(--app-nav-width);
    max-width: var(--app-nav-width);
    flex: 0 0 var(--app-nav-width);
    display: flex;
    flex-direction: column;
    padding: 1rem 0.65rem;
    background: #071018;
    color: #fff;
    z-index: 30;
    overflow-x: hidden;
    overflow-y: auto;
    transition: width 0.22s ease, min-width 0.22s ease, max-width 0.22s ease, flex-basis 0.22s ease, padding 0.22s ease;
}

.app-nav.is-collapsed,
.app-shell.nav-collapsed .app-nav {
    width: var(--app-nav-width-collapsed);
    min-width: var(--app-nav-width-collapsed);
    max-width: var(--app-nav-width-collapsed);
    flex-basis: var(--app-nav-width-collapsed);
    padding-left: 0.45rem;
    padding-right: 0.45rem;
    overflow: visible;
}

.app-nav__brand {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    min-height: 2.5rem;
    padding: 0.35rem 0.65rem 1.15rem;
}

.brand-link {
    display: flex;
    align-items: center;
    min-width: 0;
}

.brand-logo {
    display: block;
    transition: opacity 0.15s ease;
}

.brand-logo--full {
    height: 24px;
    width: auto;
}

.brand-logo--mark {
    display: none;
    width: 28px;
    height: 28px;
}

.app-nav.is-collapsed .app-nav__brand,
.app-shell.nav-collapsed .app-nav__brand {
    justify-content: center;
    padding-left: 0.25rem;
    padding-right: 0.25rem;
}

.app-nav.is-collapsed .brand-link,
.app-shell.nav-collapsed .brand-link {
    justify-content: center;
    width: 100%;
}

.app-nav.is-collapsed .brand-logo--full,
.app-shell.nav-collapsed .brand-logo--full {
    display: none;
}

.app-nav.is-collapsed .brand-logo--mark,
.app-shell.nav-collapsed .brand-logo--mark {
    display: block;
}

.app-nav__links {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
    flex: 1;
}

.nav-item {
    position: relative;
    display: flex;
    align-items: center;
    gap: 0.65rem;
    min-height: 42px;
    padding: 0 0.7rem;
    border-radius: var(--md-sys-shape-corner-sm);
    color: rgba(255, 255, 255, 0.82);
    transition: background 0.15s ease, color 0.15s ease;
}

.nav-item .material-symbols-outlined {
    flex-shrink: 0;
    font-size: 1.35rem;
}

.nav-item__label {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.nav-item:hover,
.nav-item.is-active {
    background: rgba(0, 123, 224, 0.22);
    color: #fff;
}

.nav-item.is-active {
    box-shadow: inset 3px 0 0 var(--md-sys-color-primary);
}

.nav-item--muted {
    color: rgba(255, 255, 255, 0.65);
}

/* Collapsed rail: solo icone + flyout label */
.app-nav.is-collapsed .nav-item,
.app-shell.nav-collapsed .nav-item {
    justify-content: center;
    padding: 0;
    width: 100%;
    overflow: visible;
}

.app-nav.is-collapsed .nav-item.is-active,
.app-shell.nav-collapsed .nav-item.is-active {
    box-shadow: none;
    background: rgba(0, 123, 224, 0.28);
}

.app-nav.is-collapsed .nav-item__label,
.app-shell.nav-collapsed .nav-item__label {
    width: max-content;
    max-width: 220px;
}

.app-nav.is-collapsed .nav-item__label,
.app-nav.is-collapsed .nav-flyout,
.app-shell.nav-collapsed .nav-item__label,
.app-shell.nav-collapsed .nav-flyout {
    position: absolute;
    left: calc(100% + 0.45rem);
    top: 50%;
    transform: translateY(-50%);
    margin: 0;
    padding: 0.55rem 0.75rem;
    border-radius: var(--md-sys-shape-corner-sm);
    background: #0b1722;
    color: #fff;
    box-shadow: var(--md-sys-elevation-2);
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    z-index: 40;
    transition: opacity 0.12s ease, visibility 0.12s ease;
}

.app-nav.is-collapsed .nav-flyout,
.app-shell.nav-collapsed .nav-flyout {
    top: 0;
    transform: none;
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    min-width: 180px;
    padding: 0.4rem;
}

.app-nav.is-collapsed .nav-item:hover > .nav-item__label,
.app-nav.is-collapsed .nav-item:focus-visible > .nav-item__label,
.app-nav.is-collapsed .nav-item:hover > .nav-flyout,
.app-nav.is-collapsed .nav-item:focus-within > .nav-flyout,
.app-shell.nav-collapsed .nav-item:hover > .nav-item__label,
.app-shell.nav-collapsed .nav-item:focus-visible > .nav-item__label,
.app-shell.nav-collapsed .nav-item:hover > .nav-flyout,
.app-shell.nav-collapsed .nav-item:focus-within > .nav-flyout {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

.app-nav.is-collapsed .nav-flyout .nav-item,
.app-shell.nav-collapsed .nav-flyout .nav-item {
    justify-content: flex-start;
    width: auto;
    padding: 0 0.65rem;
    color: rgba(255, 255, 255, 0.88);
}

.app-nav.is-collapsed .nav-flyout .nav-item__label,
.app-shell.nav-collapsed .nav-flyout .nav-item__label {
    position: static;
    transform: none;
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    background: transparent;
    box-shadow: none;
    padding: 0;
}

.app-main {
    min-width: 0;
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    min-height: 100dvh;
}

.app-topbar {
    position: sticky;
    top: 0;
    z-index: 25;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    min-height: var(--app-topbar-height);
    padding: 0.65rem 1.25rem;
    background: color-mix(in srgb, #f8fafc 88%, transparent);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--md-sys-color-outline-variant);
}

.app-topbar__title {
    flex: 1;
    min-width: 0;
}

.app-topbar__title h1 {
    font-size: clamp(1.35rem, 1.8vw, 1.7rem);
    font-weight: 700;
    letter-spacing: -0.02em;
}

.page-subtitle {
    margin-top: 0.15rem;
    font-size: 0.9rem;
    color: var(--md-sys-color-on-surface-variant);
}

.app-topbar__actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-shrink: 0;
}

.app-topbar__user {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    flex-shrink: 0;
    padding-left: 0.65rem;
    margin-left: 0.15rem;
    border-left: 1px solid var(--md-sys-color-outline-variant);
}

.topbar-user {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    min-width: 0;
    padding: 0.15rem 0.35rem;
}

.topbar-user__avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    background: var(--md-sys-color-primary);
    color: var(--md-sys-color-on-primary);
    font-size: 0.85rem;
    font-weight: 700;
    flex-shrink: 0;
}

.topbar-user__meta {
    display: flex;
    flex-direction: column;
    gap: 0.05rem;
    min-width: 0;
    max-width: 160px;
}

.topbar-user__meta strong,
.topbar-user__meta span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.topbar-user__meta strong {
    font-size: 0.85rem;
    font-weight: 600;
}

.topbar-user__meta span {
    font-size: 0.72rem;
    color: var(--md-sys-color-on-surface-variant);
}

/* Menù utente della topbar: nome → Le mie importazioni XLS, passkey, logout */
.user-menu {
    position: relative;
}

.user-menu__toggle {
    border: 0;
    border-radius: 999px;
    background: transparent;
    color: inherit;
    font: inherit;
    text-align: left;
    cursor: pointer;
    padding: 0.2rem 0.4rem 0.2rem 0.25rem;
}

.user-menu__toggle:hover,
.user-menu.is-open .user-menu__toggle {
    background: rgba(0, 123, 224, 0.06);
}

.user-menu__toggle:focus-visible {
    outline: 2px solid var(--md-sys-color-primary);
    outline-offset: 2px;
}

.user-menu__chevron {
    font-size: 1.2rem;
    color: var(--md-sys-color-on-surface-variant);
    transition: transform 0.15s ease;
}

.user-menu.is-open .user-menu__chevron {
    transform: rotate(180deg);
}

.user-menu__panel {
    position: absolute;
    top: calc(100% + 0.4rem);
    right: 0;
    z-index: 60;
    min-width: 15rem;
    padding: 0.35rem 0;
    border: 1px solid var(--md-sys-color-outline-variant);
    border-radius: 0.85rem;
    background: #fff;
    box-shadow: 0 10px 28px rgba(7, 16, 24, 0.16);
}

.user-menu__item {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.65rem 0.95rem;
    color: var(--md-sys-color-on-surface);
    font-size: 0.9rem;
    text-decoration: none;
}

.user-menu__item:hover,
.user-menu__item:focus-visible {
    background: rgba(0, 123, 224, 0.06);
    outline: none;
}

.user-menu__item.is-active {
    color: var(--md-sys-color-primary);
    font-weight: 600;
}

.user-menu__item .material-symbols-outlined {
    font-size: 1.2rem;
    color: var(--md-sys-color-primary);
}

.user-menu__divider {
    height: 1px;
    margin: 0.3rem 0;
    background: var(--md-sys-color-outline-variant);
}

.app-menu-toggle {
    display: inline-flex;
    flex-shrink: 0;
}

.app-scrim {
    display: none;
}

.app-content {
    padding: 1rem 1.25rem 1.75rem;
    flex: 1;
}

.app-content:has(.vehicles-page) {
    display: flex;
    flex-direction: column;
    min-height: 0;
    flex: 1 1 auto;
    padding-bottom: 0.5rem; /* piccolo margine sotto la tabella */
}

/* ── Dashboard ───────────────────────────────────────────── */

.dash-grid {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr 1fr;
    gap: 1rem;
}

.dash-hero {
    grid-column: 1 / -1;
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 1.5rem;
    padding: 1.75rem;
    background:
        linear-gradient(135deg, rgba(0, 123, 224, 0.12), transparent 48%),
        #fff;
}

.dash-hero h2 {
    margin: 0.35rem 0 0.65rem;
    font-size: clamp(1.3rem, 2vw, 1.65rem);
}

.dash-hero p,
.md-surface p {
    color: var(--md-sys-color-on-surface-variant);
    line-height: 1.5;
}

.eyebrow {
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--md-sys-color-primary);
}

.dash-icon {
    color: var(--md-sys-color-primary);
    margin-bottom: 0.75rem;
}

/* Dashboard: riquadro «Foto dall'App» (admin, funzionalità accesa) */
.dash-photos {
    grid-column: 1 / -1;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.dash-photos__head {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    justify-content: space-between;
    gap: 0.75rem;
}

.dash-photos__head h3 {
    margin: 0.2rem 0 0;
}

.dash-photos__periods {
    display: flex;
    gap: 0.4rem;
}

.dash-photos__periods a {
    text-decoration: none;
}

.dash-photos__stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(10rem, 1fr));
    gap: 0.75rem;
}

.dash-photos__stat {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    padding: 0.85rem 1rem;
    border-radius: 0.9rem;
    background: var(--md-sys-color-surface-container);
}

.dash-photos__stat .material-symbols-outlined {
    color: var(--md-sys-color-primary);
}

.dash-photos__stat strong {
    font-size: 1.5rem;
    line-height: 1.15;
}

.dash-photos__stat span:last-child {
    color: var(--md-sys-color-on-surface-variant);
    font-size: 0.85rem;
}

.dash-photos__lists {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr));
    gap: 1rem;
}

.dash-photos__lists h4 {
    margin: 0 0 0.4rem;
    font-size: 0.9rem;
}

.dash-photos__lists ul {
    margin: 0;
    padding: 0;
    list-style: none;
}

.dash-photos__lists li {
    display: flex;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.35rem 0;
    border-bottom: 1px solid var(--md-sys-color-outline-variant);
    font-size: 0.9rem;
}

.dash-photos__lists li a {
    color: var(--md-sys-color-primary);
}

.dash-photos__empty {
    margin: 0;
    font-size: 0.88rem;
}

.md-surface:not(.dash-hero) {
    padding: 1.25rem;
}

.md-surface h3 {
    margin-bottom: 0.35rem;
}

/* ── Auth ────────────────────────────────────────────────── */

.auth-screen {
    min-height: 100vh;
    min-width: 100vw;
    display: grid;
    place-items: center;
    padding: 1.5rem;
    background:
        radial-gradient(circle at 20% 20%, rgba(0, 123, 224, 0.35), transparent 28%),
        linear-gradient(145deg, #031018 0%, #0a2740 48%, #007be0 140%);
}

.auth-screen--light {
    background:
        radial-gradient(circle at top right, rgba(0, 123, 224, 0.12), transparent 30%),
        linear-gradient(180deg, #f7fafc, #ffffff);
}

.auth-panel {
    width: min(100%, 920px);
    display: grid;
    grid-template-columns: 1.05fr 0.95fr;
    gap: 1.5rem;
    align-items: center;
}

.auth-panel--centered {
    grid-template-columns: 1fr;
    justify-items: center;
    text-align: center;
    width: min(100%, 480px);
}

.auth-panel__brand {
    color: #fff;
    padding: 1rem;
}

.auth-logo {
    height: 42px;
    width: auto;
}

.auth-logo--dark {
    margin-bottom: 1.25rem;
}

.auth-tagline {
    margin-top: 1rem;
    font-size: 1.05rem;
    color: rgba(255, 255, 255, 0.78);
}

.auth-panel__card {
    background: #fff;
    border-radius: var(--md-sys-shape-corner-lg);
    padding: 2rem;
    box-shadow: var(--md-sys-elevation-2);
}

.auth-panel__card--soft {
    border: 1px solid var(--md-sys-color-outline-variant);
}

.auth-panel__card h1 {
    font-size: 1.55rem;
    letter-spacing: -0.02em;
    margin-bottom: 0.65rem;
}

.auth-lead {
    color: var(--md-sys-color-on-surface-variant);
    line-height: 1.55;
    margin-bottom: 1.5rem;
}

.pending-icon {
    width: 64px;
    height: 64px;
    margin: 0 auto 1rem;
    border-radius: 50%;
    display: grid;
    place-items: center;
    background: var(--md-sys-color-primary-container);
    color: var(--md-sys-color-primary);
}

.pending-icon .material-symbols-outlined {
    font-size: 1.85rem;
}

/* ── Detail drawer (CRUD intermedi, slide-over) ─────────── */

.detail-drawer-scrim {
    position: fixed;
    inset: 0;
    z-index: 60;
    background: rgba(7, 16, 24, 0.42);
    animation: fade-in 0.18s ease;
}

.detail-drawer {
    --detail-drawer-width: 560px;
    position: fixed;
    top: 0;
    right: 0;
    z-index: 61;
    display: flex;
    flex-direction: column;
    width: min(100vw, var(--detail-drawer-width));
    height: 100vh;
    background: #fff;
    box-shadow: -8px 0 32px rgba(7, 16, 24, 0.14);
    animation: detail-drawer-in 0.22s ease;
}

.detail-drawer--sm {
    --detail-drawer-width: 420px;
}

.detail-drawer--md {
    --detail-drawer-width: 560px;
}

.detail-drawer--lg {
    --detail-drawer-width: 720px;
}

.detail-drawer--prefs {
    --detail-drawer-width: 880px;
}

.detail-drawer--xl {
    --detail-drawer-width: min(1180px, calc(100vw - 2rem));
}

.detail-drawer--xxl {
    --detail-drawer-width: min(1440px, calc(100vw - 1rem));
}

.detail-drawer__header {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    padding: 0.85rem 1.1rem;
    border-bottom: 1px solid var(--md-sys-color-outline-variant);
    flex-shrink: 0;
}

.detail-drawer__header h2 {
    margin: 0;
    flex: 1;
    min-width: 0;
    font-size: 1.15rem;
    font-weight: 700;
    letter-spacing: -0.01em;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.detail-drawer__tabs {
    display: flex;
    gap: .25rem;
    padding: 0 1.1rem;
    border-bottom: 1px solid var(--md-sys-color-outline-variant);
    overflow-x: auto;
}

.detail-drawer__tabs button {
    display: inline-flex;
    align-items: center;
    gap: .45rem;
    min-height: 3rem;
    padding: 0 .8rem;
    border: 0;
    border-bottom: 3px solid transparent;
    color: var(--md-sys-color-on-surface-variant);
    background: transparent;
    white-space: nowrap;
    cursor: pointer;
}

.detail-drawer__tabs button:hover,
.detail-drawer__tabs button.is-active {
    color: var(--md-sys-color-primary);
}

.detail-drawer__tabs button.is-active {
    border-bottom-color: var(--md-sys-color-primary);
    font-weight: 700;
}

.detail-drawer__tab-count {
    display: inline-grid;
    min-width: 1.3rem;
    height: 1.3rem;
    place-items: center;
    padding: 0 .25rem;
    border-radius: 999px;
    color: var(--md-sys-color-on-primary);
    background: var(--md-sys-color-primary);
    font-size: .75rem;
}

.detail-drawer__body {
    flex: 1;
    min-height: 0;
    overflow: auto;
    padding: 1.15rem 1.25rem 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 0;
}

.detail-drawer__footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.85rem 1.15rem;
    border-top: 1px solid var(--md-sys-color-outline-variant);
    background: #fff;
    flex-shrink: 0;
}

.detail-drawer__footer-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    flex-wrap: wrap;
    gap: 0.5rem;
}

/* CRUD form primitives (shared by all intermediate CRUD drawers) */

.crud-form {
    --crud-form-gap-x: 1.5rem;
    --crud-form-gap-y: 1.35rem;
    --crud-form-section-gap: 1.75rem;
    --crud-form-title-gap: 1.35rem;
}

.crud-form__section {
    display: flex;
    flex-direction: column;
    gap: var(--crud-form-title-gap);
    padding-bottom: var(--crud-form-section-gap);
    margin-bottom: var(--crud-form-section-gap);
    border-bottom: 1px solid var(--md-sys-color-outline-variant);
}

.crud-form__section--last,
.crud-form__section:last-child {
    padding-bottom: 0;
    margin-bottom: 0;
    border-bottom: 0;
}

.crud-form__section-title {
    margin: 0;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--md-sys-color-on-surface-variant);
}

.crud-form__section-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.75rem;
}

.crud-form__section-meta {
    margin: 0.2rem 0 0;
    font-size: 0.8rem;
    color: var(--md-sys-color-on-surface-variant);
}

.crud-form__grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    column-gap: var(--crud-form-gap-x);
    row-gap: var(--crud-form-gap-y);
}

.crud-form__span {
    grid-column: 1 / -1;
}

.crud-form__hint {
    margin: 0.25rem 0 0;
    padding-left: 0.15rem;
    font-size: 0.78rem;
    line-height: 1.35;
    color: var(--md-sys-color-on-surface-variant);
}

.users-access-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.crud-form__info {
    display: grid;
    grid-template-columns: 1fr 1fr;
    column-gap: var(--crud-form-gap-x);
    row-gap: 0.85rem;
}

.crud-form__info-item {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}

.crud-form__info-item span {
    font-size: 0.75rem;
    color: var(--md-sys-color-on-surface-variant);
}

.crud-form__info-item strong {
    font-size: 0.92rem;
    font-weight: 600;
}

.md-field--outline {
    position: relative;
    gap: 0;
}

.md-field--outline > label,
.md-field--outline > span {
    position: absolute;
    top: -0.55rem;
    left: 0.7rem;
    padding: 0 0.3rem;
    background: var(--md-field-outline-label-bg, #fff);
    font-size: 0.72rem;
    font-weight: 500;
    line-height: 1.2;
    color: var(--md-sys-color-on-surface-variant);
    z-index: 1;
}

/* Il suggerimento sta sotto il campo: non va sovrapposto alla label flottante. */
.md-field--outline > .md-field__hint {
    position: static;
    margin-top: 0.35rem;
    padding: 0 0.2rem;
    background: none;
    font-size: 0.78rem;
    font-weight: 400;
    line-height: 1.35;
}

.md-field--outline input,
.md-field--outline select {
    min-height: 48px;
    padding: 0.7rem 0.9rem 0.45rem;
}

.location-cost-input {
    position: relative;
}

.location-cost-input input {
    width: 100%;
    padding-left: 2.2rem;
}

.location-cost-input__prefix {
    position: absolute;
    top: 50%;
    left: 0.9rem;
    transform: translateY(-50%);
    color: var(--md-sys-color-on-surface-variant);
    pointer-events: none;
}

.location-real-company-options {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.5rem 1rem;
    max-height: 12rem;
    overflow-y: auto;
    padding: 1rem 0.9rem 0.65rem;
    border: 1px solid var(--md-sys-color-outline);
    border-radius: var(--md-sys-shape-corner-sm);
}

.location-real-company-options label {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    min-width: 0;
    cursor: pointer;
}

.location-real-company-options label span {
    overflow-wrap: anywhere;
}

.md-field--outline .location-real-company-options .vehicles-switch input {
    min-height: 0;
    padding: 0;
}

.location-real-company-options .vehicles-switch:has(input:focus-visible) .vehicles-switch__ui {
    outline: 2px solid var(--md-sys-color-primary);
    outline-offset: 2px;
}

@media (max-width: 600px) {
    .location-real-company-options {
        grid-template-columns: minmax(0, 1fr);
    }
}

.md-field--outline input:disabled,
.md-field--outline select:disabled {
    background: var(--md-sys-color-surface-container);
    color: var(--md-sys-color-on-surface-variant);
}

:is(input, select, textarea)[readonly] {
    background: var(--md-sys-color-surface-container);
    color: var(--md-sys-color-on-surface-variant);
}

.md-field--outline .md-field__readonly {
    display: flex;
    align-items: center;
    min-height: 48px;
    padding: 0.7rem 0.9rem 0.45rem;
    border: 1px solid var(--md-sys-color-outline);
    border-radius: var(--md-sys-shape-corner-sm);
    background: var(--md-sys-color-surface-container);
    color: var(--md-sys-color-on-surface-variant);
}

.md-table tr.is-selected {
    background: color-mix(in srgb, var(--md-sys-color-primary-container) 55%, #fff);
}

.md-table tr.is-clickable {
    cursor: pointer;
}

.md-table tr.is-clickable:hover {
    background: var(--md-sys-color-surface-container);
}

.md-table tr.is-clickable.is-selected:hover {
    background: color-mix(in srgb, var(--md-sys-color-primary-container) 70%, #fff);
}

.activity-timeline {
    list-style: none;
    margin: 0;
    padding: 0.25rem 0 0;
    display: flex;
    flex-direction: column;
}

.activity-timeline__item {
    position: relative;
    display: grid;
    grid-template-columns: 2rem 1fr;
    gap: 0.75rem;
    padding-bottom: 1.15rem;
}

.activity-timeline__item:last-child {
    padding-bottom: 0;
}

.activity-timeline__rail {
    position: relative;
    display: flex;
    justify-content: center;
}

.activity-timeline__rail::before {
    content: "";
    position: absolute;
    top: 2rem;
    bottom: -0.15rem;
    left: 50%;
    width: 2px;
    transform: translateX(-50%);
    background: color-mix(in srgb, var(--md-sys-color-primary) 28%, var(--md-sys-color-outline-variant));
}

.activity-timeline__item:last-child .activity-timeline__rail::before {
    display: none;
}

.activity-timeline__icon {
    width: 2rem;
    height: 2rem;
    border-radius: 50%;
    display: grid;
    place-items: center;
    background: var(--md-sys-color-primary-container);
    color: var(--md-sys-color-primary);
    z-index: 1;
}

.activity-timeline__icon .material-symbols-outlined {
    font-size: 1.05rem;
}

.activity-timeline__icon--login {
    background: #e5f7ec;
    color: var(--md-sys-color-success);
}

.activity-timeline__icon--password {
    background: #e8f1ff;
    color: var(--md-sys-color-primary);
}

.activity-timeline__icon--enabled {
    background: #e5f7ec;
    color: var(--md-sys-color-success);
}

.activity-timeline__icon--disabled {
    background: #fff4d6;
    color: var(--md-sys-color-warn);
}

.activity-timeline__content {
    min-width: 0;
    padding-top: 0.1rem;
}

.activity-timeline__title-row {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.45rem 0.55rem;
}

.activity-timeline__title {
    margin: 0;
    font-size: 0.95rem;
    font-weight: 700;
}

.activity-timeline__badge {
    display: inline-flex;
    align-items: center;
    min-height: 22px;
    padding: 0 0.55rem;
    border-radius: var(--md-sys-shape-corner-full);
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    background: var(--md-sys-color-surface-container-high);
    color: var(--md-sys-color-on-surface-variant);
}

.activity-timeline__badge--login {
    background: #e5f7ec;
    color: var(--md-sys-color-success);
}

.activity-timeline__badge--edit {
    background: #e8f1ff;
    color: var(--md-sys-color-primary);
}

.activity-timeline__badge--create {
    background: #efe7ff;
    color: #5b3cc4;
}

.activity-timeline__badge--warn {
    background: #fff4d6;
    color: var(--md-sys-color-warn);
}

.activity-timeline__detail {
    margin: 0.3rem 0 0;
    font-size: 0.82rem;
    color: var(--md-sys-color-on-surface-variant);
    line-height: 1.4;
}

.activity-timeline__meta {
    margin: 0.25rem 0 0;
    display: flex;
    align-items: center;
    gap: 0.3rem;
    font-size: 0.75rem;
    color: var(--md-sys-color-on-surface-variant);
}

.activity-timeline__meta .material-symbols-outlined {
    font-size: 0.95rem;
}

.activity-timeline__pager {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    padding-top: 0.75rem;
}

@keyframes detail-drawer-in {
    from { opacity: 0; transform: translateX(24px); }
    to { opacity: 1; transform: translateX(0); }
}

@media (max-width: 700px) {
    .crud-form__grid,
    .crud-form__info {
        grid-template-columns: 1fr;
    }
}

/* ── Users ───────────────────────────────────────────────── */

.users-page {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.users-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 0.85rem;
    align-items: end;
    padding: 1rem;
}

.users-toolbar .md-field {
    flex: 1 1 12.5rem;
    min-width: 12.5rem;
}

.users-toolbar > .md-btn {
    flex: 0 0 auto;
}

.users-toolbar .md-ms__trigger {
    min-height: 44px;
}

.users-table-wrap {
    overflow: auto;
}

.users-empty {
    padding: 2rem 1rem;
    text-align: center;
    color: var(--md-sys-color-on-surface-variant);
}

.users-empty--compact {
    padding: 1rem 0.25rem;
}

/* Chrome condiviso liste (testata + piede): usato da Stock, Arkiwio e anagrafiche */
.list-table-card,
.vehicles-table-card {
    padding: 0;
    overflow: hidden;
    border-radius: var(--md-sys-shape-corner-md);
    box-shadow: var(--md-sys-elevation-1);
    background: var(--md-sys-color-surface);
    border: 1px solid var(--md-sys-color-outline-variant);
    flex: 1 1 auto;
    min-height: 0;
    display: flex;
    flex-direction: column;
}

.list-table-toolbar,
.vehicles-table-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.85rem 1.1rem;
    border-bottom: 1px solid var(--md-sys-color-outline-variant);
    background: linear-gradient(180deg, #fff 0%, var(--md-sys-color-surface-container) 100%);
    flex-shrink: 0;
}

.list-table-toolbar__meta,
.vehicles-table-toolbar__meta {
    display: flex;
    align-items: baseline;
    gap: 0.4rem;
    color: var(--md-sys-color-on-surface-variant);
    font-size: 0.88rem;
}

.list-table-toolbar__meta strong,
.vehicles-table-toolbar__meta strong {
    color: var(--md-sys-color-on-surface);
    font-size: 1.05rem;
}

.vehicles-selection-meta {
    display: inline-flex;
    align-items: center;
    align-self: center;
    gap: 0.75rem;
    margin-left: 0.75rem;
    padding-left: 0.75rem;
    border-left: 1px solid var(--md-sys-color-outline-variant);
    color: var(--md-sys-color-on-surface);
    font-size: 0.88rem;
    font-weight: 600;
    line-height: 1.2;
}

.vehicles-selection-meta__count,
.vehicles-selection-meta__clear,
.vehicles-selection-meta__filter {
    display: inline-flex;
    align-items: center;
    margin: 0;
    padding: 0;
    border: 0;
    background: transparent;
    color: inherit;
    font: inherit;
    line-height: inherit;
}

.vehicles-selection-meta__clear,
.vehicles-selection-meta__filter {
    color: var(--md-sys-color-primary);
    cursor: pointer;
}

.vehicles-selection-meta__clear:hover,
.vehicles-selection-meta__filter:hover {
    text-decoration: underline;
}

.vehicles-selection-meta__filter.is-active {
    padding: 0.12rem 0.65rem;
    border-radius: 999px;
    background: var(--md-sys-color-primary-container);
    color: var(--md-sys-color-on-primary-container);
    font-weight: 700;
    text-decoration: none;
}

.vehicles-selection-meta__filter.is-active:hover {
    text-decoration: none;
}

.list-table-body,
.users-table-wrap,
.companies-table-wrap,
.stock-rules-table-wrap {
    overflow: auto;
    max-width: 100%;
    flex: 1 1 auto;
    min-height: 0;
}

.list-table-card .users-empty,
.list-table-card .companies-empty,
.list-table-card .stock-rules-empty {
    padding: 3rem 1rem;
}

.list-pager,
.vehicles-pager {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.85rem 1.1rem;
    border-top: 1px solid var(--md-sys-color-outline-variant);
    background: #fff;
    flex-shrink: 0;
    color: var(--md-sys-color-on-surface-variant);
}

.list-pager__size,
.vehicles-pager__size {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.85rem;
    color: var(--md-sys-color-on-surface-variant);
}

.list-pager__size label,
.vehicles-pager__size label {
    margin: 0;
    white-space: nowrap;
    font-size: 0.85rem;
    font-weight: 400;
    color: var(--md-sys-color-on-surface-variant);
}

.list-pager__size select,
.vehicles-pager__size select {
    min-height: 2.2rem;
    min-width: 4.5rem;
    padding: 0 0.55rem;
    border-radius: var(--md-sys-shape-corner-xs);
    border: 1px solid var(--md-sys-color-outline);
    background: #fff;
    font: inherit;
}

.list-pager__info,
.vehicles-pager__info {
    font-size: 0.85rem;
    color: var(--md-sys-color-on-surface-variant);
}

.list-pager__nav,
.vehicles-pager__nav {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* ── Companies ───────────────────────────────────────────── */

.companies-page,
.locations-page,
.stock-rules-page,
.vehicle-tags-page,
.watermarks-page,
.warranty-page,
.media-stock-page,
.xls-imports-page,
.dms-etl-page {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.companies-toolbar {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 0.85rem;
    align-items: end;
    padding: 1rem;
}

.locations-toolbar {
    display: grid;
    grid-template-columns: minmax(14rem, 1fr) repeat(3, minmax(12rem, 1fr)) auto;
    gap: 0.85rem;
    align-items: end;
    padding: 1rem;
}

.locations-toolbar .md-field {
    min-width: 0;
}

.locations-toolbar select {
    width: 100%;
    min-width: 0;
}

.vehicle-tags-toolbar {
    grid-template-columns: minmax(14rem, 1fr) minmax(12rem, 1fr) auto;
}

.vehicle-tags-toolbar > .md-btn {
    justify-self: start;
    width: auto;
}

.vehicle-tag-swatch {
    display: inline-block;
    width: 1.5rem;
    height: 1.5rem;
    border-radius: 999px;
    border: 1px solid var(--md-sys-color-outline-variant);
    vertical-align: middle;
}

.vehicle-tag-color,
.vehicle-tag-quick-category {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.vehicle-tag-color input[type="color"] {
    width: 3rem;
    height: 2.75rem;
    padding: 0.15rem;
    border: 1px solid var(--md-sys-color-outline);
    border-radius: 8px;
    background: transparent;
    cursor: pointer;
}

.vehicle-tag-color input[type="text"],
.vehicle-tag-quick-category input {
    flex: 1 1 auto;
}

@media (max-width: 1100px) {
    .locations-toolbar {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 900px) {
    .vehicle-tags-toolbar {
        grid-template-columns: 1fr;
    }
}

.companies-table-wrap {
    overflow: auto;
}

.companies-empty {
    padding: 2rem 1rem;
    text-align: center;
    color: var(--md-sys-color-on-surface-variant);
}

.company-logo-editor {
    display: grid;
    grid-template-columns: 10rem 1fr;
    gap: 1.25rem;
    align-items: center;
}

.company-logo-editor__preview {
    display: grid;
    place-items: center;
    width: 10rem;
    height: 7.5rem;
    overflow: hidden;
    border: 1px solid var(--md-sys-color-outline-variant);
    border-radius: 0.75rem;
    background-color: #fff;
    background-image:
        linear-gradient(45deg, #e8e8e8 25%, transparent 25%),
        linear-gradient(-45deg, #e8e8e8 25%, transparent 25%),
        linear-gradient(45deg, transparent 75%, #e8e8e8 75%),
        linear-gradient(-45deg, transparent 75%, #e8e8e8 75%);
    background-position: 0 0, 0 0.5rem, 0.5rem -0.5rem, -0.5rem 0;
    background-size: 1rem 1rem;
}

.company-logo-editor__preview.is-empty {
    color: var(--md-sys-color-on-surface-variant);
}

.company-logo-editor__preview img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.company-logo-editor__input {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    clip-path: inset(50%);
    white-space: nowrap;
}

.company-logo-editor__content {
    min-width: 0;
}

.company-logo-editor__title,
.company-logo-editor__filename {
    margin: 0;
}

.company-logo-editor__title {
    font-weight: 600;
}

.company-logo-editor__filename {
    margin-top: 0.6rem;
    overflow-wrap: anywhere;
    font-size: 0.82rem;
}

.company-logo-editor__actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 0.85rem;
}

@media (max-width: 600px) {
    .company-logo-editor {
        grid-template-columns: 1fr;
    }
}

/* ── Vehicles stock ──────────────────────────────────────── */

.vehicles-page {
    display: flex;
    flex-direction: column;
    gap: 1.1rem;
    min-width: 0;
    flex: 1 1 auto;
    min-height: 0;
    height: 100%;
}

.vehicles-filters {
    padding: 1.15rem 1.25rem 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    border-radius: var(--md-sys-shape-corner-md);
    box-shadow: var(--md-sys-elevation-1);
    overflow: visible;
    position: relative;
    z-index: 5;
    flex-shrink: 0;
}

.vehicles-filters__head {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
}

.vehicles-filters__title {
    margin: 0;
    font-size: 0.95rem;
    font-weight: 700;
    letter-spacing: -0.01em;
}

.vehicles-filters__hint {
    margin: 0.2rem 0 0;
    font-size: 0.8rem;
    color: var(--md-sys-color-on-surface-variant);
}

.vehicles-filters__grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(13.5rem, 1fr));
    gap: 0.75rem 0.85rem;
    align-items: stretch;
}

.vehicles-filters__grid > .md-range {
    grid-column: span 2;
    min-width: 0;
}

@media (max-width: 700px) {
    .vehicles-filters__grid > .md-range {
        grid-column: 1 / -1;
    }
}

.vehicles-filters__actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    justify-content: flex-end;
}

.vehicles-filter--booking {
    display: flex;
    align-items: center;
    min-height: 42px;
}

.vehicles-filter--booking.has-value .vehicles-booking-filter {
    border-color: var(--md-sys-color-primary);
    background: var(--md-sys-color-primary-container);
    color: var(--md-sys-color-on-primary-container);
}

.vehicles-booking-filter {
    position: relative;
    display: flex;
    align-items: center;
    gap: 0.35rem;
    width: 100%;
    min-height: 42px;
    padding: 0 0.55rem 0 0.65rem;
    border: 1px solid var(--md-sys-color-outline);
    border-radius: var(--md-sys-shape-corner-sm);
    background: #fff;
    color: var(--md-sys-color-on-surface);
    transition: border-color 0.15s ease, background 0.15s ease;
}

.vehicles-booking-filter > .material-symbols-outlined:first-child {
    flex-shrink: 0;
    font-size: 1.1rem;
    color: var(--md-sys-color-on-surface-variant);
}

.vehicles-filter--booking.has-value .vehicles-booking-filter > .material-symbols-outlined:first-child {
    color: var(--md-sys-color-primary);
}

.vehicles-filter--contract .vehicles-booking-filter > .material-symbols-outlined:first-child {
    color: #c47f00;
    font-variation-settings: 'FILL' 1, 'wght' 500, 'GRAD' 0, 'opsz' 24;
}

.vehicles-filter--contract.has-value .vehicles-booking-filter > .material-symbols-outlined:first-child {
    color: #c47f00;
}

.vehicles-booking-filter select {
    appearance: none;
    flex: 1;
    min-width: 0;
    border: 0;
    background: transparent;
    color: inherit;
    font-size: 0.88rem;
    font-weight: 500;
    cursor: pointer;
}

.vehicles-booking-filter select:focus {
    outline: none;
}

.vehicles-booking-filter__chevron {
    flex-shrink: 0;
    font-size: 1.1rem;
    color: var(--md-sys-color-on-surface-variant);
    pointer-events: none;
}

.vehicles-booking-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.85rem;
    height: 1.85rem;
    border-radius: 999px;
}

.vehicles-booking-icon .material-symbols-outlined {
    font-size: 1.2rem;
}

.vehicles-booking-icon.is-free {
    color: var(--md-sys-color-on-surface-variant);
    background: var(--md-sys-color-surface-container);
}

.vehicles-booking-icon.is-booked {
    color: #b3261e;
    background: color-mix(in srgb, #b3261e 12%, #fff);
}

.vehicles-cell-dms {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
}

.vehicles-contract-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.45rem;
    height: 1.45rem;
    border-radius: 999px;
    color: #c47f00;
    background: color-mix(in srgb, #f9a825 22%, #fff);
    flex-shrink: 0;
}

.vehicles-contract-icon .material-symbols-outlined {
    font-size: 1.05rem;
    font-variation-settings: 'FILL' 1, 'wght' 500, 'GRAD' 0, 'opsz' 24;
}

/* Colonna Vista 360 (Wrap360) */
.vehicles-view360-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.75rem;
    height: 1.75rem;
    border-radius: 999px;
    color: var(--md-sys-color-primary);
    background: color-mix(in srgb, var(--md-sys-color-primary) 12%, transparent);
}

.vehicles-view360-icon .material-symbols-outlined {
    font-size: 1.2rem;
}

/* Range Da / A compatto su una riga */
.md-range {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 0.4rem;
    min-width: 0;
    min-height: 42px;
    padding: 0 0.35rem 0 0.55rem;
    border: 1px solid var(--md-sys-color-outline);
    border-radius: var(--md-sys-shape-corner-sm);
    background: #fff;
    transition: border-color 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
}

.md-range.has-value {
    border-color: var(--md-sys-color-primary);
    background: var(--md-sys-color-primary-container);
    box-shadow: 0 0 0 1px color-mix(in srgb, var(--md-sys-color-primary) 35%, transparent);
}

.md-range__icon {
    flex-shrink: 0;
    font-size: 1.1rem;
    color: var(--md-sys-color-on-surface-variant);
}

.md-range.has-value .md-range__icon {
    color: var(--md-sys-color-primary);
}

.md-range__clear {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: 1.5rem;
    height: 1.5rem;
    border: 0;
    border-radius: 999px;
    background: transparent;
    color: var(--md-sys-color-on-primary-container);
    cursor: pointer;
}

.md-range__clear:hover {
    background: color-mix(in srgb, var(--md-sys-color-on-primary-container) 12%, transparent);
}

.md-range__clear .material-symbols-outlined {
    font-size: 1rem;
}

.md-range__control {
    position: relative;
    flex: 1 1 0;
    min-width: 0;
}

.md-range__control select {
    appearance: none;
    width: 100%;
    min-height: 36px;
    padding: 0 1.6rem 0 0.35rem;
    border: 0;
    border-radius: var(--md-sys-shape-corner-xs, 4px);
    background: transparent;
    color: var(--md-sys-color-on-surface-variant);
    font-size: 0.84rem;
    font-weight: 500;
    cursor: pointer;
}

.md-range__control.is-filled select {
    color: var(--md-sys-color-on-primary-container);
    font-weight: 700;
}

.md-range.has-value .md-range__control:not(.is-filled) select {
    color: color-mix(in srgb, var(--md-sys-color-on-primary-container) 70%, transparent);
    font-weight: 500;
}

.md-range__control select:focus {
    outline: none;
    background: color-mix(in srgb, #fff 55%, transparent);
}

.md-range__chevron {
    position: absolute;
    right: 0.1rem;
    top: 50%;
    transform: translateY(-50%);
    pointer-events: none;
    font-size: 1.05rem;
    color: var(--md-sys-color-on-surface-variant);
}

.md-range.has-value .md-range__chevron {
    color: var(--md-sys-color-on-primary-container);
}

.md-range__sep {
    flex-shrink: 0;
    color: var(--md-sys-color-on-surface-variant);
    font-weight: 600;
    font-size: 0.9rem;
    line-height: 1;
    opacity: 0.7;
}

.md-range.has-value .md-range__sep {
    color: var(--md-sys-color-on-primary-container);
}

.vehicles-switch {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    min-height: 42px;
    cursor: pointer;
    user-select: none;
}

.vehicles-switch input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.vehicles-switch__ui {
    width: 2.4rem;
    height: 1.35rem;
    border-radius: 999px;
    background: var(--md-sys-color-outline);
    position: relative;
    transition: background 0.15s ease;
    flex-shrink: 0;
}

.vehicles-switch__ui::after {
    content: "";
    position: absolute;
    top: 2px;
    left: 2px;
    width: 1.05rem;
    height: 1.05rem;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.18);
    transition: transform 0.15s ease;
}

.vehicles-switch input:checked + .vehicles-switch__ui {
    background: var(--md-sys-color-primary);
}

.vehicles-switch input:checked + .vehicles-switch__ui::after {
    transform: translateX(1.05rem);
}

.vehicles-switch:has(input:disabled) {
    cursor: default;
    opacity: 0.65;
}

.vehicles-switch__label {
    font-size: 0.88rem;
    font-weight: 600;
}

.vehicles-check {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    font-size: 0.88rem;
    cursor: pointer;
}

.vehicles-check--solo {
    justify-content: center;
    gap: 0;
}

.vehicles-bulk-menu {
    position: relative;
}

.vehicles-bulk-menu__panel {
    position: absolute;
    top: calc(100% + 0.35rem);
    right: 0;
    z-index: 20;
    min-width: 14rem;
    padding: 0.35rem 0;
    border: 1px solid var(--md-sys-color-outline-variant);
    border-radius: 0.85rem;
    background: #fff;
    box-shadow: 0 10px 28px rgba(7, 16, 24, 0.16);
}

.vehicles-bulk-menu__item {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    width: 100%;
    padding: 0.65rem 0.9rem;
    border: 0;
    background: transparent;
    color: var(--md-sys-color-on-surface);
    font-size: 0.9rem;
    text-align: left;
    cursor: pointer;
}

.vehicles-bulk-menu__item:hover {
    background: rgba(0, 123, 224, 0.06);
}

.vehicles-bulk-menu__item .material-symbols-outlined {
    font-size: 1.15rem;
    color: var(--md-sys-color-primary);
}

.vehicles-bulk-menu__item:disabled {
    cursor: not-allowed;
    color: var(--md-sys-color-on-surface-variant);
}

.vehicles-bulk-menu__item:disabled:hover {
    background: transparent;
}

.vehicles-bulk-menu__item:disabled .material-symbols-outlined {
    color: var(--md-sys-color-outline);
}

.vehicles-bulk-menu__text {
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
}

.vehicles-bulk-menu__hint {
    font-size: 0.78rem;
    font-weight: 400;
    color: var(--md-sys-color-on-surface-variant);
}

/* Azioni della lista nella toolbar della tabella (prima di "Per pagina") */
.vehicles-table-card--actions {
    container-type: inline-size;
    container-name: vehicles-table;
    /* Gli z-index interni (toolbar, menu azioni) restano nella card: i pannelli dei filtri sopra la coprono */
    isolation: isolate;
}

.vehicles-table-card--actions .vehicles-table-toolbar {
    position: relative;
    z-index: 6;
    flex-wrap: wrap;
    row-gap: 0.6rem;
}

.vehicles-table-toolbar__end {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    margin-left: auto;
}

.vehicles-toolbar-btn {
    min-height: 38px;
    padding: 0 0.75rem 0 0.85rem;
    gap: 0.35rem;
    font-size: 0.88rem;
    white-space: nowrap;
}

.vehicles-toolbar-btn .material-symbols-outlined {
    font-size: 1.2rem;
}

.vehicles-toolbar-btn .vehicles-toolbar-btn__chevron {
    font-size: 1.1rem;
    margin-left: -0.1rem;
}

@container vehicles-table (max-width: 900px) {
    .vehicles-toolbar-btn__label {
        display: none;
    }

    .vehicles-toolbar-btn {
        padding: 0 0.5rem 0 0.65rem;
    }
}

.vehicles-select-all-banner {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5rem 0.75rem;
    padding: 0.55rem 1.1rem;
    border-bottom: 1px solid var(--md-sys-color-outline-variant);
    background: var(--md-sys-color-primary-container);
    color: var(--md-sys-color-on-primary-container);
    font-size: 0.88rem;
    flex-shrink: 0;
}

.vehicles-select-all-banner .material-symbols-outlined {
    font-size: 1.15rem;
}

.vehicles-select-all-banner__action {
    margin: 0;
    padding: 0;
    border: 0;
    background: transparent;
    color: var(--md-sys-color-primary);
    font: inherit;
    font-weight: 700;
    cursor: pointer;
}

.vehicles-select-all-banner__action:hover {
    text-decoration: underline;
}

.vehicles-select-all-banner__action:disabled {
    opacity: 0.6;
    cursor: progress;
}

.vehicles-bulk-dialog-scrim {
    z-index: 70;
    align-items: stretch;
    padding: 1.5rem;
}

.vehicles-bulk-dialog {
    display: flex;
    flex-direction: column;
    width: min(100%, 56rem);
    max-height: min(46rem, calc(100vh - 3rem));
    margin: auto;
    padding: 0;
    overflow: hidden;
    border-radius: 1.5rem;
    background: #fff;
    box-shadow: 0 20px 56px rgba(7, 16, 24, 0.24);
    animation: md-dialog-in 0.18s ease;
}

.vehicles-bulk-dialog__header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    padding: 1.25rem 1.35rem 1rem;
    border-bottom: 1px solid var(--md-sys-color-outline-variant);
    background: linear-gradient(180deg, rgba(0, 123, 224, 0.06) 0%, #fff 100%);
}

.vehicles-bulk-dialog__heading {
    display: flex;
    align-items: flex-start;
    gap: 0.85rem;
    min-width: 0;
}

.vehicles-bulk-dialog__icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.5rem;
    height: 2.5rem;
    flex-shrink: 0;
    border-radius: 999px;
    background: var(--md-sys-color-primary-container);
    color: var(--md-sys-color-on-primary-container);
}

.vehicles-bulk-dialog__heading h2 {
    margin: 0 0 0.25rem;
    font-size: 1.35rem;
    font-weight: 700;
    line-height: 1.2;
}

.vehicles-bulk-dialog__heading p {
    margin: 0;
    color: var(--md-sys-color-on-surface-variant);
    font-size: 0.9rem;
    line-height: 1.4;
}

.vehicles-bulk-dialog__meta {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    flex-shrink: 0;
}

.vehicles-bulk-dialog__search {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    margin: 1rem 1.35rem 0;
    padding: 0 0.85rem;
    min-height: 2.75rem;
    border: 1px solid var(--md-sys-color-outline);
    border-radius: 999px;
    background: var(--md-sys-color-surface-container);
}

.vehicles-bulk-dialog__search .material-symbols-outlined {
    color: var(--md-sys-color-on-surface-variant);
}

.vehicles-bulk-dialog__search input {
    flex: 1 1 auto;
    min-width: 0;
    border: 0;
    background: transparent;
    outline: none;
    font-size: 0.95rem;
}

.vehicles-bulk-dialog__body {
    display: grid;
    grid-template-columns: minmax(11rem, 15rem) minmax(0, 1fr);
    gap: 0;
    min-height: 16rem;
    flex: 1 1 auto;
    margin-top: 1rem;
    overflow: hidden;
    border-top: 1px solid var(--md-sys-color-outline-variant);
}

.vehicles-bulk-dialog__nav {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    padding: 0.75rem 0.65rem;
    overflow: auto;
    background: var(--md-sys-color-surface-container);
    border-right: 1px solid var(--md-sys-color-outline-variant);
}

.vehicles-bulk-dialog__nav-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    width: 100%;
    padding: 0.55rem 0.7rem;
    border: 0;
    border-radius: 0.7rem;
    background: transparent;
    color: var(--md-sys-color-on-surface);
    font-size: 0.88rem;
    text-align: left;
    cursor: pointer;
}

.vehicles-bulk-dialog__nav-item:hover {
    background: rgba(0, 123, 224, 0.06);
}

.vehicles-bulk-dialog__nav-item.is-active {
    background: var(--md-sys-color-primary-container);
    color: var(--md-sys-color-on-primary-container);
    font-weight: 700;
}

.vehicles-bulk-dialog__nav-count {
    flex-shrink: 0;
    min-width: 1.4rem;
    padding: 0.05rem 0.4rem;
    border-radius: 999px;
    background: rgba(0, 0, 0, 0.06);
    font-size: 0.72rem;
    font-weight: 700;
    text-align: center;
}

.vehicles-bulk-dialog__nav-item.is-active .vehicles-bulk-dialog__nav-count {
    background: rgba(255, 255, 255, 0.45);
}

.vehicles-bulk-dialog__tags {
    display: flex;
    flex-direction: column;
    gap: 1.1rem;
    padding: 1rem 1.2rem 1.15rem;
    overflow: auto;
}

.vehicles-bulk-dialog__group h3 {
    margin: 0 0 0.55rem;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--md-sys-color-on-surface-variant);
}

.vehicles-bulk-dialog__grid {
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem;
}

.vehicles-bulk-dialog__chip {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    max-width: 100%;
    padding: 0.4rem 0.7rem 0.4rem 0.45rem;
    border: 1px solid var(--md-sys-color-outline-variant);
    border-radius: 999px;
    background: #fff;
    color: var(--md-sys-color-on-surface);
    font-size: 0.82rem;
    font-weight: 600;
    line-height: 1.2;
    cursor: pointer;
}

.vehicles-bulk-dialog__chip:hover {
    border-color: var(--md-sys-color-primary);
    background: rgba(0, 123, 224, 0.05);
}

.vehicles-bulk-dialog__chip.is-selected {
    border-color: var(--md-sys-color-primary);
    background: var(--md-sys-color-primary-container);
    color: var(--md-sys-color-on-primary-container);
    box-shadow: inset 0 0 0 1px var(--md-sys-color-primary);
}

.vehicles-bulk-dialog__footer {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.9rem 1.35rem 1.1rem;
    border-top: 1px solid var(--md-sys-color-outline-variant);
    background: var(--md-sys-color-surface-container);
}

.vehicles-bulk-dialog__chosen {
    min-width: 0;
    flex: 1 1 auto;
}

.vehicles-bulk-dialog__chosen strong {
    display: block;
    margin-bottom: 0.35rem;
    font-size: 0.8rem;
}

.vehicles-bulk-dialog__chosen-empty {
    color: var(--md-sys-color-on-surface-variant);
    font-size: 0.82rem;
}

.vehicles-bulk-dialog__chosen-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.3rem;
}

.vehicles-bulk-dialog__actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 0.5rem;
    flex-shrink: 0;
}

@media (max-width: 800px) {
    .vehicles-bulk-dialog__body {
        grid-template-columns: 1fr;
    }

    .vehicles-bulk-dialog__nav {
        flex-direction: row;
        flex-wrap: nowrap;
        overflow-x: auto;
        border-right: 0;
        border-bottom: 1px solid var(--md-sys-color-outline-variant);
    }

    .vehicles-bulk-dialog__nav-item {
        flex: 0 0 auto;
        white-space: nowrap;
    }

    .vehicles-bulk-dialog__footer {
        flex-direction: column;
        align-items: stretch;
    }
}

/* Multiselect combobox */
.md-ms {
    position: relative;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.md-ms__trigger {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    width: 100%;
    min-height: 42px;
    padding: 0 0.65rem 0 0.85rem;
    border: 1px solid var(--md-sys-color-outline);
    border-radius: var(--md-sys-shape-corner-sm);
    background: #fff;
    color: var(--md-sys-color-on-surface);
    text-align: left;
    cursor: pointer;
    transition: border-color 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
}

.md-ms.has-value .md-ms__trigger {
    border-color: var(--md-sys-color-primary);
    background: var(--md-sys-color-primary-container);
    box-shadow: 0 0 0 1px color-mix(in srgb, var(--md-sys-color-primary) 35%, transparent);
}

.md-ms.is-open .md-ms__trigger,
.md-ms__trigger:hover {
    border-color: var(--md-sys-color-primary);
}

.md-ms.is-open .md-ms__trigger {
    box-shadow: 0 0 0 3px rgba(0, 123, 224, 0.18);
}

.md-ms__value {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 0.9rem;
    font-weight: 500;
}

.md-ms__value.is-placeholder {
    color: var(--md-sys-color-on-surface-variant);
    font-weight: 400;
}

.md-ms.has-value .md-ms__value:not(.is-placeholder) {
    color: var(--md-sys-color-on-primary-container);
    font-weight: 600;
}

.md-ms.has-value .md-ms__actions {
    color: var(--md-sys-color-on-primary-container);
}

.md-ms__actions {
    display: inline-flex;
    align-items: center;
    gap: 0.1rem;
    color: var(--md-sys-color-on-surface-variant);
}

.md-ms__clear {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.5rem;
    height: 1.5rem;
    border-radius: 999px;
    color: var(--md-sys-color-on-surface-variant);
}

.md-ms__clear:hover {
    background: var(--md-sys-color-surface-container-high);
    color: var(--md-sys-color-on-surface);
}

.md-ms__clear .material-symbols-outlined,
.md-ms__chevron {
    font-size: 1.15rem;
}

.md-ms__panel {
    position: absolute;
    top: calc(100% + 0.35rem);
    left: 0;
    right: 0;
    z-index: 40;
    display: flex;
    flex-direction: column;
    max-height: 17rem;
    background: #fff;
    border: 1px solid var(--md-sys-color-outline-variant);
    border-radius: var(--md-sys-shape-corner-sm);
    box-shadow: var(--md-sys-elevation-2);
    overflow: hidden;
    animation: md-ms-in 0.14s ease;
}

.md-ms__search {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    margin: 0.65rem 0.65rem 0.35rem;
    padding: 0 0.65rem;
    min-height: 2.35rem;
    border: 1px solid var(--md-sys-color-outline-variant);
    border-radius: var(--md-sys-shape-corner-xs);
    background: var(--md-sys-color-surface-container);
    color: var(--md-sys-color-on-surface-variant);
}

.md-ms__search .material-symbols-outlined {
    font-size: 1.15rem;
}

.md-ms__search input {
    flex: 1;
    min-width: 0;
    border: 0;
    background: transparent;
    outline: none;
    font-size: 0.88rem;
}

.md-ms__list {
    overflow: auto;
    padding: 0.25rem 0 0.45rem;
}

.md-ms__option {
    display: flex;
    align-items: center;
    gap: 0.7rem;
    width: 100%;
    padding: 0.65rem 0.85rem;
    border: 0;
    border-bottom: 1px solid var(--md-sys-color-outline-variant);
    background: transparent;
    text-align: left;
    cursor: pointer;
    transition: background 0.12s ease;
}

.md-ms__option:last-child {
    border-bottom: 0;
}

.md-ms__option:hover {
    background: rgba(0, 123, 224, 0.06);
}

.md-ms__check {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.15rem;
    height: 1.15rem;
    border: 1.5px solid var(--md-sys-color-outline);
    border-radius: 4px;
    flex-shrink: 0;
    background: #fff;
    color: #fff;
}

.md-ms__option.is-selected .md-ms__check {
    background: var(--md-sys-color-primary);
    border-color: var(--md-sys-color-primary);
}

.md-ms__check .material-symbols-outlined {
    font-size: 0.95rem;
    font-variation-settings: "FILL" 1, "wght" 600, "GRAD" 0, "opsz" 20;
}

.md-ms__option-swatch {
    display: inline-block;
    width: 0.85rem;
    height: 0.85rem;
    border-radius: 999px;
    border: 1px solid var(--md-sys-color-outline-variant);
    flex-shrink: 0;
}

.md-ms__option-label {
    font-size: 0.9rem;
    line-height: 1.25;
}

.md-ms__empty {
    padding: 1rem 0.85rem;
    color: var(--md-sys-color-on-surface-variant);
    font-size: 0.85rem;
}

@keyframes md-ms-in {
    from { opacity: 0; transform: translateY(-4px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Arkiwio filters + date range picker */
.arkiwio-filters__grid {
    display: grid;
    grid-template-columns: minmax(12rem, 1.1fr) minmax(14rem, 1.3fr) repeat(3, minmax(9rem, 1fr));
    gap: 0.75rem 0.85rem;
    align-items: stretch;
}

.arkiwio-text-filter {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    min-height: 42px;
    padding: 0 0.75rem;
    border: 1px solid var(--md-sys-color-outline);
    border-radius: var(--md-sys-shape-corner-sm);
    background: #fff;
    transition: border-color 0.15s ease, background 0.15s ease;
}

.arkiwio-text-filter.has-value {
    border-color: var(--md-sys-color-primary);
    background: var(--md-sys-color-primary-container);
}

.arkiwio-text-filter .material-symbols-outlined {
    color: var(--md-sys-color-on-surface-variant);
    font-size: 1.1rem;
}

.arkiwio-text-filter.has-value .material-symbols-outlined {
    color: var(--md-sys-color-primary);
}

.arkiwio-text-filter input {
    flex: 1;
    min-width: 0;
    border: 0;
    background: transparent;
    outline: none;
    font-size: 0.88rem;
    font-weight: 500;
    color: inherit;
}

.md-drp {
    position: relative;
    min-width: 0;
}

.md-drp__trigger {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    width: 100%;
    min-height: 42px;
    padding: 0 0.65rem 0 0.75rem;
    border: 1px solid var(--md-sys-color-outline);
    border-radius: var(--md-sys-shape-corner-sm);
    background: #fff;
    color: var(--md-sys-color-on-surface);
    text-align: left;
    cursor: pointer;
}

.md-drp.has-value .md-drp__trigger {
    border-color: var(--md-sys-color-primary);
    background: var(--md-sys-color-primary-container);
    color: var(--md-sys-color-on-primary-container);
}

.md-drp.is-disabled .md-drp__trigger {
    opacity: 0.55;
    cursor: not-allowed;
}

.md-drp__value {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 0.88rem;
    font-weight: 500;
}

.md-drp__value.is-placeholder {
    color: var(--md-sys-color-on-surface-variant);
    font-weight: 400;
}

.md-drp__panel {
    position: absolute;
    top: calc(100% + 0.4rem);
    left: 0;
    z-index: 50;
    display: grid;
    grid-template-columns: 10.5rem minmax(16rem, 18rem);
    gap: 0;
    background: #fff;
    border: 1px solid var(--md-sys-color-outline-variant);
    border-radius: var(--md-sys-shape-corner-md);
    box-shadow: var(--md-sys-elevation-2);
    overflow: hidden;
    animation: md-ms-in 0.14s ease;
}

.md-drp__presets {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    padding: 0.75rem 0.65rem;
    background: var(--md-sys-color-surface-container);
    border-right: 1px solid var(--md-sys-color-outline-variant);
}

.md-drp__preset {
    border: 0;
    background: transparent;
    text-align: left;
    padding: 0.55rem 0.65rem;
    border-radius: var(--md-sys-shape-corner-sm);
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--md-sys-color-on-surface);
    cursor: pointer;
}

.md-drp__preset:hover,
.md-drp__preset.is-active {
    background: var(--md-sys-color-primary-container);
    color: var(--md-sys-color-on-primary-container);
}

.md-drp__calendar {
    padding: 0.75rem 0.85rem 0.85rem;
}

.md-drp__month-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.35rem;
    margin-bottom: 0.55rem;
}

.md-drp__month-nav strong {
    font-size: 0.92rem;
    text-transform: capitalize;
}

.md-drp__weekdays {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 0.15rem;
    margin-bottom: 0.25rem;
    text-align: center;
    font-size: 0.68rem;
    font-weight: 700;
    color: var(--md-sys-color-on-surface-variant);
    text-transform: uppercase;
}

.md-drp__grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 0.15rem;
}

.md-drp__day {
    aspect-ratio: 1;
    border: 0;
    border-radius: 999px;
    background: transparent;
    font-size: 0.82rem;
    font-weight: 500;
    cursor: pointer;
    color: var(--md-sys-color-on-surface);
}

.md-drp__day.is-empty {
    visibility: hidden;
}

.md-drp__day.is-disabled {
    opacity: 0.35;
    cursor: default;
}

.md-drp__day.is-today {
    box-shadow: inset 0 0 0 1px var(--md-sys-color-outline);
}

.md-drp__day.is-in-range {
    background: color-mix(in srgb, var(--md-sys-color-primary) 14%, #fff);
    border-radius: 0;
}

.md-drp__day.is-start,
.md-drp__day.is-end {
    background: var(--md-sys-color-primary);
    color: #fff;
    border-radius: 999px;
}

.md-drp__footer {
    display: flex;
    justify-content: flex-end;
    gap: 0.35rem;
    margin-top: 0.75rem;
    padding-top: 0.65rem;
    border-top: 1px solid var(--md-sys-color-outline-variant);
}

@media (max-width: 1100px) {
    .arkiwio-filters__grid {
        grid-template-columns: 1fr 1fr;
    }
}

@media (max-width: 900px) {
    .arkiwio-filters__grid {
        grid-template-columns: 1fr 1fr;
    }

    .md-drp__panel {
        grid-template-columns: 1fr;
        min-width: min(100vw - 2rem, 20rem);
    }

    .md-drp__presets {
        flex-direction: row;
        flex-wrap: wrap;
        border-right: 0;
        border-bottom: 1px solid var(--md-sys-color-outline-variant);
    }
}

.stock-rules-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 0.85rem;
    align-items: end;
    padding: 1rem;
}

.stock-rules-toolbar .md-field {
    flex: 1 1 12.5rem;
    min-width: 12.5rem;
}

.stock-rules-toolbar .md-field:first-child {
    flex: 1.4 1 14rem;
}

.stock-rules-toolbar > .md-btn {
    flex: 0 0 auto;
    width: auto;
}

.stock-rules-table-wrap {
    overflow-x: auto;
}

.stock-rules-empty {
    padding: 2rem 1rem;
    text-align: center;
    color: var(--md-sys-color-on-surface-variant);
}

.stock-rule-group {
    display: grid;
    gap: .75rem;
    padding: 1rem;
    border: 1px solid var(--md-sys-color-outline-variant);
    border-radius: 1rem;
    background: var(--md-sys-color-surface-container-low);
}

.stock-rule-group--nested {
    margin: .25rem 0;
    background: var(--md-sys-color-surface);
}

.stock-rule-group__head,
.stock-rule-group__actions {
    display: flex;
    align-items: center;
    gap: .75rem;
    flex-wrap: wrap;
}

.stock-rule-group__head {
    min-height: 2.75rem;
}

.stock-rule-group__collapse {
    display: inline-grid;
    place-items: center;
    width: 2rem;
    height: 2rem;
    padding: 0;
    border: 0;
    border-radius: 50%;
    color: var(--md-sys-color-on-surface-variant);
    background: transparent;
    cursor: pointer;
}

.stock-rule-group__collapse:hover {
    background: var(--md-sys-color-surface-container-high);
}

.stock-rule-group.is-collapsed {
    gap: .25rem;
}

.stock-rule-menu {
    position: relative;
    margin-left: auto;
}

.stock-rule-menu summary {
    list-style: none;
    cursor: pointer;
}

.stock-rule-menu summary::-webkit-details-marker {
    display: none;
}

.stock-rule-menu__content {
    position: absolute;
    z-index: 2;
    top: calc(100% + .25rem);
    right: 0;
    display: grid;
    min-width: 10rem;
    padding: .35rem;
    border: 1px solid var(--md-sys-color-outline-variant);
    border-radius: .75rem;
    background: var(--md-sys-color-surface-container);
    box-shadow: var(--md-sys-elevation-2);
}

.stock-rule-menu__content button {
    padding: .55rem .7rem;
    border: 0;
    border-radius: .45rem;
    color: var(--md-sys-color-on-surface);
    background: transparent;
    text-align: left;
    cursor: pointer;
}

.stock-rule-menu__content button:hover {
    background: var(--md-sys-color-surface-container-high);
}

.stock-rule-group__operator,
.stock-rule-condition select,
.stock-rule-condition input {
    min-height: 2.75rem;
    border: 1px solid var(--md-sys-color-outline);
    border-radius: .75rem;
    padding: .5rem .75rem;
    background: var(--md-sys-color-surface);
    color: inherit;
}

.stock-rule-condition select[multiple] {
    min-height: 5.5rem;
}

.stock-rule-group__hint {
    color: var(--md-sys-color-on-surface-variant);
}

.stock-rule-node {
    padding-left: 1rem;
    border-left: 3px solid var(--md-sys-color-primary);
}

.stock-rule-condition {
    display: grid;
    grid-template-columns: minmax(11rem, .9fr) minmax(12rem, 1fr) minmax(18rem, 2.2fr) auto;
    gap: .5rem;
    align-items: center;
}

.stock-rule-condition .md-ms {
    min-width: 18rem;
}

.stock-rule-condition--textlist {
    align-items: start;
}

.stock-rule-textlist {
    display: grid;
    gap: .25rem;
    min-width: 18rem;
}

.stock-rule-textlist textarea {
    width: 100%;
    min-height: 6.5rem;
    max-height: 18rem;
    resize: vertical;
    border: 1px solid var(--md-sys-color-outline);
    border-radius: .75rem;
    padding: .5rem .75rem;
    background: var(--md-sys-color-surface);
    color: inherit;
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: .875rem;
    line-height: 1.45;
    text-transform: uppercase;
}

.stock-rule-textlist textarea::placeholder {
    text-transform: none;
}

.stock-rule-textlist.is-invalid textarea {
    border-color: var(--md-sys-color-error);
}

.stock-rule-textlist__meta {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: .25rem .75rem;
    font-size: .75rem;
    color: var(--md-sys-color-on-surface-variant);
}

.stock-rule-textlist__count {
    font-weight: 600;
}

.stock-rule-textlist__count.is-error,
.stock-rule-textlist__error {
    color: var(--md-sys-color-error);
}

.stock-rule-textlist__error {
    margin: 0;
    font-size: .75rem;
}

.stock-rule-condition .md-ms__trigger {
    min-height: 2.75rem;
    padding-top: .5rem;
    padding-bottom: .5rem;
}

.stock-rule-condition .md-ms__value {
    overflow: visible;
    text-overflow: clip;
    white-space: normal;
    line-height: 1.35;
}

.stock-rule-condition .md-ms__panel {
    min-width: 100%;
    width: max-content;
    max-width: 28rem;
}

.stock-rule-summary,
.stock-rule-preview {
    margin-top: 1rem;
    padding: 1rem;
    border: 1px solid var(--md-sys-color-outline-variant);
    border-radius: 1rem;
    background: var(--md-sys-color-surface-container-low);
}

.stock-rule-associations__header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
}

.stock-rule-associations__header strong {
    color: var(--md-sys-color-primary);
    white-space: nowrap;
}

.stock-rule-associations__search {
    position: relative;
    max-width: 34rem;
    margin: 1rem 0;
}

.stock-rule-associations__search input {
    padding-right: 2.5rem;
}

.stock-rule-associations__search .material-symbols-outlined {
    position: absolute;
    right: .75rem;
    bottom: .7rem;
    color: var(--md-sys-color-on-surface-variant);
    pointer-events: none;
}

.stock-rule-associations {
    display: grid;
    gap: .5rem;
}

.stock-rule-association {
    display: grid;
    grid-template-columns: 1.5rem minmax(14rem, 1.5fr) minmax(10rem, 1fr) minmax(12rem, 1fr);
    align-items: center;
    gap: .75rem;
    padding: .75rem;
    border: 1px solid var(--md-sys-color-outline-variant);
    border-radius: .75rem;
    background: var(--md-sys-color-surface);
    cursor: pointer;
}

.stock-rule-association:hover,
.stock-rule-association.is-selected {
    border-color: var(--md-sys-color-primary);
    background: var(--md-sys-color-primary-container);
}

.stock-rule-association input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.stock-rule-association__check {
    display: inline-grid;
    width: 1.35rem;
    height: 1.35rem;
    place-items: center;
    border: 2px solid var(--md-sys-color-outline);
    border-radius: .3rem;
    color: transparent;
    font-size: 1rem;
}

.stock-rule-association.is-selected .stock-rule-association__check {
    border-color: var(--md-sys-color-primary);
    color: var(--md-sys-color-on-primary);
    background: var(--md-sys-color-primary);
}

.stock-rule-association__main {
    display: grid;
    gap: .15rem;
    min-width: 0;
}

.stock-rule-association__main small,
.stock-rule-association__company {
    overflow: hidden;
    color: var(--md-sys-color-on-surface-variant);
    text-overflow: ellipsis;
    white-space: nowrap;
}

.stock-rule-association__existing {
    justify-self: start;
    padding: .25rem .5rem;
    border-radius: 999px;
    color: var(--md-sys-color-on-surface-variant);
    background: var(--md-sys-color-surface-container-high);
    font-size: .78rem;
}

.stock-rule-log-count {
    display: inline-grid;
    min-width: 1.8rem;
    height: 1.8rem;
    place-items: center;
    border-radius: 999px;
    color: var(--md-sys-color-on-primary);
    background: var(--md-sys-color-primary);
    font-weight: 700;
}

.stock-rule-logs {
    position: relative;
    display: grid;
    gap: .75rem;
    padding-left: 2rem;
}

.stock-rule-logs::before {
    position: absolute;
    top: .75rem;
    bottom: .75rem;
    left: .55rem;
    width: 2px;
    background: var(--md-sys-color-outline-variant);
    content: '';
}

.stock-rule-log {
    position: relative;
    padding: 1rem;
    border: 1px solid var(--md-sys-color-outline-variant);
    border-radius: .85rem;
    background: var(--md-sys-color-surface);
}

.stock-rule-log::before {
    position: absolute;
    top: 1.25rem;
    left: -1.8rem;
    width: .85rem;
    height: .85rem;
    border: 3px solid var(--md-sys-color-surface-container-low);
    border-radius: 50%;
    background: var(--md-sys-color-primary);
    box-shadow: 0 0 0 1px var(--md-sys-color-primary);
    content: '';
}

.stock-rule-log__meta,
.stock-rule-log__actor {
    display: flex;
    align-items: center;
    gap: .65rem;
    flex-wrap: wrap;
}

.stock-rule-log__meta {
    justify-content: space-between;
    margin-bottom: .55rem;
}

.stock-rule-log__meta time {
    color: var(--md-sys-color-on-surface-variant);
    font-size: .85rem;
}

.stock-rule-log__action {
    padding: .25rem .6rem;
    border-radius: 999px;
    color: var(--md-sys-color-on-primary-container);
    background: var(--md-sys-color-primary-container);
    font-size: .82rem;
    font-weight: 700;
}

.stock-rule-log__actor {
    color: var(--md-sys-color-on-surface-variant);
    font-size: .9rem;
}

.stock-rule-log__subject {
    padding-left: .65rem;
    border-left: 1px solid var(--md-sys-color-outline-variant);
}

.stock-rule-log__definition {
    margin-top: .8rem;
    border-top: 1px solid var(--md-sys-color-outline-variant);
    padding-top: .65rem;
}

.stock-rule-log__definition summary {
    color: var(--md-sys-color-primary);
    cursor: pointer;
    font-size: .85rem;
    font-weight: 600;
}

.stock-rule-log__definition pre {
    max-height: 18rem;
    overflow: auto;
    margin: .65rem 0 0;
    padding: .75rem;
    border-radius: .5rem;
    background: var(--md-sys-color-surface-container-low);
    font-size: .78rem;
    white-space: pre-wrap;
}

.stock-rule-summary__title,
.stock-rule-preview__head {
    display: flex;
    align-items: center;
    gap: .5rem;
}

.stock-rule-summary__title {
    color: var(--md-sys-color-primary);
    font-weight: 700;
}

.stock-rule-summary p {
    margin: .65rem 0 0;
    line-height: 1.55;
    color: var(--md-sys-color-on-surface-variant);
}

.stock-rule-preview__head {
    justify-content: space-between;
    align-items: flex-start;
}

.stock-rule-preview h4,
.stock-rule-preview p {
    margin: 0;
}

.stock-rule-preview p {
    margin-top: .25rem;
    color: var(--md-sys-color-on-surface-variant);
}

.stock-rule-preview__result {
    display: flex;
    align-items: baseline;
    gap: .5rem;
    margin: 1rem 0;
}

.stock-rule-preview__result strong {
    font-size: 1.75rem;
    color: var(--md-sys-color-primary);
}

@media (max-width: 700px) {
    .stock-rule-condition {
        grid-template-columns: 1fr;
    }

    .stock-rule-association {
        grid-template-columns: 1.5rem minmax(0, 1fr);
    }

    .stock-rule-association__company,
    .stock-rule-association__existing {
        grid-column: 2;
    }

    .stock-rule-preview__head {
        grid-template-columns: 1fr;
        flex-direction: column;
    }
}

@media (max-width: 600px) {
    .arkiwio-filters__grid {
        grid-template-columns: 1fr;
    }
}

.vehicles-table-wrap {
    overflow: auto;
    max-width: 100%;
    flex: 1 1 auto;
    min-height: 12rem;
}

.vehicles-table {
    width: 100%;
    min-width: 1180px;
    border-collapse: separate;
    border-spacing: 0;
}

.vehicles-table thead th {
    position: sticky;
    top: 0;
    z-index: 2;
    background: #f8fbfe;
    border-bottom: 1px solid var(--md-sys-color-outline-variant);
    padding: 0.75rem 0.9rem;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--md-sys-color-on-surface-variant);
    white-space: nowrap;
    text-align: left;
}

.vehicles-table thead tr.vehicles-col-filters th {
    top: 2.55rem;
    z-index: 1;
    padding: 0.45rem 0.75rem 0.7rem;
    background: #f3f7fb;
    border-bottom: 1px solid var(--md-sys-color-outline-variant);
}

.vehicles-table th.is-sortable {
    cursor: pointer;
    user-select: none;
}

.vehicles-table th.is-sortable:hover,
.vehicles-table th.is-sorted {
    color: var(--md-sys-color-primary);
}

.vehicles-th {
    display: inline-flex;
    align-items: center;
    gap: 0.2rem;
}

.vehicles-th__sort {
    font-size: 1rem;
    opacity: 0.55;
}

.vehicles-table th.is-sorted .vehicles-th__sort {
    opacity: 1;
    color: var(--md-sys-color-primary);
}

.vehicles-col-filter {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    min-height: 2.1rem;
    padding: 0 0.55rem;
    border: 1px solid var(--md-sys-color-outline-variant);
    border-radius: var(--md-sys-shape-corner-xs);
    background: #fff;
    color: var(--md-sys-color-on-surface-variant);
}

.vehicles-col-filter .material-symbols-outlined {
    font-size: 1rem;
}

.vehicles-col-filter input {
    width: 100%;
    min-width: 5rem;
    border: 0;
    outline: none;
    background: transparent;
    font-size: 0.8rem;
    color: var(--md-sys-color-on-surface);
}

.vehicles-table tbody td {
    padding: 0.85rem 0.9rem;
    border-bottom: 1px solid var(--md-sys-color-outline-variant);
    font-size: 0.9rem;
    white-space: nowrap;
    vertical-align: middle;
    background: #fff;
}

.vehicles-table tbody tr:hover td {
    background: rgba(0, 123, 224, 0.035);
}

.vehicles-table tbody tr.is-selected td {
    background: color-mix(in srgb, var(--md-sys-color-primary-container) 55%, #fff);
}

.vehicles-table tbody tr.is-clickable.is-selected:hover td {
    background: color-mix(in srgb, var(--md-sys-color-primary-container) 70%, #fff);
}

.vehicles-table th.vehicles-table__select,
.vehicles-table td.vehicles-table__select {
    position: sticky;
    left: 0;
    width: 2.75rem;
    min-width: 2.75rem;
    max-width: 2.75rem;
    padding-left: 0.65rem;
    padding-right: 0.65rem;
    text-align: center;
    box-shadow: 1px 0 0 var(--md-sys-color-outline-variant);
}

.vehicles-table thead th.vehicles-table__select {
    z-index: 4;
}

.vehicles-table thead tr.vehicles-col-filters th.vehicles-table__select {
    z-index: 3;
}

.vehicles-table tbody td.vehicles-table__select {
    z-index: 1;
}

.vehicles-cell-vehicle {
    display: flex;
    flex-direction: column;
    gap: 0.12rem;
    min-width: 12rem;
    white-space: normal;
}

.vehicles-cell-vehicle strong {
    font-size: 0.92rem;
    font-weight: 700;
    letter-spacing: -0.01em;
}

.vehicles-cell-vehicle span {
    color: var(--md-sys-color-on-surface-variant);
    font-size: 0.8rem;
    line-height: 1.3;
}

/* Marca o modello non classificati nel catalogo: tutta la cella attenuata */
.vehicles-cell-vehicle.is-unclassified strong {
    color: var(--md-sys-color-on-surface-variant);
    font-weight: 600;
}

.vehicles-cell-vehicle__flag {
    margin-left: 0.35rem;
    font-size: 0.7rem;
    font-weight: 500;
    font-style: italic;
    letter-spacing: 0;
    white-space: nowrap;
}

.vehicles-cell-vehicle__raw {
    font-style: italic;
}

/* Flag di marca dalla classify superbrands (es. AMG): chip piccolo e neutro, non è un'etichetta veicolo */
.vehicle-brand-flag {
    display: inline-flex;
    align-items: center;
    margin-left: 0.35rem;
    padding: 0 0.4rem;
    min-height: 1.15rem;
    border: 1px solid var(--md-sys-color-outline-variant);
    border-radius: 999px;
    background: var(--md-sys-color-surface-container-high);
    color: var(--md-sys-color-on-surface-variant);
    font-size: 0.68rem;
    font-weight: 700;
    font-style: normal;
    letter-spacing: 0.02em;
    line-height: 1;
    vertical-align: middle;
    white-space: nowrap;
}

.vehicle-detail__stat-value .vehicle-brand-flag:first-child {
    margin-left: 0;
}

.vehicles-pill {
    display: inline-flex;
    align-items: center;
    min-height: 1.55rem;
    padding: 0 0.6rem;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.01em;
}

.vehicles-pill--success {
    background: rgba(15, 123, 63, 0.12);
    color: var(--md-sys-color-success);
}

.vehicles-pill--danger {
    background: rgba(179, 38, 30, 0.12);
    color: var(--md-sys-color-error);
}

.vehicles-pill--info {
    background: var(--md-sys-color-primary-container);
    color: var(--md-sys-color-on-primary-container);
}

.vehicles-pill--muted {
    background: var(--md-sys-color-secondary-container);
    color: var(--md-sys-color-on-secondary-container);
}

.vehicles-pill--neutral {
    background: var(--md-sys-color-surface-container-high);
    color: var(--md-sys-color-on-surface-variant);
}

.vehicles-tags {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.3rem;
    min-width: 8rem;
    max-width: 14rem;
    white-space: normal;
}

.vehicles-tag-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    max-width: 100%;
    padding: 0.12rem 0.5rem 0.12rem 0.28rem;
    border-radius: 999px;
    background: var(--md-sys-color-surface-container-high);
    color: var(--md-sys-color-on-surface);
    font-size: 0.75rem;
    font-weight: 600;
    line-height: 1.2;
}

.vehicles-tag-chip__swatch {
    width: 0.7rem;
    height: 0.7rem;
    border-radius: 999px;
    flex-shrink: 0;
    border: 1px solid rgba(0, 0, 0, 0.12);
}

.vehicles-tag-chip__name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.vehicles-price {
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

.vehicles-price.is-promo {
    color: var(--md-sys-color-primary);
}

.vehicles-days {
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

.vehicles-days.is-warn {
    color: var(--md-sys-color-warn);
}

.vehicles-days.is-critical {
    color: var(--md-sys-color-error);
}

.vehicles-empty {
    padding: 3rem 1rem;
    text-align: center;
    color: var(--md-sys-color-on-surface-variant);
}

.vehicles-prefs-body {
    gap: 0.85rem;
    overflow: hidden;
}

.vehicles-prefs-split {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.15rem;
    align-items: stretch;
    min-height: 0;
    flex: 1 1 auto;
}

.vehicles-prefs-pane {
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
    min-width: 0;
    min-height: 0;
    padding: 0.85rem 0.9rem;
    border: 1px solid var(--md-sys-color-outline-variant);
    border-radius: var(--md-sys-shape-corner-sm);
    background: var(--md-sys-color-surface-container);
}

.vehicles-prefs-pane .crud-form__section-title {
    margin: 0;
    flex-shrink: 0;
}

.vehicles-prefs-list {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    min-height: 0;
    overflow: auto;
    padding-right: 0.15rem;
}

.vehicles-prefs-item {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    min-height: 2.35rem;
    padding: 0.25rem 0.55rem 0.25rem 0.2rem;
    border: 1px solid transparent;
    border-radius: var(--md-sys-shape-corner-sm);
    background: #fff;
    cursor: grab;
    user-select: none;
    transition: border-color 0.12s ease, background 0.12s ease, opacity 0.12s ease;
}

.vehicles-prefs-item:active {
    cursor: grabbing;
}

.vehicles-prefs-item.is-active {
    border-color: color-mix(in srgb, var(--md-sys-color-primary) 35%, transparent);
    background: var(--md-sys-color-primary-container);
}

.vehicles-prefs-item.is-dragging {
    opacity: 0.55;
}

.vehicles-prefs-item__handle {
    flex-shrink: 0;
    color: var(--md-sys-color-on-surface-variant);
    font-size: 1.15rem;
}

.vehicles-prefs-item .vehicles-check {
    flex: 1;
    min-width: 0;
    min-height: 0;
}

.vehicles-prefs-item .vehicles-check span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

@keyframes fade-in {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes rise-in {
    from { opacity: 0; transform: translateY(10px) scale(0.98); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

/* ── Responsive ──────────────────────────────────────────── */

@media (max-width: 1100px) {
    .dash-grid {
        grid-template-columns: 1fr 1fr;
    }
}

@media (max-width: 900px) {
    .app-nav,
    .app-nav.is-collapsed,
    .app-shell.nav-collapsed .app-nav {
        position: fixed;
        left: 0;
        top: 0;
        width: min(86vw, var(--app-nav-width)) !important;
        min-width: 0 !important;
        max-width: min(86vw, var(--app-nav-width)) !important;
        flex-basis: auto !important;
        transform: translateX(-105%);
        transition: transform 0.22s ease;
        padding: 1rem 0.75rem;
    }

    .app-nav.open {
        transform: translateX(0);
    }

    .app-nav.is-collapsed .nav-item,
    .app-shell.nav-collapsed .nav-item {
        justify-content: flex-start;
        padding: 0 0.7rem;
        width: auto;
    }

    .app-nav.is-collapsed .nav-item__label,
    .app-nav.is-collapsed .nav-flyout,
    .app-shell.nav-collapsed .nav-item__label,
    .app-shell.nav-collapsed .nav-flyout {
        position: static;
        transform: none;
        opacity: 1;
        visibility: visible;
        pointer-events: auto;
        background: transparent;
        box-shadow: none;
        padding: 0;
        color: inherit;
    }

    .app-nav.is-collapsed .brand-logo--full,
    .app-shell.nav-collapsed .brand-logo--full {
        display: block;
        height: 24px;
        width: auto;
    }

    .app-nav.is-collapsed .brand-logo--mark,
    .app-shell.nav-collapsed .brand-logo--mark {
        display: none;
    }

    .app-scrim {
        display: block;
        position: fixed;
        inset: 0;
        background: rgba(0, 0, 0, 0.35);
        opacity: 0;
        pointer-events: none;
        transition: opacity 0.2s ease;
        z-index: 20;
    }

    .app-scrim.visible {
        opacity: 1;
        pointer-events: auto;
    }

    .topbar-user__meta {
        display: none;
    }

    .auth-panel {
        grid-template-columns: 1fr;
    }

    .auth-panel__brand {
        text-align: center;
    }

    .dash-grid,
    .vehicles-filters__grid {
        grid-template-columns: 1fr;
    }

    .vehicles-prefs-split {
        grid-template-columns: 1fr;
    }

    .detail-drawer--prefs,
    .detail-drawer--xl,
    .detail-drawer--xxl {
        --detail-drawer-width: 100vw;
    }

    .dash-hero {
        flex-direction: column;
        align-items: flex-start;
    }
}

/* ── Vehicle detail drawer ───────────────────────────────── */

.vehicle-detail-drawer .detail-drawer__body {
    display: flex;
    flex-direction: column;
    gap: 0;
    padding: 0;
    /* Solo il pannello content scorre: evita che Info (alta) passi sotto le tab sticky. */
    overflow: hidden;
}

.vehicle-detail-drawer .detail-drawer__header.vehicle-detail__header {
    align-items: center;
    gap: 0.75rem 1rem;
    flex-wrap: wrap;
}

.vehicle-detail-drawer .detail-drawer__header h2.vehicle-detail__title {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.15rem;
    flex: 1 1 12rem;
    min-width: 0;
    white-space: normal;
    overflow: visible;
    text-overflow: unset;
    line-height: 1.2;
}

.vehicle-detail-drawer .vehicle-detail__header .vehicle-detail__actions {
    flex: 0 1 auto;
    margin-left: auto;
    justify-content: flex-end;
}

.vehicle-detail-drawer .vehicle-detail__header .vehicle-detail__view-source {
    min-width: 8.5rem;
    max-width: 11rem;
}

.vehicle-detail-drawer .vehicle-detail__header .vehicle-detail__view-source .vehicle-detail__field-label {
    display: none;
}

.vehicle-detail-drawer .vehicle-detail__header .md-field--outline {
    margin: 0;
}

.vehicle-detail-drawer .vehicle-detail__header .vehicle-detail__view-source select {
    min-height: 2.5rem;
    padding-block: 0.35rem;
}

.vehicle-detail__title-main {
    font-size: 1.4rem;
    font-weight: 800;
    letter-spacing: -0.02em;
}

.vehicle-detail__title-version {
    display: block;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--md-sys-color-on-surface-variant);
}

.vehicle-detail__title-main.is-unclassified {
    color: var(--md-sys-color-on-surface-variant);
}

.vehicle-detail__title-flag {
    margin-left: 0.4rem;
    font-size: 0.75rem;
    font-weight: 500;
    font-style: italic;
    color: var(--md-sys-color-on-surface-variant);
}

.vehicle-detail__hero {
    flex-shrink: 0;
    padding: 1rem 1.35rem 0.85rem;
    background:
        linear-gradient(180deg, rgba(0, 123, 224, 0.06) 0%, rgba(0, 123, 224, 0) 100%),
        var(--md-sys-color-surface);
    border-bottom: 1px solid var(--md-sys-color-outline-variant);
}

.vehicle-detail__hero-top {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.85rem 1.25rem;
}

.vehicle-detail__hero-identity {
    display: flex;
    flex-direction: column;
    gap: 0.55rem;
    min-width: 0;
    flex: 1 1 16rem;
}

.vehicle-detail__badges {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    align-items: center;
}

.vehicle-detail__price-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem 1.25rem;
    flex-wrap: wrap;
}

.vehicle-detail__price {
    font-size: 1.75rem;
    font-weight: 800;
    letter-spacing: -0.03em;
    color: var(--md-sys-color-on-surface);
    line-height: 1.1;
}

.vehicle-detail__tags {
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: flex-end;
    margin-left: auto;
    min-width: 0;
    max-width: min(22rem, 100%);
}

/* Scheda veicolo: riga statistiche compatta con pulsante QR code (scheda pubblica) */
.vehicle-detail__stats.vehicle-detail__stats--compact {
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem;
    margin-top: 0.75rem;
}

.vehicle-detail__stats--compact .vehicle-detail__stat {
    flex: 1 1 7.5rem;
    padding: 0.4rem 0.65rem;
}

.vehicle-detail__stats--compact .vehicle-detail__stat-label {
    font-size: 0.62rem;
    margin-bottom: 0.1rem;
}

.vehicle-detail__stats--compact .vehicle-detail__stat-value {
    font-size: 0.88rem;
}

.vehicle-detail__stats--compact .vehicle-detail__qr-btn {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    border: 1px dashed var(--md-sys-color-primary);
    background: var(--md-sys-color-primary-container);
    color: var(--md-sys-color-on-primary-container);
    font: inherit;
    text-align: left;
    cursor: pointer;
    transition: background 0.15s ease;
}

.vehicle-detail__qr-btn:hover,
.vehicle-detail__qr-btn:focus-visible {
    background: #c4e2ff;
}

.vehicle-detail__qr-btn:focus-visible {
    outline: 2px solid rgba(0, 123, 224, 0.28);
}

.vehicle-detail__qr-btn-icon {
    font-size: 1.75rem;
    color: var(--md-sys-color-primary);
}

.vehicle-detail__qr-btn-text {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.vehicle-detail__qr-btn-label {
    font-size: 0.82rem;
    font-weight: 700;
    white-space: nowrap;
}

.vehicle-detail__qr-btn-meta {
    display: inline-flex;
    align-items: center;
    gap: 0.2rem;
    font-size: 0.72rem;
    color: var(--md-sys-color-on-surface-variant);
    white-space: nowrap;
}

.vehicle-detail__qr-btn-warn {
    font-size: 0.95rem;
    color: var(--md-sys-color-warn);
}

/* Dialog QR code */
.md-dialog--qr {
    width: min(100%, 30rem);
}

.vehicle-qr-dialog__header {
    display: flex;
    align-items: flex-start;
    gap: 0.85rem;
}

.vehicle-qr-dialog__header > div {
    flex: 1 1 auto;
    min-width: 0;
}

.vehicle-qr-dialog__header .md-dialog__icon {
    flex: 0 0 auto;
    margin-bottom: 0;
}

.vehicle-qr-dialog__header .md-dialog__title {
    margin-bottom: 0.2rem;
}

.vehicle-qr-dialog__notice {
    margin: 1rem 0 0;
}

.vehicle-qr-dialog__code {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.6rem;
    margin-top: 1.1rem;
}

.vehicle-qr-dialog__image {
    display: block;
    width: 240px;
    height: 240px;
    padding: 0.5rem;
    border: 1px solid var(--md-sys-color-outline-variant);
    border-radius: var(--md-sys-shape-corner-sm);
    background: #fff;
}

.vehicle-qr-dialog__views {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    margin: 0;
    font-size: 0.85rem;
    color: var(--md-sys-color-on-surface-variant);
}

.vehicle-qr-dialog__views .material-symbols-outlined {
    font-size: 1.1rem;
}

.vehicle-qr-dialog__actions {
    justify-content: center;
}

.vehicle-detail__stats {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 0.55rem;
    margin-top: 0.9rem;
}

.vehicle-detail__stat {
    padding: 0.65rem 0.75rem;
    border-radius: var(--md-sys-shape-corner-sm);
    background: #fff;
    border: 1px solid var(--md-sys-color-outline-variant);
    min-width: 0;
}

.vehicle-detail__stat-label {
    display: block;
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--md-sys-color-on-surface-variant);
    margin-bottom: 0.2rem;
}

.vehicle-detail__stat-value {
    display: block;
    font-size: 0.98rem;
    font-weight: 700;
    color: var(--md-sys-color-on-surface);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.vehicle-detail__hero-foot {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.75rem 1rem;
    margin-top: 0.75rem;
    min-height: 2.5rem;
    font-size: 0.75rem;
    color: var(--md-sys-color-on-surface-variant);
}

.vehicle-detail__empty-toggle {
    margin-left: auto;
    min-height: 2.5rem;
    padding-inline: 0.4rem;
    font-size: 0.78rem;
}

.vehicle-detail__empty-toggle.is-placeholder {
    visibility: hidden;
    pointer-events: none;
}

.vehicle-detail__actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: center;
}

.vehicle-detail__view-source {
    min-width: 9.5rem;
    margin: 0;
}

.vehicle-detail__tabs,
.detail-tabs {
    display: flex;
    flex-wrap: nowrap;
    flex-shrink: 0;
    gap: 0;
    padding: 0 1.35rem;
    border-bottom: 1px solid var(--md-sys-color-outline-variant);
    background: #fff;
    position: relative;
    z-index: 2;
    overflow-x: auto;
    overflow-y: hidden;
}

.vehicle-detail__tabs button,
.detail-tabs button {
    border: 0;
    background: transparent;
    padding: 0.75rem 1rem;
    border-radius: 0;
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
    font: inherit;
    font-size: 0.9rem;
    font-weight: 650;
    line-height: 1.25;
    color: var(--md-sys-color-on-surface-variant);
    cursor: pointer;
    white-space: nowrap;
}

.vehicle-detail__tabs button.is-active,
.detail-tabs button.is-active {
    color: var(--md-sys-color-primary);
    border-bottom-color: var(--md-sys-color-primary);
}

.vehicle-detail__tabs button:hover,
.detail-tabs button:hover {
    color: var(--md-sys-color-primary);
    background: rgba(0, 123, 224, 0.04);
}

.vehicle-detail__content {
    padding: 0.85rem 1.35rem 1.75rem;
    overflow: auto;
    flex: 1 1 auto;
    min-height: 0;
    background: var(--md-sys-color-surface-container-low, #f6f8fb);
}

.vehicle-detail__section {
    margin: 0;
}

.vehicle-detail__subsection {
    margin-top: 0.85rem;
    background: #fff;
    border: 1px solid var(--md-sys-color-outline-variant);
    border-radius: var(--md-sys-shape-corner-md);
    overflow: hidden;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}

.vehicle-detail__subsection-toggle {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.8rem 1rem;
    border: 0;
    background: transparent;
    cursor: pointer;
    text-align: left;
}

.vehicle-detail__subsection-toggle:hover {
    background: rgba(0, 123, 224, 0.04);
}

.vehicle-detail__subsection-toggle .material-symbols-outlined {
    color: var(--md-sys-color-on-surface-variant);
}

.vehicle-detail__subsection-title {
    margin: 0;
    font-size: 0.95rem;
    font-weight: 750;
    letter-spacing: -0.01em;
}

.vehicle-detail__fields {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0;
    border-top: 1px solid var(--md-sys-color-outline-variant);
}

.vehicle-detail__field {
    display: grid;
    /* Colonna label fissa (non %): allinea tutte le label; valori partono sulla stessa linea. */
    grid-template-columns: 8.25rem minmax(0, 1fr);
    gap: 0.35rem 0.65rem;
    align-items: start;
    min-width: 0;
    padding: 0.65rem 1rem;
    border-radius: 0;
    background: transparent;
    border-bottom: 1px solid var(--md-sys-color-outline-variant);
}

.vehicle-detail__field:nth-child(odd) {
    border-right: 1px solid var(--md-sys-color-outline-variant);
}

.vehicle-detail__field--wide {
    grid-column: 1 / -1;
    border-right: 0;
}

.vehicle-detail__field.is-empty .vehicle-detail__field-value > span {
    color: var(--md-sys-color-on-surface-variant);
    font-weight: 500;
}

.vehicle-detail__field-label {
    font-size: 0.74rem;
    font-weight: 650;
    text-transform: none;
    letter-spacing: 0;
    color: var(--md-sys-color-on-surface-variant);
    padding-top: 0.15rem;
    line-height: 1.3;
}

.vehicle-detail__field-value {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.65rem;
    font-size: 0.92rem;
    font-weight: 650;
    word-break: break-word;
}

.vehicle-detail__field-value > span {
    min-width: 0;
    flex: 1 1 auto;
}

.vehicle-detail__field-value input,
.vehicle-detail__field-value textarea,
.vehicle-detail__field-value select {
    width: 100%;
    font: inherit;
    font-weight: 500;
    padding: 0.4rem 0.55rem;
    border: 1px solid var(--md-sys-color-outline);
    border-radius: var(--md-sys-shape-corner-xs);
    background: #fff;
}

.vehicle-detail__field-value > textarea,
.vehicle-detail__field-value > select {
    flex: 1 1 14rem;
    width: auto;
    min-width: 0;
}

.vehicle-detail__field.has-manual-override {
    background: color-mix(in srgb, var(--md-sys-color-primary) 3%, transparent);
}

.vehicle-detail__field.is-pending-reset {
    background: color-mix(in srgb, var(--md-sys-color-tertiary) 7%, transparent);
}

.vehicle-detail__manual-badge {
    display: block;
    width: fit-content;
    margin-top: 0.25rem;
    padding: 0.08rem 0.35rem;
    border-radius: 999px;
    color: var(--md-sys-color-primary);
    background: color-mix(in srgb, var(--md-sys-color-primary) 10%, transparent);
    font-size: 0.58rem;
    font-weight: 750;
    letter-spacing: 0.025em;
    text-transform: uppercase;
}

.vehicle-detail__manual-reset {
    flex: 0 0 auto;
}

.vehicle-detail__fallback-preview {
    display: flex;
    flex: 1 1 14rem;
    min-width: 0;
    align-items: center;
    gap: 0.5rem;
}

.vehicle-detail__fallback-preview > span:first-child {
    min-width: 0;
    flex: 1 1 auto;
}

.vehicle-detail__fallback-preview .vehicle-detail__prov {
    cursor: default;
    margin-left: 0;
}

.vehicle-detail__fallback-empty,
.vehicle-detail__pending-label {
    color: var(--md-sys-color-on-surface-variant);
    font-size: 0.7rem;
    font-weight: 650;
}

.vehicle-detail__pending-label {
    flex: 1 0 100%;
}

.vehicle-detail__json-editor {
    min-height: 7rem;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace !important;
    font-size: 0.78rem !important;
}

.vehicle-detail__field.is-invalid textarea,
.vehicle-detail__field.is-invalid select {
    border-color: var(--md-sys-color-error);
}

.vehicle-detail__field-error {
    flex: 1 0 100%;
    color: var(--md-sys-color-error);
    font-size: 0.72rem;
    font-weight: 650;
}

.vehicle-detail__json {
    margin: 0;
    flex: 1 1 auto;
    min-width: 0;
    max-height: 14rem;
    overflow: auto;
    padding: 0.45rem 0.55rem;
    border-radius: var(--md-sys-shape-corner-xs);
    background: var(--md-sys-color-surface-container);
    border: 1px solid var(--md-sys-color-outline-variant);
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    font-size: 0.75rem;
    font-weight: 500;
    white-space: pre-wrap;
    word-break: break-word;
}

.vehicle-detail__system-meta {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.65rem 1rem;
    margin-bottom: 1rem;
}

.vehicle-detail__prov {
    display: inline-flex;
    align-items: center;
    flex: 0 0 auto;
    margin-left: auto;
    min-height: 1.2rem;
    padding: 0 0.4rem;
    border: 0;
    border-radius: 999px;
    background: transparent;
    color: var(--md-sys-color-on-surface-variant);
    font-size: 0.65rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    text-transform: uppercase;
    cursor: pointer;
    opacity: 0.75;
}

.vehicle-detail__prov:hover {
    opacity: 1;
    background: rgba(0, 123, 224, 0.08);
    color: var(--md-sys-color-primary);
}

.vehicle-detail__prov.is-manual {
    color: var(--md-sys-color-success);
}

.vehicle-detail__prov.is-manual:hover {
    background: rgba(15, 123, 63, 0.1);
}

.vehicle-detail__compare {
    grid-column: 1 / -1;
    margin: 0.15rem 0 0.25rem;
    padding: 0.55rem 0.65rem;
    border-radius: var(--md-sys-shape-corner-sm);
    background: var(--md-sys-color-surface-container);
    border: 1px solid var(--md-sys-color-outline-variant);
    font-size: 0.8rem;
}

.vehicle-detail__compare-row {
    display: flex;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.2rem 0;
}

.vehicle-detail__compare-row.is-winner {
    font-weight: 700;
    color: var(--md-sys-color-primary);
}

.vehicle-detail__images {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(16rem, 1fr));
    gap: 1rem;
}

.vehicle-detail__image-card {
    display: flex;
    flex-direction: column;
    min-width: 0;
    background: #fff;
    border: 1px solid var(--md-sys-color-outline-variant);
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 8px 28px rgba(15, 23, 42, 0.06);
}

.vehicle-detail__image-card.is-hidden {
    opacity: 0.58;
}

.vehicle-detail__image {
    position: relative;
    aspect-ratio: 4 / 3;
    background: var(--md-sys-color-surface-container-high);
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.vehicle-detail__image:hover {
    filter: brightness(0.97);
}

.vehicle-detail__image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.vehicle-detail__image-caption {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    padding: 0.65rem 0.75rem 0.75rem;
}

.vehicle-detail__image-caption span {
    font-size: 0.8rem;
    color: var(--md-sys-color-on-surface-variant);
}

.vehicle-detail__image-caption span:first-child {
    color: var(--md-sys-color-on-surface);
    font-weight: 600;
}

.vehicle-detail__image-caption .md-chip {
    align-self: flex-start;
    width: fit-content;
    margin-top: 0.2rem;
    color: var(--md-sys-color-on-surface);
    font-weight: 600;
}

.vehicle-detail__optionals {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 1rem;
    align-items: stretch;
}

.vehicle-detail__opt-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.65rem;
    min-height: 16rem;
    padding: 2rem 1rem;
    border-radius: var(--md-sys-shape-corner-md);
    background: #fff;
    border: 1px solid var(--md-sys-color-outline-variant);
    color: var(--md-sys-color-on-surface-variant);
    font-weight: 600;
}

.vehicle-detail__opt-loading .material-symbols-outlined {
    font-size: 1.6rem;
    color: var(--md-sys-color-primary);
    animation: vehicle-detail-opt-spin 0.9s linear infinite;
}

@keyframes vehicle-detail-opt-spin {
    to { transform: rotate(360deg); }
}

.vehicle-detail__opt-board {
    display: flex;
    flex-direction: column;
    min-width: 0;
    min-height: 22rem;
    background: #fff;
    border: 1px solid var(--md-sys-color-outline-variant);
    border-radius: 20px;
    overflow: hidden;
    box-shadow: 0 8px 28px rgba(15, 23, 42, 0.06);
}

.vehicle-detail__subsection.vehicle-detail__opt-board {
    min-height: 0;
    margin-top: 0.85rem;
}

.vehicle-detail__subsection.vehicle-detail__opt-board:first-child {
    margin-top: 0;
}

.vehicle-detail__opt-head {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.75rem 0.85rem;
    padding: 1rem 1rem 0.9rem;
    background:
        linear-gradient(165deg, rgba(0, 123, 224, 0.12) 0%, rgba(0, 123, 224, 0) 62%),
        #fff;
    border-bottom: 1px solid var(--md-sys-color-outline-variant);
}

.vehicle-detail__opt-board--eurotax .vehicle-detail__opt-head {
    background:
        linear-gradient(165deg, rgba(14, 90, 168, 0.14) 0%, rgba(0, 123, 224, 0) 62%),
        #fff;
}

.vehicle-detail__opt-board--manual .vehicle-detail__opt-head {
    background:
        linear-gradient(165deg, rgba(17, 17, 17, 0.06) 0%, rgba(0, 123, 224, 0.04) 100%),
        #fff;
}

.vehicle-detail__opt-icon {
    display: grid;
    place-items: center;
    width: 2.6rem;
    height: 2.6rem;
    border-radius: 14px;
    background: var(--md-sys-color-primary);
    color: #fff;
    flex: 0 0 auto;
}

.vehicle-detail__opt-board--eurotax .vehicle-detail__opt-icon {
    background: #0b5cad;
}

.vehicle-detail__opt-board--manual .vehicle-detail__opt-icon {
    background: #1c1c1c;
}

.vehicle-detail__opt-icon .material-symbols-outlined {
    font-size: 1.35rem;
}

.vehicle-detail__opt-identity {
    min-width: 0;
    flex: 1 1 8rem;
}

.vehicle-detail__opt-title {
    margin: 0;
    font-size: 1.02rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    line-height: 1.15;
}

.vehicle-detail__opt-meta {
    margin: 0.18rem 0 0;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--md-sys-color-on-surface-variant);
}

.vehicle-detail__opt-total {
    margin-left: auto;
    font-size: 1.85rem;
    font-weight: 800;
    letter-spacing: -0.04em;
    line-height: 1;
    color: var(--md-sys-color-primary);
}

.vehicle-detail__opt-add {
    flex: 0 0 auto;
}

.vehicle-detail__opt-tabs {
    display: flex;
    gap: 0.2rem;
    margin: 0.8rem 0.85rem 0.35rem;
    padding: 0.22rem;
    border-radius: 999px;
    background: var(--md-sys-color-surface-container-low, #f3f5f8);
}

.vehicle-detail__opt-tab {
    flex: 1 1 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    min-height: 2.05rem;
    padding: 0.25rem 0.55rem;
    border: 0;
    border-radius: 999px;
    background: transparent;
    color: var(--md-sys-color-on-surface-variant);
    font: inherit;
    font-size: 0.78rem;
    font-weight: 700;
    cursor: pointer;
}

.vehicle-detail__opt-tab.is-active {
    background: #fff;
    color: var(--md-sys-color-primary);
    box-shadow: 0 1px 4px rgba(15, 23, 42, 0.1);
}

.vehicle-detail__opt-tab-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 1.35rem;
    height: 1.2rem;
    padding: 0 0.35rem;
    border-radius: 999px;
    background: rgba(0, 123, 224, 0.1);
    font-size: 0.68rem;
    font-variant-numeric: tabular-nums;
}

.vehicle-detail__opt-tab.is-active .vehicle-detail__opt-tab-count {
    background: var(--md-sys-color-primary);
    color: #fff;
}

.vehicle-detail__opt-list {
    list-style: none;
    margin: 0;
    padding: 0.35rem 0.65rem 0.85rem;
    overflow: auto;
    max-height: min(52vh, 36rem);
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.vehicle-detail__opt-card {
    display: flex;
    align-items: flex-start;
    gap: 0.7rem;
    padding: 0.7rem 0.75rem;
    border-radius: 14px;
    background: var(--md-sys-color-surface-container-low, #f6f8fb);
    border: 1px solid transparent;
    transition: border-color 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
}

.vehicle-detail__opt-card:hover {
    background: #fff;
    border-color: color-mix(in srgb, var(--md-sys-color-primary) 28%, var(--md-sys-color-outline-variant));
    box-shadow: 0 6px 18px rgba(0, 123, 224, 0.08);
}

.vehicle-detail__opt-card.is-matched {
    background: color-mix(in srgb, rgba(15, 123, 63, 0.08) 70%, #fff);
}

.vehicle-detail__opt-card.is-covered {
    opacity: 0.4;
}

.vehicle-detail__opt-card.is-covered:hover {
    opacity: 0.72;
}

.vehicle-detail__opt-card-main {
    min-width: 0;
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.28rem;
}

.vehicle-detail__opt-code {
    display: inline-flex;
    align-items: center;
    max-width: 100%;
    padding: 0.12rem 0.42rem;
    border-radius: 6px;
    background: rgba(0, 123, 224, 0.1);
    color: var(--md-sys-color-primary);
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    line-height: 1.35;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.vehicle-detail__opt-desc {
    margin: 0;
    font-size: 0.88rem;
    font-weight: 600;
    line-height: 1.35;
    color: var(--md-sys-color-on-surface);
}

.vehicle-detail__opt-match {
    display: inline-flex;
    align-items: center;
    gap: 0.2rem;
    min-height: 1.3rem;
    padding: 0 0.45rem 0 0.28rem;
    border-radius: 999px;
    background: rgba(15, 123, 63, 0.12);
    color: #0f7b3f;
    font-size: 0.65rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.vehicle-detail__opt-match .material-symbols-outlined {
    font-size: 0.95rem;
}

.vehicle-detail__opt-price {
    flex: 0 0 auto;
    margin-top: 0.15rem;
    font-size: 0.9rem;
    font-weight: 800;
    font-variant-numeric: tabular-nums;
    letter-spacing: -0.02em;
    white-space: nowrap;
    color: var(--md-sys-color-primary);
}

.vehicle-detail__opt-card--note {
    align-items: center;
}

.vehicle-detail__opt-note-icon {
    display: grid;
    place-items: center;
    width: 2rem;
    height: 2rem;
    border-radius: 10px;
    background: rgba(0, 123, 224, 0.1);
    color: var(--md-sys-color-primary);
    flex: 0 0 auto;
}

.vehicle-detail__opt-note-icon .material-symbols-outlined {
    font-size: 1.15rem;
}

.vehicle-detail__opt-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    flex: 1;
    padding: 2.4rem 1.1rem;
    text-align: center;
    color: var(--md-sys-color-on-surface-variant);
}

.vehicle-detail__opt-empty .material-symbols-outlined {
    font-size: 2.4rem;
    opacity: 0.38;
}

.vehicle-detail__opt-empty p {
    margin: 0;
    font-size: 0.88rem;
    font-weight: 600;
}

.vehicle-detail__opt-empty-hint {
    max-width: 16rem;
    font-size: 0.78rem !important;
    font-weight: 500 !important;
    line-height: 1.4;
}

.vehicle-detail__opt-empty .md-btn {
    margin-top: 0.55rem;
}

.vehicle-detail__opt-composer {
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
    margin: 0.85rem 0.85rem 0.35rem;
    padding: 0.9rem;
    border-radius: 16px;
    border: 1px dashed color-mix(in srgb, var(--md-sys-color-primary) 45%, var(--md-sys-color-outline-variant));
    background: color-mix(in srgb, var(--md-sys-color-primary-container) 45%, #fff);
}

.vehicle-detail__opt-composer-label {
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--md-sys-color-on-surface-variant);
}

.vehicle-detail__opt-composer textarea {
    width: 100%;
    min-height: 5rem;
    padding: 0.75rem 0.85rem;
    border: 1px solid var(--md-sys-color-outline-variant);
    border-radius: 12px;
    background: #fff;
    font: inherit;
    font-size: 0.92rem;
    line-height: 1.4;
    resize: vertical;
}

.vehicle-detail__opt-composer textarea:focus {
    outline: none;
    border-color: var(--md-sys-color-primary);
    box-shadow: 0 0 0 3px rgba(0, 123, 224, 0.16);
}

.vehicle-detail__opt-composer-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
}

.vehicle-detail__subsection-head {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.65rem 1rem;
    padding: 0.8rem 1rem;
    border-bottom: 1px solid var(--md-sys-color-outline-variant);
}

.vehicle-detail__subsection-head .vehicle-detail__subsection-title {
    margin: 0;
}

.vehicle-detail__subsection > .vehicles-empty {
    margin: 0;
    padding: 1.1rem 1rem;
}

.vehicle-detail__booking-form {
    padding: 1.15rem 1rem 1rem;
    border-bottom: 1px solid var(--md-sys-color-outline-variant);
    background: var(--md-sys-color-surface-container-low, #f6f8fb);
    --md-field-outline-label-bg: var(--md-sys-color-surface-container-low, #f6f8fb);
}

.vehicle-detail__booking-fields {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1.15rem 1rem;
    margin: 1rem 0 1rem;
}

.vehicle-detail__booking-form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
}

.vehicle-detail__booking-fields .js-booking-end-picker {
    cursor: pointer;
}

.vc {
    --vc-date-selected-bg: var(--md-sys-color-primary, #007be0);
    --vc-date-selected-color: #fff;
    --vc-date-today-color: var(--md-sys-color-primary, #007be0);
    --vc-months-years-bg-selected: var(--md-sys-color-primary, #007be0);
    --vc-focus-outline-color: var(--md-sys-color-primary, #007be0);
    --vc-time-input-bg-hover: rgba(0, 123, 224, 0.12);
    z-index: 70;
    font-family: inherit;
    border-radius: 16px;
}

.vc[data-vc-input] {
    z-index: 70;
}

.vehicle-detail__booking-history {
    display: flex;
    flex-direction: column;
}

.vehicle-detail__booking-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.45rem 1rem;
    padding: 0.8rem 1rem;
    border-top: 1px solid var(--md-sys-color-outline-variant);
}

.vehicle-detail__booking-row:first-child {
    border-top: 0;
}

.vehicle-detail__booking-row-main {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    min-width: 0;
}

.vehicle-detail__booking-row-main strong {
    font-size: 0.92rem;
}

.vehicle-detail__booking-row-main span,
.vehicle-detail__booking-row-meta {
    font-size: 0.82rem;
    color: var(--md-sys-color-on-surface-variant);
}

.vehicle-detail__booking-row-meta {
    display: inline-flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.45rem 0.65rem;
}

@media (max-width: 900px) {
    .vehicle-detail__fields,
    .vehicle-detail__system-meta,
    .vehicle-detail__stats {
        grid-template-columns: 1fr 1fr;
    }

    .vehicle-detail__optionals {
        grid-template-columns: 1fr;
    }

    .vehicle-detail__field,
    .vehicle-detail__field:nth-child(odd) {
        grid-template-columns: 1fr;
        border-right: 0;
    }

    .vehicle-detail__price {
        font-size: 1.45rem;
    }

    .vehicle-detail__booking-fields {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 560px) {
    .vehicle-detail__stats {
        grid-template-columns: 1fr;
    }
}

/* ── Settings / resolution rules ─────────────────────────── */

.visually-hidden {
    position: absolute !important;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.settings-page,
.resolution-page {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.settings-card,
.settings-empty {
    padding: 1.15rem 1.25rem;
    border-radius: var(--md-sys-shape-corner-md);
    border: 1px solid var(--md-sys-color-outline-variant);
}

.settings-card__header {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.85rem 1rem;
    margin-bottom: 1rem;
}

.settings-card__header h3,
.settings-empty h3 {
    margin: 0 0 0.35rem;
    font-size: 1.1rem;
    font-weight: 750;
}

.settings-card__help,
.settings-empty p,
.settings-row__text p {
    margin: 0;
    color: var(--md-sys-color-on-surface-variant);
    font-size: 0.88rem;
    line-height: 1.4;
}

.settings-empty {
    text-align: center;
    padding: 2.5rem 1.5rem;
}

.settings-empty__icon {
    font-size: 2.5rem;
    color: var(--md-sys-color-primary);
    margin-bottom: 0.5rem;
}

.settings-layer-row,
.settings-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem 1rem;
    padding: 0.85rem 0;
    border-top: 1px solid var(--md-sys-color-outline-variant);
}

.settings-layer-row:first-child,
.settings-row:first-child {
    border-top: 0;
    padding-top: 0;
}

/* Sagome per lo scatto dall'App (Personalizzazioni Plus) */
.settings-overlay__families {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin: 0.25rem 0 0.75rem;
}

.settings-overlay__family {
    border: 1px solid var(--md-sys-color-outline-variant);
    background: transparent;
    color: var(--md-sys-color-on-surface);
    border-radius: 999px;
    padding: 0.35rem 0.85rem;
    font: inherit;
    font-size: 0.85rem;
    cursor: pointer;
}

.settings-overlay__family.is-active {
    background: var(--md-sys-color-primary-container);
    color: var(--md-sys-color-on-primary-container);
    border-color: transparent;
}

.settings-overlay__section {
    margin: 1rem 0 0.5rem;
    font-size: 0.95rem;
}

.settings-overlay__grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 0.75rem;
}

.settings-overlay {
    border: 1px solid var(--md-sys-color-outline-variant);
    border-radius: 14px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    background: var(--md-sys-color-surface);
}

.settings-overlay__preview {
    aspect-ratio: 4 / 3;
    background: #5b6b7c;
    display: flex;
    align-items: center;
    justify-content: center;
}

.settings-overlay__preview img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.settings-overlay__preview--large {
    border-radius: 12px;
    margin: 0.75rem 0;
}

.settings-overlay__empty {
    color: rgba(255, 255, 255, 0.8);
    font-size: 0.85rem;
    text-align: center;
    padding: 0 1rem;
}

.settings-overlay__meta {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    padding: 0.6rem 0.75rem 0;
}

.settings-overlay__status {
    font-size: 0.78rem;
    color: var(--md-sys-color-on-surface-variant);
}

.settings-overlay__status--custom {
    color: var(--md-sys-color-primary);
    font-weight: 600;
}

.settings-overlay__status--empty {
    color: var(--md-sys-color-error);
}

.settings-overlay__actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.15rem;
    padding: 0.35rem 0.4rem 0.5rem;
}

.settings-overlay__actions--end {
    justify-content: flex-end;
    gap: 0.5rem;
}

.settings-overlay__actions .is-disabled {
    opacity: 0.5;
    pointer-events: none;
}

/* Foto dall'App (Personalizzazioni): limite e template di scatto */
.settings-photo-max .md-input {
    width: 6rem;
    text-align: right;
}

.settings-photo-tabs {
    margin: 1rem 0 0.75rem;
}

.settings-photo-shots {
    list-style: none;
    margin: 0.5rem 0 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.settings-photo-shot {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.55rem 0.75rem;
    border: 1px solid var(--md-sys-color-outline-variant);
    border-radius: 12px;
    background: var(--md-sys-color-surface);
}

.settings-photo-shot.is-off {
    background: transparent;
    border-style: dashed;
}

.settings-photo-shot.is-off .settings-photo-shot__meta {
    opacity: 0.6;
}

.settings-photo-shot.sortable-ghost {
    opacity: 0.4;
}

.settings-photo-shot__handle {
    cursor: grab;
    color: var(--md-sys-color-on-surface-variant);
}

.settings-photo-shot__handle-space {
    width: 24px;
    flex: none;
}

.settings-photo-shot__pos {
    min-width: 1.75rem;
    font-weight: 600;
    text-align: center;
    color: var(--md-sys-color-primary);
}

.settings-photo-shot__meta {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.settings-photo-shot__meta span {
    font-size: 0.82rem;
    color: var(--md-sys-color-on-surface-variant);
}

.settings-photo-shot__tags {
    display: flex;
    gap: 0.35rem;
    flex-wrap: wrap;
}

.settings-photo-shot__tag {
    font-size: 0.75rem;
    padding: 0.1rem 0.5rem;
    border-radius: 999px;
    background: var(--md-sys-color-surface-container-high, var(--md-sys-color-surface-variant));
    color: var(--md-sys-color-on-surface-variant);
}

.settings-photo-shot__tag--accent {
    background: var(--md-sys-color-primary-container);
    color: var(--md-sys-color-on-primary-container);
}

.settings-photo-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-top: 0.75rem;
}

@media (max-width: 640px) {
    .settings-photo-shot__tags {
        display: none;
    }
}

/* Colori scheda pubblica (Personalizzazioni) */
.settings-color {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* Stessa altezza, bordo e raggio dei campi .md-field */
.settings-color__swatch {
    width: 44px;
    height: 44px;
    padding: 4px;
    border: 1px solid var(--md-sys-color-outline);
    border-radius: var(--md-sys-shape-corner-sm);
    background: #fff;
    cursor: pointer;
}

.settings-color__swatch::-webkit-color-swatch-wrapper {
    padding: 0;
}

.settings-color__swatch::-webkit-color-swatch {
    border: 0;
    border-radius: calc(var(--md-sys-shape-corner-sm) - 3px);
}

.settings-color__swatch::-moz-color-swatch {
    border: 0;
    border-radius: calc(var(--md-sys-shape-corner-sm) - 3px);
}

.settings-color__swatch:focus-visible {
    outline: 2px solid rgba(0, 123, 224, 0.28);
    border-color: var(--md-sys-color-primary);
}

.settings-color__hex input {
    width: 7.5rem;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    text-transform: lowercase;
}

.settings-string input {
    width: 24rem;
    max-width: 100%;
}

@media (max-width: 700px) {
    .settings-string,
    .settings-string input {
        width: 100%;
    }
}

.settings-color__warning {
    margin: 0.75rem 0 0;
}

/* Riga con descrizione lunga sotto il titolo (es. box Funzionalità) */
.settings-layer-row__meta.settings-layer-row__meta--stacked {
    flex: 1 1 18rem;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.2rem;
    max-width: 48rem;
}

.settings-public-preview {
    margin-top: 1rem;
}

.settings-public-preview__label {
    margin: 0 0 0.5rem;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--md-sys-color-on-surface-variant);
}

.settings-public-preview__page {
    max-width: 320px;
    border: 1px solid var(--md-sys-color-outline-variant);
    border-radius: 16px;
    overflow: hidden;
    background: var(--pp-background);
}

.settings-public-preview__header {
    padding: 0.7rem;
    text-align: center;
    font-weight: 800;
    letter-spacing: 0.2em;
    background: var(--pp-header);
    color: var(--pp-on-header);
}

.settings-public-preview__card {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    margin: 0.75rem;
    padding: 0.9rem;
    border-radius: 12px;
    background: #ffffff;
    color: var(--pp-text);
}

.settings-public-preview__title {
    font-size: 1.05rem;
}

.settings-public-preview__subtitle {
    font-size: 0.8rem;
    color: var(--pp-text-muted);
}

.settings-public-preview__chips {
    display: flex;
    gap: 0.35rem;
}

.settings-public-preview__chips span {
    padding: 0.15rem 0.55rem;
    border-radius: 999px;
    background: var(--pp-primary-soft);
    font-size: 0.72rem;
    font-weight: 600;
}

.settings-public-preview__price {
    font-size: 1.35rem;
    font-weight: 800;
    color: var(--pp-primary);
}

.settings-public-preview__price s {
    font-size: 0.8rem;
    font-weight: 400;
    color: var(--pp-text-muted);
}

.settings-public-preview__button {
    margin-top: 0.25rem;
    padding: 0.55rem;
    border-radius: 999px;
    text-align: center;
    font-weight: 700;
    background: var(--pp-primary);
    color: var(--pp-on-primary);
}

.settings-public-preview__footer {
    padding: 0 0.75rem 0.75rem;
    text-align: center;
    font-size: 0.7rem;
    color: var(--pp-on-background);
}

.settings-layer-row__meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
}

.settings-layer-row.is-locked {
    opacity: 0.85;
}

.settings-eurotax__grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem;
    margin: 1rem 0;
}

.settings-eurotax__plate-row {
    margin: 0.35rem 0 1rem;
}

.settings-eurotax__plate-row .settings-layer-row__meta {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.2rem;
}

/* Eurotax: titoletto «Funzionalità» tra l'accordion delle famiglie e la riga ricerca per targa */
.settings-eurotax__section-title {
    margin: 1.25rem 0 0.35rem;
    font-size: 0.95rem;
}

/* Famiglie abilitate: accordion chiuso di default, nel riepilogo il conteggio */
.settings-eurotax__families {
    margin-top: 1rem;
    border: 1px solid var(--md-sys-color-outline-variant);
    border-radius: var(--md-sys-shape-corner-sm);
    padding: 0 0.75rem;
}

.settings-eurotax__families[open] {
    padding-bottom: 0.5rem;
}

.settings-eurotax__families-summary {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.65rem 0;
    cursor: pointer;
    list-style: none;
    user-select: none;
}

.settings-eurotax__families-summary::-webkit-details-marker {
    display: none;
}

.settings-eurotax__families-summary h4 {
    margin: 0;
    font-size: 0.95rem;
}

.settings-eurotax__families-chevron {
    font-size: 1.25rem;
    color: var(--md-sys-color-on-surface-variant);
    transition: transform 0.15s ease;
}

.settings-eurotax__families[open] .settings-eurotax__families-chevron {
    transform: rotate(90deg);
}

.settings-eurotax__families-summary:focus-visible {
    outline: 2px solid var(--md-sys-color-primary);
    outline-offset: 2px;
    border-radius: 4px;
}

.settings-eurotax__status {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem 1rem;
    margin-top: 1rem;
    padding: 0.8rem;
    border-radius: var(--md-sys-shape-corner-sm);
    background: var(--md-sys-color-surface-container);
    color: var(--md-sys-color-on-surface-variant);
    font-size: 0.86rem;
}

.settings-eurotax__actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 0.65rem;
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--md-sys-color-outline-variant);
}

@media (max-width: 700px) {
    .settings-eurotax__grid {
        grid-template-columns: 1fr;
    }
}

.settings-row__text {
    min-width: 0;
    flex: 1 1 12rem;
}

.settings-row__text strong {
    display: block;
}

.settings-row__control {
    flex: 0 0 auto;
}

/* Card Import/export XLS: sezioni Export e Import */
.settings-xls {
    display: flex;
    flex-direction: column;
}

.settings-xls__group + .settings-xls__group {
    margin-top: 0.25rem;
    padding-top: 1rem;
    border-top: 1px solid var(--md-sys-color-outline-variant);
}

.settings-xls__heading {
    display: flex;
    align-items: flex-start;
    gap: 0.65rem;
}

.settings-xls__heading > .material-symbols-outlined {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    flex-shrink: 0;
    border-radius: 999px;
    background: var(--md-sys-color-primary-container);
    color: var(--md-sys-color-on-primary-container);
    font-size: 1.15rem;
}

.settings-xls__heading h4 {
    margin: 0 0 0.2rem;
    font-size: 0.98rem;
    font-weight: 700;
}

.settings-xls__heading p {
    margin: 0;
    color: var(--md-sys-color-on-surface-variant);
    font-size: 0.85rem;
    line-height: 1.4;
}

/* Box Retention: una riga per dato conservato (testo a sinistra, giorni a destra) */
.settings-retention__row .settings-row__text {
    flex: 1 1 22rem;
    max-width: 48rem;
}

.settings-retention__row .settings-row__text strong {
    margin-bottom: 0.2rem;
}

.settings-retention__control {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 0.3rem;
}

.settings-retention__input {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.settings-retention__input .md-input {
    width: 7.5rem;
    height: 2.75rem;
    padding: 0 0.85rem;
    border: 1px solid var(--md-sys-color-outline);
    border-radius: var(--md-sys-shape-corner-xs);
    background: #fff;
    color: var(--md-sys-color-on-surface);
    font: inherit;
    font-size: 1rem;
    font-variant-numeric: tabular-nums;
    text-align: right;
}

.settings-retention__input .md-input:focus {
    outline: none;
    border-color: var(--md-sys-color-primary);
    box-shadow: inset 0 0 0 1px var(--md-sys-color-primary);
}

.settings-retention__input span {
    color: var(--md-sys-color-on-surface-variant);
    font-weight: 600;
}

.settings-retention__hint {
    color: var(--md-sys-color-on-surface-variant);
    font-size: 0.78rem;
}

@media (max-width: 700px) {
    .settings-retention__control {
        align-items: flex-start;
    }
}

.settings-json {
    margin: 0;
    max-width: 22rem;
    padding: 0.45rem 0.55rem;
    border-radius: var(--md-sys-shape-corner-xs);
    background: var(--md-sys-color-surface-container);
    font-size: 0.75rem;
    white-space: pre-wrap;
}

.resolution-layout {
    display: grid;
    grid-template-columns: minmax(16rem, 22rem) minmax(0, 1fr);
    gap: 1rem;
    align-items: start;
}

.resolution-sidebar,
.resolution-main {
    border: 1px solid var(--md-sys-color-outline-variant);
    border-radius: var(--md-sys-shape-corner-md);
    background: #fff;
    min-height: 28rem;
}

.resolution-sidebar {
    padding: 0.85rem;
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
}

.resolution-sidebar__toolbar {
    margin-bottom: 0.35rem;
}

.resolution-sidebar__search {
    margin: 0.25rem 0 0.35rem;
}

.resolution-sidebar__empty {
    margin: 0.75rem 0.25rem;
    color: var(--md-sys-color-on-surface-variant);
    font-size: 0.85rem;
}

.resolution-nav-item {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.2rem;
    width: 100%;
    text-align: left;
    border: 1px solid transparent;
    background: transparent;
    border-radius: var(--md-sys-shape-corner-sm);
    padding: 0.65rem 0.75rem;
    cursor: pointer;
    font: inherit;
}

.resolution-nav-item:hover,
.resolution-nav-item.is-active {
    background: rgba(0, 123, 224, 0.08);
    border-color: rgba(0, 123, 224, 0.18);
}

.resolution-nav-item__title {
    font-weight: 700;
    font-size: 0.92rem;
}

.resolution-nav-item__code {
    font-size: 0.75rem;
    color: var(--md-sys-color-on-surface-variant);
}

.resolution-main {
    padding: 1rem 1.15rem 1.25rem;
}

.resolution-main__header {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 0.85rem 1rem;
    margin-bottom: 1rem;
}

.resolution-main__header h3 {
    margin: 0 0 0.3rem;
    font-size: 1.15rem;
    font-weight: 750;
}

.resolution-main__hint {
    margin: 0;
    color: var(--md-sys-color-on-surface-variant);
    font-size: 0.88rem;
}

.resolution-main__actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: center;
}

.resolution-order {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.resolution-order__item {
    display: grid;
    grid-template-columns: auto auto minmax(0, 1fr) auto auto;
    align-items: center;
    gap: 0.55rem 0.65rem;
    padding: 0.7rem 0.8rem;
    border: 1px solid var(--md-sys-color-outline-variant);
    border-radius: var(--md-sys-shape-corner-sm);
    background: var(--md-sys-color-surface-container-low, #f6f8fb);
}

.resolution-order__handle {
    cursor: grab;
    color: var(--md-sys-color-on-surface-variant);
    user-select: none;
}

.resolution-order__rank {
    display: inline-grid;
    place-items: center;
    min-width: 1.6rem;
    height: 1.6rem;
    border-radius: 999px;
    background: rgba(0, 123, 224, 0.12);
    color: var(--md-sys-color-primary);
    font-size: 0.78rem;
    font-weight: 800;
}

.resolution-order__label {
    font-weight: 700;
}

.resolution-order__code {
    font-size: 0.75rem;
    color: var(--md-sys-color-on-surface-variant);
}

.resolution-order__move {
    display: inline-flex;
    gap: 0.15rem;
}

.resolution-add-list {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    margin-top: 0.85rem;
    max-height: min(60vh, 28rem);
    overflow: auto;
}

.resolution-add-item {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.15rem;
    width: 100%;
    text-align: left;
    border: 1px solid var(--md-sys-color-outline-variant);
    border-radius: var(--md-sys-shape-corner-sm);
    background: #fff;
    padding: 0.7rem 0.8rem;
    cursor: pointer;
    font: inherit;
}

.resolution-add-item:hover {
    border-color: var(--md-sys-color-primary);
    background: rgba(0, 123, 224, 0.04);
}

.resolution-recompute {
    margin: 0;
}

.resolution-recompute .settings-card__header {
    margin-bottom: 0.75rem;
}

.resolution-recompute .md-alert {
    margin-bottom: 0;
}

.resolution-recompute__last {
    margin: 0;
    color: var(--md-sys-color-on-surface-variant);
    font-size: 0.88rem;
    line-height: 1.4;
}

.resolution-recompute__spin {
    animation: resolution-recompute-spin 1s linear infinite;
}

@keyframes resolution-recompute-spin {
    to {
        transform: rotate(360deg);
    }
}

.resolution-add-item span {
    font-size: 0.78rem;
    color: var(--md-sys-color-on-surface-variant);
}

.users-permissions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1.25rem;
    align-items: start;
}

.users-permissions__group {
    background: var(--md-sys-color-surface-container-low, #f6f8fb);
    border: 1px solid var(--md-sys-color-outline-variant);
    border-radius: var(--md-sys-shape-corner-md);
    padding: 1.15rem 1.2rem 0.55rem;
}

.users-permissions__heading {
    margin: 0 0 0.35rem;
    padding: 0 0.15rem 0.75rem;
    border-bottom: 1px solid color-mix(in srgb, var(--md-sys-color-outline-variant) 80%, transparent);
    font-size: 0.72rem;
    font-weight: 750;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--md-sys-color-primary);
    line-height: 1.2;
}

.users-permissions__row {
    display: flex;
    flex-wrap: nowrap;
    align-items: center;
    justify-content: space-between;
    gap: 1rem 1.25rem;
    padding: 0.95rem 0.15rem;
    border-bottom: 1px solid color-mix(in srgb, var(--md-sys-color-outline-variant) 70%, transparent);
}

.users-permissions__row:last-child {
    border-bottom: 0;
}

.users-permissions__copy {
    min-width: 0;
    flex: 1 1 auto;
}

.users-permissions__copy strong {
    display: block;
    font-size: 0.95rem;
    font-weight: 650;
    line-height: 1.3;
}

.users-permissions__copy p {
    margin: 0.2rem 0 0;
    color: var(--md-sys-color-on-surface-variant);
    font-size: 0.8rem;
    line-height: 1.4;
}

.users-permissions__switch.vehicles-switch {
    flex: 0 0 8.6rem;
    display: grid;
    grid-template-columns: 2.4rem minmax(5.5rem, 1fr);
    column-gap: 0.55rem;
    align-items: center;
    min-height: 0;
    width: 8.6rem;
}

.users-permissions__switch .vehicles-switch__label {
    min-width: 0;
    font-size: 0.8rem;
    font-weight: 650;
    line-height: 1.2;
}

@media (max-width: 900px) {
    .users-permissions {
        grid-template-columns: 1fr;
    }
}

.users-copy-list {
    list-style: none;
    margin: 0.75rem 0;
    padding: 0;
    max-height: 16rem;
    overflow: auto;
}

.vehicles-table tbody td:has(.vehicles-cell-photo-wrap) {
    position: relative;
    z-index: 1;
    overflow: visible;
}

.vehicles-cell-photo-wrap {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 80px;
    height: 60px;
    border-radius: var(--md-sys-shape-corner-sm);
    background: var(--md-sys-color-surface-container-high);
    vertical-align: middle;
}

.vehicles-cell-photo {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    border-radius: inherit;
}

.vehicles-cell-photo-empty {
    font-size: 1.25rem;
    color: var(--md-sys-color-outline);
}

.vehicles-cell-photo-badge {
    position: absolute;
    bottom: -0.4rem;
    right: -0.45rem;
    z-index: 1;
    box-sizing: border-box;
    min-width: 1.35rem;
    height: 1.35rem;
    padding: 0 0.32rem;
    border-radius: 999px;
    background: var(--md-sys-color-primary-container);
    color: var(--md-sys-color-on-primary-container);
    font-size: 0.78rem;
    font-weight: 700;
    line-height: 1.35rem;
    text-align: center;
    font-variant-numeric: tabular-nums;
    pointer-events: none;
}

.vehicle-detail__images-panel {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    min-height: 12rem;
    border-radius: var(--md-sys-shape-corner-md);
}

.vehicle-detail__images-panel.is-drop-active {
    outline: 2px dashed var(--md-sys-color-primary);
    outline-offset: 4px;
    background: color-mix(in srgb, var(--md-sys-color-primary) 6%, transparent);
}

.vehicle-detail__images-toolbar {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.vehicle-detail__images-meta {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}

.vehicle-detail__images-actions {
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.vehicle-detail__images-classify {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.25rem;
}

.vehicle-detail__images-classify .vehicle-detail__images-hint {
    text-align: center;
    max-width: 16rem;
}

.vehicle-detail__images-hint {
    color: var(--md-sys-color-on-surface-variant);
    font-size: 0.85rem;
}

.vehicle-detail__images-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    padding: 2.5rem 1rem;
    color: var(--md-sys-color-on-surface-variant);
    text-align: center;
}

.vehicle-detail__images-empty .material-symbols-outlined {
    font-size: 2.4rem;
    opacity: 0.7;
}

.vehicle-detail__image-badge {
    position: absolute;
    top: 0.5rem;
    left: 0.5rem;
    background: color-mix(in srgb, #0f172a 72%, transparent);
    color: #fff;
    font-size: 0.7rem;
    font-weight: 650;
    padding: 0.2rem 0.55rem;
    border-radius: 999px;
}

/* Foto dall'App: inquadratura (in basso a sinistra) e foto nascosta (in basso a destra) */
.vehicle-detail__image-badge--hidden {
    top: auto;
    left: auto;
    bottom: 0.5rem;
    right: 0.5rem;
    display: inline-flex;
    align-items: center;
    gap: 0.2rem;
}

.vehicle-detail__image-badge--hidden .material-symbols-outlined,
.vehicle-detail__image-shot .material-symbols-outlined {
    font-size: 0.95rem;
}

.vehicle-detail__image-shot {
    position: absolute;
    left: 0.5rem;
    bottom: 0.5rem;
    max-width: calc(100% - 7rem);
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.2rem 0.55rem;
    border-radius: 999px;
    font-size: 0.7rem;
    font-weight: 650;
    background: var(--md-sys-color-primary-container);
    color: var(--md-sys-color-on-primary-container);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.vehicle-detail__image-shot.is-out {
    background: color-mix(in srgb, #0f172a 60%, transparent);
    color: #fff;
}

.vehicle-detail__image-actions {
    position: absolute;
    top: 0.35rem;
    right: 0.35rem;
    display: flex;
    gap: 0.2rem;
    padding: 0.15rem;
    border-radius: 999px;
    background: color-mix(in srgb, #0f172a 45%, transparent);
    opacity: 1;
}

.vehicle-detail__image-actions .md-icon-btn {
    width: 2rem;
    height: 2rem;
    background: color-mix(in srgb, #fff 88%, transparent);
}

.vehicle-detail__image-actions .is-star-on .material-symbols-outlined {
    font-variation-settings: 'FILL' 1;
    color: #e8b923;
}

.vehicle-detail__image-handle {
    cursor: grab;
}

.vehicle-detail__images-panel .vehicle-detail__opt-list {
    max-height: none;
}

.vehicle-detail__images-panel .vehicle-detail__subsection.vehicle-detail__opt-board {
    margin-top: 0;
}

.vehicle-detail__images-panel .vehicle-detail__opt-empty {
    flex: 0 0 auto;
    padding: 1.15rem 1.1rem 1.25rem;
}

.vehicle-detail__wm-card {
    align-items: center;
}

.vehicle-detail__images-panel .vehicle-detail__opt-card.vehicle-detail__wm-card:hover {
    background: var(--md-sys-color-surface-container-low, #f6f8fb);
    border-color: transparent;
    box-shadow: none;
}

.vehicle-detail__wm-card .watermark-preview {
    width: 5rem;
    height: 3.75rem;
    flex: 0 0 auto;
}

.vehicle-detail__wm-actions {
    display: flex;
    align-items: flex-end;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.vehicle-detail__wm-actions .md-field {
    min-width: 10rem;
}

.pswp__thumbs {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 12px;
    z-index: 10;
    display: flex;
    gap: 0.4rem;
    justify-content: center;
    overflow-x: auto;
    padding: 0 1rem;
    pointer-events: auto;
}

.pswp__thumb {
    flex: 0 0 auto;
    width: 56px;
    height: 42px;
    padding: 0;
    border: 2px solid transparent;
    border-radius: 0.4rem;
    overflow: hidden;
    background: color-mix(in srgb, #fff 12%, transparent);
    cursor: pointer;
}

.pswp__thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.pswp__thumb.is-active {
    border-color: #fff;
}


.media-stock-toolbar .md-field {
    min-width: 0;
}

.media-stock-toolbar > .md-btn {
    flex: 0 0 auto;
}

.media-stock-avg {
    margin-top: 0.15rem;
    font-weight: 400;
    color: var(--md-sys-color-on-surface-variant);
}

.media-stock-filters {
    align-items: end;
}

.media-stock-filters .md-ms__trigger {
    min-height: 44px;
}

.media-stock-toolbar .vehicles-filters__actions .vehicles-switch {
    margin-right: 0.15rem;
}

.media-stock-table__thumb {
    width: 80px;
}

.media-stock-table__thumb img,
.media-stock-table__thumb .material-symbols-outlined {
    width: 80px;
    height: 60px;
    border-radius: var(--md-sys-shape-corner-sm);
    background: var(--md-sys-color-surface-container-high);
}

.media-stock-table__thumb img {
    object-fit: cover;
    display: block;
}

.media-stock-table__thumb .material-symbols-outlined {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--md-sys-color-outline);
    font-size: 1.25rem;
}

.media-stock-table .is-unclassified {
    color: var(--md-sys-color-on-surface-variant);
    font-style: italic;
}

.media-stock-table__sub {
    color: var(--md-sys-color-on-surface-variant);
    font-size: 0.8rem;
    font-weight: 400;
}

.media-stock-drawer .detail-drawer__header h2 {
    white-space: normal;
}

.media-stock-modal-body {
    display: flex;
    flex-direction: column;
    gap: 0;
    padding: 0;
}

.media-stock-hero {
    flex-shrink: 0;
}

.media-stock-hero .vehicle-detail__stats {
    grid-template-columns: repeat(auto-fill, minmax(11rem, 1fr));
}

.media-stock-hero .vehicle-detail__hero-foot {
    justify-content: flex-end;
}

.media-stock-drawer-hint {
    margin: 0 0 0.65rem;
    font-size: 0.85rem;
    color: var(--md-sys-color-on-surface-variant);
}

.media-stock-gallery-wrap {
    flex: 1 1 auto;
    min-height: 0;
    overflow: auto;
    padding: 1rem 1.25rem 1.5rem;
}

.media-stock-gallery-toolbar {
    display: flex;
    justify-content: flex-end;
    gap: 0.25rem;
    margin-left: auto;
}

.media-stock-similar-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem 1rem;
    flex-wrap: wrap;
    flex-shrink: 0;
    padding: 0.85rem 1.25rem;
    border-bottom: 1px solid var(--md-sys-color-outline-variant);
    background:
        linear-gradient(180deg, rgba(0, 123, 224, 0.06) 0%, rgba(0, 123, 224, 0) 100%),
        var(--md-sys-color-surface);
}

.media-stock-similar-title {
    margin: 0;
    font-size: 1.05rem;
}

.media-stock-similar-empty,
.media-stock-modal-body > .companies-empty {
    padding: 2rem 1.25rem;
}

.media-stock-similar-hint {
    display: block;
    margin-top: 0.45rem;
    font-size: 0.8rem;
    font-weight: 400;
}

.media-stock-similar-wrap {
    flex: 1 1 auto;
    min-height: 12rem;
    overflow: auto;
    padding: 0 1.25rem 1rem;
}

.media-stock-gallery .vehicle-detail__image-card {
    cursor: pointer;
}

.media-stock-gallery .vehicle-detail__image-card.is-selected {
    outline: 2px solid var(--md-sys-color-primary);
    outline-offset: 1px;
}

.media-stock-match {
    display: inline-block;
    padding: 0.1rem 0.45rem;
    border-radius: 999px;
    background: var(--md-sys-color-primary-container);
    color: var(--md-sys-color-on-primary-container);
    font-weight: 700;
    font-size: 0.8rem;
}

.vehicles-bulk-dialog__chip-count {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.7rem;
    border-radius: 999px;
    background: var(--md-sys-color-secondary-container);
    color: var(--md-sys-color-on-secondary-container);
    font-size: 0.8rem;
    font-weight: 650;
}

.media-stock-selected {
    margin-left: 0.75rem;
    color: var(--md-sys-color-primary);
    font-weight: 650;
}

.watermark-preview {
    display: inline-flex;
    width: 4.4rem;
    height: 3.3rem;
    background-image: linear-gradient(45deg, #d0d0d0 25%, transparent 25%), linear-gradient(-45deg, #d0d0d0 25%, transparent 25%), linear-gradient(45deg, transparent 75%, #d0d0d0 75%), linear-gradient(-45deg, #d0d0d0 25%, transparent 75%);
    background-size: 12px 12px;
    background-position: 0 0, 0 6px, 6px -6px, -6px 0;
    border-radius: var(--md-sys-shape-corner-sm);
    overflow: hidden;
}

.watermark-preview img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.watermark-dropzone {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 14rem;
    padding: 1.5rem 1.25rem;
    border: 2px dashed var(--md-sys-color-outline);
    border-radius: var(--md-sys-shape-corner-md);
    background: color-mix(in srgb, var(--md-sys-color-surface-container) 72%, #fff);
    text-align: center;
}

.watermark-dropzone.is-drop-active {
    border-color: var(--md-sys-color-primary);
    background: color-mix(in srgb, var(--md-sys-color-primary) 8%, #fff);
}

.watermark-dropzone.has-file {
    border-style: solid;
    border-color: var(--md-sys-color-outline-variant);
}

.watermark-dropzone__input {
    display: none;
}

.watermark-dropzone__inner {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.7rem;
    max-width: 28rem;
}

.watermark-dropzone__icon {
    font-size: 2.4rem;
    color: var(--md-sys-color-primary);
}

.watermark-dropzone__title {
    margin: 0;
    font-size: 0.98rem;
    font-weight: 650;
    color: var(--md-sys-color-on-surface);
}

.watermark-dropzone__file {
    margin: 0;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 0.85rem;
    color: var(--md-sys-color-on-surface-variant);
}

.watermark-dropzone__hint {
    margin: 0;
    font-size: 0.78rem;
    line-height: 1.35;
    color: var(--md-sys-color-on-surface-variant);
}

.watermark-detail-preview {
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
}

.watermark-detail-preview__label {
    margin: 0;
    font-size: 0.78rem;
    font-weight: 650;
    color: var(--md-sys-color-on-surface-variant);
}

.watermark-preview--medium {
    display: flex;
    width: 100%;
    max-width: 50rem;
    aspect-ratio: 4 / 3;
    height: auto;
    border: 1px solid var(--md-sys-color-outline-variant);
    border-radius: var(--md-sys-shape-corner-md);
}

.watermark-kind-fieldset {
    border: 1px solid var(--md-sys-color-outline-variant);
    border-radius: var(--md-sys-shape-corner-md);
    padding: 0.75rem 1rem 1rem;
    margin: 0;
}

.watermark-kind-fieldset legend {
    padding: 0 0.35rem;
    font-size: 0.85rem;
    font-weight: 600;
}

.watermark-kind-option {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
    margin-top: 0.5rem;
    cursor: pointer;
}

.watermark-kind-option__hint {
    width: 100%;
    margin-left: 1.5rem;
    font-size: 0.8rem;
    color: var(--md-sys-color-on-surface-variant);
}

.watermark-delete-section {
    align-items: flex-start;
}

.watermark-delete-section .crud-form__hint {
    margin: 0;
}

.watermark-delete-section .md-btn--danger {
    align-self: flex-start;
}

.watermark-proposals__grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.75rem;
}

.watermark-proposals__grid:has(.watermark-proposals__item:only-child) {
    grid-template-columns: minmax(0, 50rem);
}

.watermark-proposals__item {
    padding: 0;
    border: 2px solid var(--md-sys-color-outline-variant);
    border-radius: var(--md-sys-shape-corner-md);
    overflow: hidden;
    background: #fff;
    cursor: pointer;
}

.watermark-proposals__item.is-selected {
    border-color: var(--md-sys-color-primary);
    box-shadow: 0 0 0 1px var(--md-sys-color-primary);
}

.watermark-proposals__item img {
    display: block;
    width: 100%;
    aspect-ratio: 4 / 3;
    object-fit: contain;
    background-image: linear-gradient(45deg, #d0d0d0 25%, transparent 25%), linear-gradient(-45deg, #d0d0d0 25%, transparent 25%), linear-gradient(45deg, transparent 75%, #d0d0d0 75%), linear-gradient(-45deg, #d0d0d0 25%, transparent 75%);
    background-size: 12px 12px;
    background-position: 0 0, 0 6px, 6px -6px, -6px 0;
}

.watermark-gen-stage {
    position: relative;
    isolation: isolate;
    width: 100%;
    max-width: 50rem;
    aspect-ratio: 4 / 3;
    overflow: hidden;
    border: 1px solid var(--md-sys-color-outline-variant);
    border-radius: var(--md-sys-shape-corner-md);
    background: linear-gradient(160deg, #0b1a2c 0%, #12324f 42%, #0e2438 100%);
}

.watermark-gen-stage__aurora {
    position: absolute;
    inset: -45%;
    background:
        radial-gradient(closest-side at 28% 38%, rgba(0, 123, 224, 0.55), transparent 68%),
        radial-gradient(closest-side at 72% 62%, rgba(120, 190, 255, 0.38), transparent 70%),
        radial-gradient(closest-side at 52% 18%, rgba(168, 120, 255, 0.32), transparent 64%);
    filter: blur(18px);
    animation: watermark-gen-aurora 9s ease-in-out infinite;
}

.watermark-gen-stage__blob {
    position: absolute;
    width: 46%;
    aspect-ratio: 1;
    border-radius: 50%;
    filter: blur(28px);
    opacity: 0.7;
}

.watermark-gen-stage__blob--a {
    left: 8%;
    top: 18%;
    background: rgba(0, 174, 255, 0.45);
    animation: watermark-gen-blob-a 7.5s ease-in-out infinite;
}

.watermark-gen-stage__blob--b {
    right: 6%;
    bottom: 12%;
    background: rgba(90, 120, 255, 0.4);
    animation: watermark-gen-blob-b 8.5s ease-in-out infinite;
}

.watermark-gen-stage__shimmer {
    position: absolute;
    inset: 0;
    background: linear-gradient(
        105deg,
        transparent 18%,
        rgba(255, 255, 255, 0.08) 42%,
        rgba(255, 255, 255, 0.28) 50%,
        rgba(255, 255, 255, 0.08) 58%,
        transparent 78%
    );
    background-size: 220% 100%;
    animation: watermark-gen-shimmer 2.6s ease-in-out infinite;
}

.watermark-gen-stage__content {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    height: 100%;
    padding: 1.25rem;
    text-align: center;
    color: #e8f3ff;
}

.watermark-gen-stage__icon {
    font-size: 2.4rem;
    color: #9fd4ff;
    animation: watermark-gen-pulse 1.8s ease-in-out infinite;
}

.watermark-gen-stage__title {
    margin: 0;
    font-size: 0.98rem;
    font-weight: 650;
    letter-spacing: 0.01em;
}

.watermark-gen-stage__hint {
    margin: 0;
    max-width: 22rem;
    font-size: 0.82rem;
    line-height: 1.4;
    color: rgba(232, 243, 255, 0.78);
}

.watermark-gen-btn-icon {
    animation: watermark-gen-spin-soft 2.4s linear infinite;
}

@keyframes watermark-gen-aurora {
    0%,
    100% {
        transform: translate(0, 0) rotate(0deg) scale(1);
    }
    33% {
        transform: translate(7%, -5%) rotate(9deg) scale(1.08);
    }
    66% {
        transform: translate(-6%, 7%) rotate(-7deg) scale(1.04);
    }
}

@keyframes watermark-gen-blob-a {
    0%,
    100% {
        transform: translate(0, 0) scale(1);
    }
    50% {
        transform: translate(18%, 12%) scale(1.18);
    }
}

@keyframes watermark-gen-blob-b {
    0%,
    100% {
        transform: translate(0, 0) scale(1.05);
    }
    50% {
        transform: translate(-16%, -10%) scale(0.92);
    }
}

@keyframes watermark-gen-shimmer {
    0% {
        background-position: 130% 0;
    }
    100% {
        background-position: -30% 0;
    }
}

@keyframes watermark-gen-pulse {
    0%,
    100% {
        opacity: 0.72;
        transform: scale(1);
    }
    50% {
        opacity: 1;
        transform: scale(1.1);
    }
}

@keyframes watermark-gen-spin-soft {
    0% {
        transform: rotate(0deg);
    }
    100% {
        transform: rotate(360deg);
    }
}

@media (prefers-reduced-motion: reduce) {
    .watermark-gen-stage__aurora,
    .watermark-gen-stage__blob,
    .watermark-gen-stage__shimmer,
    .watermark-gen-stage__icon,
    .watermark-gen-btn-icon {
        animation: none;
    }
}

.watermark-html-editor__canvas-wrap {
    max-width: 100%;
    margin: 0.75rem 0 1rem;
}

.watermark-html-editor__canvas {
    position: relative;
    max-width: 100%;
    overflow: visible;
    border: 1px solid var(--md-sys-color-outline-variant);
    border-radius: var(--md-sys-shape-corner-md);
    background-color: #c8c8c8;
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
    touch-action: none;
    user-select: none;
}

.watermark-html-editor__textbox {
    position: absolute;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    font-weight: 700;
    line-height: 1.2;
    border: 1px dashed color-mix(in srgb, var(--md-sys-color-primary) 55%, transparent);
    box-sizing: border-box;
    cursor: grab;
    touch-action: none;
    user-select: none;
}

.watermark-html-editor__textbox.is-dragging {
    cursor: grabbing;
    border-color: var(--md-sys-color-primary);
    box-shadow: 0 0 0 1px var(--md-sys-color-primary);
}

.watermark-html-editor__textbox.is-resizing {
    border-color: var(--md-sys-color-primary);
}

.watermark-html-editor__handle {
    position: absolute;
    right: -7px;
    bottom: -7px;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: var(--md-sys-color-primary);
    border: 2px solid #fff;
    box-shadow: 0 1px 4px rgba(7, 16, 24, 0.35);
    cursor: nwse-resize;
    touch-action: none;
    z-index: 2;
}

.watermark-html-editor__metrics {
    margin: 0.45rem 0 0;
    font-size: 0.78rem;
    color: var(--md-sys-color-on-surface-variant);
}

.watermark-html-editor__controls {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.75rem 1rem;
}

.watermark-html-editor__color {
    grid-column: span 2;
}

.rgba-color-field {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    gap: 0.55rem 0.75rem;
    align-items: center;
    padding: 0.55rem 0.75rem 0.7rem;
}

.md-field--outline .rgba-color-field {
    border: 1px solid var(--md-sys-color-outline);
    border-radius: var(--md-sys-shape-corner-sm);
}

.md-field--outline .rgba-color-field__value {
    min-height: 2.75rem;
    padding: 0.2rem 0.2rem 0.2rem 0;
    border: 0;
    border-radius: 0;
    background: transparent;
}

.rgba-color-field__swatch {
    position: relative;
    width: 2.75rem;
    height: 2.75rem;
    border: 1px solid var(--md-sys-color-outline);
    border-radius: 8px;
    overflow: hidden;
    cursor: pointer;
    background-image: linear-gradient(45deg, #d0d0d0 25%, transparent 25%), linear-gradient(-45deg, #d0d0d0 25%, transparent 25%), linear-gradient(45deg, transparent 75%, #d0d0d0 75%), linear-gradient(-45deg, #d0d0d0 25%, transparent 75%);
    background-size: 10px 10px;
    background-position: 0 0, 0 5px, 5px -5px, -5px 0;
}

.rgba-color-field__swatch-fill {
    position: absolute;
    inset: 0;
}

.rgba-color-field__hex {
    position: absolute;
    inset: 0;
    opacity: 0;
    width: 100%;
    height: 100%;
    padding: 0;
    border: 0;
    cursor: pointer;
}

.rgba-color-field__alpha {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) 3rem;
    gap: 0.55rem;
    align-items: center;
    font-size: 0.78rem;
    color: var(--md-sys-color-on-surface-variant);
}

.md-field--outline .rgba-color-field__hex,
.md-field--outline .rgba-color-field__alpha input[type="range"] {
    min-height: 0;
    padding: 0;
    border: 0;
    background: transparent;
}

.md-field--outline .rgba-color-field__hex:focus {
    outline: none;
}

.rgba-color-field__swatch:focus-within {
    outline: 2px solid rgba(0, 123, 224, 0.28);
}

.md-field--outline .rgba-color-field__alpha input[type="range"] {
    width: 100%;
    accent-color: var(--md-sys-color-primary);
}

@media (min-width: 720px) {
    .watermark-html-editor__controls {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .watermark-html-editor__color {
        grid-column: span 2;
    }
}

.watermark-image-tools {
    display: grid;
    gap: 0.75rem;
}

.watermark-image-tools__actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    justify-content: center;
    margin-top: 0.35rem;
}

.watermark-ai-studio {
    width: min(48rem, calc(100vw - 1.5rem));
    max-height: 75vh;
    height: 75vh;
    display: flex;
    flex-direction: column;
}

.watermark-ai-studio__body {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    min-height: 0;
    flex: 1;
    overflow: hidden;
}

.watermark-ai-studio__thread {
    flex: 1;
    overflow: auto;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    padding: 1rem 1.1rem;
    border-radius: var(--md-sys-shape-corner-md);
    background:
        linear-gradient(180deg, rgba(0, 123, 224, 0.04), transparent 40%),
        var(--md-sys-color-surface-container-low, #f5f5f7);
    border: 1px solid var(--md-sys-color-outline-variant);
    min-height: 0;
}

.watermark-ai-studio__empty {
    margin: auto;
    text-align: center;
    color: var(--md-sys-color-on-surface-variant);
    display: grid;
    gap: 0.35rem;
    justify-items: center;
}

.watermark-ai-studio__empty .material-symbols-outlined {
    font-size: 2rem;
    opacity: 0.7;
}

.watermark-ai-studio__bubble {
    max-width: min(88%, 34rem);
    padding: 0.85rem 1rem;
    border-radius: 1rem;
    display: grid;
    gap: 0.5rem;
}

.watermark-ai-studio__bubble.is-user {
    align-self: flex-end;
    background: var(--md-sys-color-primary);
    color: var(--md-sys-color-on-primary);
    border-bottom-right-radius: 0.35rem;
}

.watermark-ai-studio__bubble.is-assistant {
    align-self: flex-start;
    background: var(--md-sys-color-surface);
    border: 1px solid var(--md-sys-color-outline-variant);
    border-bottom-left-radius: 0.35rem;
}

.watermark-ai-studio__text {
    margin: 0;
    font-size: 0.92rem;
    line-height: 1.4;
    white-space: pre-wrap;
}

.watermark-ai-studio__hint {
    margin: 0.15rem 0 0;
    font-size: 0.8rem;
    opacity: 0.8;
}

.watermark-ai-studio__thumb {
    display: block;
    max-width: 100%;
    max-height: min(36rem, 48vh);
    object-fit: contain;
    border-radius: 0.65rem;
    background:
        linear-gradient(45deg, #d0d0d0 25%, transparent 25%),
        linear-gradient(-45deg, #d0d0d0 25%, transparent 25%),
        linear-gradient(45deg, transparent 75%, #d0d0d0 75%),
        linear-gradient(-45deg, transparent 75%, #d0d0d0 75%);
    background-size: 16px 16px;
    background-position: 0 0, 0 8px, 8px -8px, -8px 0;
    background-color: #eee;
}

.watermark-ai-studio__loading {
    display: flex;
    gap: 0.65rem;
    align-items: flex-start;
}

.watermark-ai-studio__loading .material-symbols-outlined {
    animation: watermark-gen-pulse 1.6s ease-in-out infinite;
}

.watermark-ai-studio__composer {
    display: grid;
    gap: 0.65rem;
    padding-top: 0.25rem;
}

.watermark-ai-studio__composer textarea {
    width: 100%;
    resize: vertical;
    min-height: 4.5rem;
    border-radius: var(--md-sys-shape-corner-md);
    border: 1px solid var(--md-sys-color-outline-variant);
    padding: 0.75rem 0.9rem;
    font: inherit;
    background: var(--md-sys-color-surface);
}

.watermark-ai-studio__file-input {
    display: none;
}

.watermark-ai-studio__reference {
    display: grid;
    grid-template-columns: 3.25rem minmax(0, 1fr) auto;
    gap: 0.65rem;
    align-items: center;
    padding: 0.5rem;
    border: 1px solid var(--md-sys-color-outline-variant);
    border-radius: var(--md-sys-shape-corner-md);
    background: var(--md-sys-color-surface-container);
}

.watermark-ai-studio__reference img {
    width: 3.25rem;
    height: 3.25rem;
    object-fit: contain;
    border-radius: var(--md-sys-shape-corner-sm);
    background: #fff;
}

.watermark-ai-studio__reference-name {
    overflow: hidden;
    font-size: 0.84rem;
    font-weight: 600;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.watermark-ai-studio__composer-actions {
    display: flex;
    gap: 0.55rem;
    align-items: center;
}

.watermark-ai-studio__composer-actions .md-btn {
    margin-left: auto;
}

.watermark-ai-studio__attach {
    color: var(--md-sys-color-on-secondary-container);
    background: var(--md-sys-color-secondary-container);
}

.watermark-ai-studio__attach-hint {
    font-size: 0.78rem;
    color: var(--md-sys-color-on-surface-variant);
}

.watermark-ai-studio__sent-reference {
    display: flex;
    max-width: 100%;
    gap: 0.35rem;
    align-items: center;
    overflow: hidden;
    font-size: 0.78rem;
    font-weight: 600;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.watermark-ai-studio__sent-reference .material-symbols-outlined {
    flex: 0 0 auto;
    font-size: 1rem;
}

.watermark-ai-studio__footer {
    gap: 0.75rem;
}

.watermark-placement-editor {
    max-width: 100%;
}

.watermark-placement-editor__canvas {
    position: relative;
    max-width: 100%;
    overflow: hidden;
    border: 1px solid var(--md-sys-color-outline-variant);
    border-radius: var(--md-sys-shape-corner-md);
    background-color: #ececec;
    background-image:
        linear-gradient(45deg, #d8d8d8 25%, transparent 25%),
        linear-gradient(-45deg, #d8d8d8 25%, transparent 25%),
        linear-gradient(45deg, transparent 75%, #d8d8d8 75%),
        linear-gradient(-45deg, transparent 75%, #d8d8d8 75%);
    background-size: 20px 20px;
    background-position: 0 0, 0 10px, 10px -10px, -10px 0;
    touch-action: none;
    user-select: none;
}

.watermark-placement-editor__subject {
    position: absolute;
    box-sizing: border-box;
    border: 1px dashed rgba(0, 90, 180, 0.75);
    border-radius: 0.25rem;
    background-repeat: no-repeat;
    background-size: 100% 100%;
    background-position: center;
    cursor: grab;
}

.watermark-placement-editor__subject.is-dragging,
.watermark-placement-editor__subject.is-resizing,
.watermark-placement-editor__subject.is-rotating {
    cursor: grabbing;
    border-color: var(--md-sys-color-primary);
}

.watermark-placement-editor__rotate-handle {
    position: absolute;
    left: 50%;
    top: -2.25rem;
    display: grid;
    width: 1.75rem;
    height: 1.75rem;
    place-items: center;
    transform: translateX(-50%);
    border: 2px solid #fff;
    border-radius: 50%;
    color: #fff;
    background: var(--md-sys-color-primary);
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3);
    cursor: grab;
}

.watermark-placement-editor__rotate-handle::after {
    position: absolute;
    top: 100%;
    left: 50%;
    width: 1px;
    height: 0.5rem;
    content: "";
    background: var(--md-sys-color-primary);
}

.watermark-placement-editor__rotate-handle .material-symbols-outlined {
    font-size: 1.1rem;
}

.watermark-placement-editor__handle {
    position: absolute;
    right: -0.4rem;
    bottom: -0.4rem;
    width: 0.85rem;
    height: 0.85rem;
    border-radius: 50%;
    background: var(--md-sys-color-primary);
    border: 2px solid #fff;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
    cursor: nwse-resize;
}

.watermark-placement-editor__metrics {
    margin: 0.5rem 0 0;
    font-size: 0.78rem;
    color: var(--md-sys-color-on-surface-variant);
}


/* Vehicle create dialog (Stock) */
.vehicle-create-dialog-scrim {
    z-index: 75;
}

.vehicle-create-dialog {
    width: min(100%, 64rem);
    height: min(92vh, 46rem);
    max-height: min(94vh, 56rem);
    display: flex;
    flex-direction: column;
    background: var(--md-sys-color-surface);
    border-radius: 1.25rem;
    box-shadow: var(--md-sys-elevation-3);
    animation: md-dialog-in 0.18s ease;
    overflow: hidden;
}

.vehicle-create-dialog__header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    padding: 1.25rem 1.35rem 0.85rem;
    border-bottom: 1px solid var(--md-sys-color-outline-variant);
}

.vehicle-create-dialog__heading {
    display: flex;
    gap: 0.85rem;
    align-items: flex-start;
}

.vehicle-create-dialog__icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 999px;
    background: rgba(0, 123, 224, 0.12);
    color: var(--md-sys-color-primary);
}

.vehicle-create-dialog__heading h2 {
    margin: 0 0 0.25rem;
    font-size: 1.3rem;
}

.vehicle-create-dialog__heading p {
    margin: 0;
    color: var(--md-sys-color-on-surface-variant);
    font-size: 0.9rem;
}

.vehicle-create-dialog__body {
    flex: 1 1 auto;
    min-height: 0;
    padding: 1.15rem 1.5rem;
    overflow: auto;
    display: grid;
    gap: 1.1rem;
    align-content: start;
}

.vehicle-create-dialog__grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.85rem;
}

.vehicle-create-dialog__modes {
    display: grid;
    gap: 0.45rem;
}

.vehicle-create-dialog__mode-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.vehicle-create-dialog__mode {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.55rem 0.8rem;
    border: 1px solid var(--md-sys-color-outline-variant);
    border-radius: 999px;
    cursor: pointer;
}

.vehicle-create-dialog__mode.is-disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

.vehicle-create-dialog__hint,
.vehicle-create-dialog__error,
.vehicle-create-dialog__busy {
    margin: 0;
    font-size: 0.88rem;
}

.vehicle-create-dialog__error {
    color: var(--md-sys-color-error);
}

.vehicle-create-dialog__busy {
    color: var(--md-sys-color-primary);
    font-weight: 600;
}

.vehicle-create-dialog__plate-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 0.75rem;
    align-items: end;
}

.vehicle-create-dialog__candidates {
    display: grid;
    gap: 0.5rem;
    margin-top: 0.85rem;
    max-height: min(28vh, 18rem);
    overflow: auto;
    padding-right: 0.15rem;
}

.vehicle-create-dialog__candidate {
    display: flex;
    gap: 0.65rem;
    align-items: flex-start;
    padding: 0.75rem 0.85rem;
    border: 1px solid var(--md-sys-color-outline-variant);
    border-radius: 0.85rem;
    cursor: pointer;
}

.vehicle-create-dialog__candidate.is-selected {
    border-color: var(--md-sys-color-primary);
    background: rgba(0, 123, 224, 0.06);
}

.vehicle-create-dialog__candidate strong {
    display: block;
}

.vehicle-create-dialog__candidate small {
    color: var(--md-sys-color-on-surface-variant);
}

.vehicle-create-dialog__footer {
    display: flex;
    justify-content: flex-end;
    flex-wrap: wrap;
    gap: 0.55rem;
    padding: 0.85rem 1.35rem 1.15rem;
    border-top: 1px solid var(--md-sys-color-outline-variant);
}

@media (max-width: 48rem) {
    .vehicle-create-dialog__grid,
    .vehicle-create-dialog__plate-row {
        grid-template-columns: 1fr;
    }
}

.warranty-toolbar {
    grid-template-columns: minmax(14rem, 2fr) minmax(12rem, 1fr) auto;
}

.warranty-toolbar > .md-btn {
    justify-self: start;
    width: auto;
}

.warranty-page .md-table__num {
    text-align: right;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.warranty-page .md-table tr.is-muted td:not(.md-table__actions) {
    color: var(--md-sys-color-on-surface-variant);
}

.warranty-seal-chip {
    gap: 0.3rem;
    padding-left: 0.5rem;
}

.warranty-seal-chip .material-symbols-outlined {
    font-size: 1rem;
    color: var(--md-sys-color-primary);
}

.warranty-content-editor {
    border: 1px solid var(--md-sys-color-outline);
    border-radius: var(--md-sys-shape-corner-sm);
    background: #fff;
    overflow: hidden;
}

.warranty-content-editor:focus-within {
    outline: 2px solid rgba(0, 123, 224, 0.28);
    border-color: var(--md-sys-color-primary);
}

.warranty-content-editor__toolbar {
    display: flex;
    gap: 0.35rem;
    padding: 0.35rem 0.6rem;
    border-bottom: 1px solid var(--md-sys-color-outline-variant);
    background: var(--md-sys-color-surface-container-low);
}

.warranty-content-editor__body {
    min-height: 10rem;
    max-height: 22rem;
    overflow-y: auto;
    padding: 0.9rem 1rem;
    line-height: 1.5;
    outline: none;
}

.warranty-content-editor__body:empty::before {
    content: attr(data-placeholder);
    color: var(--md-sys-color-on-surface-variant);
    pointer-events: none;
}

.warranty-content-editor__body p:first-child,
.warranty-content-editor__body ul:first-child {
    margin-top: 0;
}

.warranty-content-editor__body p:last-child,
.warranty-content-editor__body ul:last-child {
    margin-bottom: 0;
}

.warranty-seal-toolbar {
    grid-template-columns: minmax(14rem, 32rem) auto;
}

.warranty-seal-toolbar > .md-btn {
    justify-self: start;
    width: auto;
}

.warranty-seal-name {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.warranty-seal-name .material-symbols-outlined {
    font-size: 1.15rem;
    color: var(--md-sys-color-primary);
}

.vehicle-detail__warranty-picker {
    display: grid;
    gap: 0.5rem;
    width: 100%;
}

@media (max-width: 900px) {
    .warranty-toolbar,
    .warranty-seal-toolbar {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 48rem) {
    .warranty-page .crud-form__grid {
        grid-template-columns: 1fr;
    }
}

/* Export XLS: modale scelta template (estende .vehicles-bulk-dialog) */
.vehicles-download-dialog__list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.vehicles-download-card {
    display: flex;
    align-items: flex-start;
    gap: 0.65rem;
    width: 100%;
    padding: 0.75rem 0.9rem;
    border: 1px solid var(--md-sys-color-outline-variant);
    border-radius: 12px;
    background: #fff;
    color: var(--md-sys-color-on-surface);
    text-align: left;
    cursor: pointer;
}

.vehicles-download-card:hover {
    border-color: var(--md-sys-color-primary);
    background: rgba(0, 123, 224, 0.05);
}

.vehicles-download-card.is-selected {
    border-color: var(--md-sys-color-primary);
    background: var(--md-sys-color-primary-container);
    color: var(--md-sys-color-on-primary-container);
    box-shadow: inset 0 0 0 1px var(--md-sys-color-primary);
}

.vehicles-download-card__icon {
    flex-shrink: 0;
    font-size: 1.25rem;
    color: var(--md-sys-color-primary);
}

.vehicles-download-card__body {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    min-width: 0;
}

.vehicles-download-card__title {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.92rem;
}

.vehicles-download-card__description {
    font-size: 0.82rem;
    color: var(--md-sys-color-on-surface-variant);
}

.vehicles-download-card__columns {
    font-size: 0.76rem;
    color: var(--md-sys-color-on-surface-variant);
    overflow-wrap: anywhere;
}

.vehicles-download-dialog__warning {
    display: block;
    margin-top: 0.3rem;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--md-sys-color-error);
}

.vehicles-download-dialog {
    width: min(100%, 68rem);
    max-height: min(50rem, calc(100vh - 3rem));
}

.vehicles-download-dialog .vehicles-bulk-dialog__body {
    min-height: 24rem;
}

.vehicles-download-dialog.is-editor {
    width: min(100%, 76rem);
    max-height: min(52rem, calc(100vh - 3rem));
}

/* Pulsante dentro il campo cerca: stesso margine sopra, sotto e a destra */
.vehicles-download-dialog__toolbar {
    gap: 0.6rem;
    padding-right: 0.25rem;
}

.vehicles-download-dialog__toolbar .md-btn {
    flex-shrink: 0;
    height: calc(2.75rem - 0.5rem - 2px);
    min-height: 0;
    margin: 0;
    padding-top: 0;
    padding-bottom: 0;
}

.vehicles-download-dialog__count {
    margin-left: 0.15rem;
    font-weight: 500;
    opacity: 0.75;
}

.vehicles-download-card__actions {
    display: flex;
    flex-shrink: 0;
    gap: 0.1rem;
    margin-left: auto;
}

.vehicles-download-card {
    align-items: flex-start;
}

.vehicles-download-card:focus-visible {
    outline: 2px solid var(--md-sys-color-primary);
    outline-offset: 2px;
}

.vehicles-download-editor__head {
    display: flex;
    align-items: flex-end;
    gap: 0.75rem;
    padding: 0.9rem 1.35rem 0.4rem;
}

.vehicles-download-editor__name {
    flex: 1 1 auto;
    margin: 0;
}

.vehicles-download-editor__alert {
    margin: 0.4rem 1.35rem 0;
}

.vehicles-download-editor__body {
    display: grid;
    grid-template-columns: 13rem minmax(0, 1fr) 21rem;
    min-height: 0;
    flex: 1 1 auto;
    margin-top: 0.6rem;
    border-top: 1px solid var(--md-sys-color-outline-variant);
}

.vehicles-download-editor__catalog {
    display: flex;
    flex-direction: column;
    min-height: 0;
    min-width: 0;
}

.vehicles-download-editor__search {
    margin: 0.8rem 1.2rem 0;
}

.vehicles-download-editor__chip-icon {
    font-size: 1rem;
}

.vehicles-download-editor__selected {
    display: flex;
    flex-direction: column;
    min-height: 0;
    padding: 0.9rem 1rem;
    border-left: 1px solid var(--md-sys-color-outline-variant);
    background: var(--md-sys-color-surface-container);
    overflow: auto;
}

.vehicles-download-editor__selected h3 {
    margin: 0 0 0.6rem;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--md-sys-color-on-surface-variant);
}

.vehicles-download-editor__empty {
    margin: 0;
    font-size: 0.82rem;
    color: var(--md-sys-color-on-surface-variant);
}

.vehicles-download-editor__columns {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    margin: 0;
    padding: 0;
    list-style: none;
}

.vehicles-download-editor__column {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.2rem 0.25rem 0.2rem 0.4rem;
    border: 1px solid var(--md-sys-color-outline-variant);
    border-radius: 10px;
    background: #fff;
    font-size: 0.82rem;
    cursor: grab;
}

.vehicles-download-editor__column.is-dragging {
    opacity: 0.55;
    border-style: dashed;
}

.vehicles-download-editor__column .md-icon-btn {
    width: 28px;
    height: 28px;
}

.vehicles-download-editor__column .md-icon-btn .material-symbols-outlined {
    font-size: 1.05rem;
}

.vehicles-download-editor__handle {
    font-size: 1.1rem;
    color: var(--md-sys-color-on-surface-variant);
}

.vehicles-download-editor__index {
    min-width: 1.4rem;
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--md-sys-color-on-surface-variant);
}

.vehicles-download-editor__label {
    flex: 1 1 auto;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-weight: 600;
}

@media (max-width: 1000px) {
    .vehicles-download-editor__body {
        grid-template-columns: 1fr;
        overflow: auto;
    }

    .vehicles-download-editor__selected {
        border-left: 0;
        border-top: 1px solid var(--md-sys-color-outline-variant);
    }

    .vehicles-download-editor__head {
        flex-direction: column;
        align-items: stretch;
    }
}

/* Import XLS (modale a passi nella lista Stock) */
.vehicles-import-dialog {
    width: min(100%, 76rem);
    max-height: min(54rem, calc(100vh - 3rem));
}

.activity-timeline__origin {
    display: inline-flex;
    align-items: center;
    gap: 0.2rem;
    padding: 0.05rem 0.45rem;
    border-radius: 999px;
    background: var(--md-sys-color-primary-container);
    color: var(--md-sys-color-on-primary-container);
    font-weight: 600;
}

.vehicles-import-steps {
    display: flex;
    gap: 0.35rem;
    margin: 0;
    padding: 0.75rem 1.35rem;
    list-style: none;
    border-bottom: 1px solid var(--md-sys-color-outline-variant);
    overflow-x: auto;
}

.vehicles-import-steps__item {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    flex: 1 1 0;
    min-width: max-content;
    color: var(--md-sys-color-on-surface-variant);
    font-size: 0.85rem;
}

.vehicles-import-steps__item:not(:last-child)::after {
    content: '';
    flex: 1 1 auto;
    min-width: 1rem;
    height: 1px;
    background: var(--md-sys-color-outline-variant);
}

.vehicles-import-steps__badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.6rem;
    height: 1.6rem;
    flex-shrink: 0;
    border: 1px solid var(--md-sys-color-outline);
    border-radius: 999px;
    font-weight: 700;
    font-size: 0.8rem;
}

.vehicles-import-steps__badge .material-symbols-outlined {
    font-size: 1rem;
}

.vehicles-import-steps__item.is-current {
    color: var(--md-sys-color-on-surface);
    font-weight: 700;
}

.vehicles-import-steps__item.is-current .vehicles-import-steps__badge {
    border-color: var(--md-sys-color-primary);
    background: var(--md-sys-color-primary);
    color: #fff;
}

.vehicles-import-steps__item.is-done .vehicles-import-steps__badge {
    border-color: var(--md-sys-color-primary-container);
    background: var(--md-sys-color-primary-container);
    color: var(--md-sys-color-on-primary-container);
}

.vehicles-import-dialog__content {
    flex: 1 1 auto;
    min-height: 22rem;
    overflow: auto;
    padding: 1rem 1.35rem 1.1rem;
}

.vehicles-import-step {
    display: flex;
    flex-direction: column;
    gap: 0.9rem;
}

.vehicles-import-step__intro {
    margin: 0;
    color: var(--md-sys-color-on-surface-variant);
}

.vehicles-import-step__note {
    display: flex;
    align-items: flex-start;
    gap: 0.45rem;
    margin: 0;
    color: var(--md-sys-color-on-surface-variant);
    font-size: 0.85rem;
    line-height: 1.4;
}

.vehicles-import-step__note .material-symbols-outlined {
    font-size: 1.1rem;
    color: var(--md-sys-color-primary);
}

.vehicles-import-history-link {
    margin: 0.75rem 0 0;
    font-size: 0.88rem;
}

.vehicles-import-history-link a {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    color: var(--md-sys-color-primary);
    font-weight: 500;
    text-decoration: none;
}

.vehicles-import-history-link a:hover {
    text-decoration: underline;
}

.vehicles-import-history-link .material-symbols-outlined {
    font-size: 1.1rem;
}

.vehicles-import-latest h3 {
    margin: 0.5rem 0 0.5rem;
    font-size: 0.95rem;
}

.vehicles-import-latest ul {
    margin: 0;
    padding: 0;
    list-style: none;
    border: 1px solid var(--md-sys-color-outline-variant);
    border-radius: 0.85rem;
}

.vehicles-import-latest li {
    display: grid;
    grid-template-columns: 9rem minmax(0, 1fr) auto minmax(0, 14rem) auto;
    align-items: center;
    gap: 0.75rem;
    padding: 0.55rem 0.85rem;
    font-size: 0.85rem;
}

.vehicles-import-latest li + li {
    border-top: 1px solid var(--md-sys-color-outline-variant);
}

.vehicles-import-latest__what {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.vehicles-import-latest__what span,
.vehicles-import-latest__when,
.vehicles-import-latest__summary {
    color: var(--md-sys-color-on-surface-variant);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.vehicles-import-instructions {
    margin: 0;
    padding-left: 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
    font-size: 0.9rem;
}

.vehicles-import-drop {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
    min-height: 11rem;
    padding: 1.5rem;
    border: 2px dashed var(--md-sys-color-outline);
    border-radius: 1rem;
    background: var(--md-sys-color-surface-container);
    text-align: center;
    cursor: pointer;
    transition: border-color 0.15s ease, background 0.15s ease;
}

.vehicles-import-drop input {
    position: absolute;
    inset: 0;
    opacity: 0;
    cursor: pointer;
}

.vehicles-import-drop .material-symbols-outlined {
    font-size: 2.4rem;
    color: var(--md-sys-color-primary);
}

.vehicles-import-drop span {
    color: var(--md-sys-color-on-surface-variant);
    font-size: 0.85rem;
}

.vehicles-import-drop.is-over,
.vehicles-import-drop:hover,
.vehicles-import-drop:focus-within {
    border-color: var(--md-sys-color-primary);
    background: rgba(0, 123, 224, 0.06);
}

.vehicles-import-drop.has-file {
    border-style: solid;
    border-color: var(--md-sys-color-primary);
}

.vehicles-import-summary {
    display: flex;
    align-items: center;
    gap: 0.65rem;
}

.vehicles-import-summary > .material-symbols-outlined {
    color: var(--md-sys-color-primary);
}

.vehicles-import-summary__file {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    min-width: 0;
}

.vehicles-import-summary__file span {
    color: var(--md-sys-color-on-surface-variant);
    font-size: 0.82rem;
}

.vehicles-import-warning {
    display: block;
}

.vehicles-import-status {
    display: inline-flex;
    align-items: center;
    padding: 0.15rem 0.6rem;
    border-radius: 999px;
    background: var(--md-sys-color-surface-container);
    color: var(--md-sys-color-on-surface-variant);
    font-size: 0.78rem;
    font-weight: 700;
    white-space: nowrap;
}

.vehicles-import-status.is-info { background: var(--md-sys-color-primary-container); color: var(--md-sys-color-on-primary-container); }
.vehicles-import-status.is-success { background: #dff3e4; color: #1e6b34; }
.vehicles-import-status.is-warning { background: #fff4e5; color: #7a4b00; }
.vehicles-import-status.is-conflict { background: #ffe8d6; color: #8a3a00; }
.vehicles-import-status.is-error { background: var(--md-sys-color-error-container); color: var(--md-sys-color-error); }

.vehicles-import-progress {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.vehicles-import-progress__bar {
    height: 0.6rem;
    border-radius: 999px;
    background: var(--md-sys-color-surface-container);
    overflow: hidden;
}

.vehicles-import-progress__bar span {
    display: block;
    height: 100%;
    border-radius: inherit;
    background: var(--md-sys-color-primary);
    transition: width 0.4s ease;
}

.vehicles-import-progress__text {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem 1rem;
    font-size: 0.88rem;
    color: var(--md-sys-color-on-surface-variant);
}

.vehicles-import-progress__text strong {
    color: var(--md-sys-color-on-surface);
}

.vehicles-import-result {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.vehicles-import-result__counter {
    display: flex;
    flex-direction: column;
    min-width: 9rem;
    padding: 0.65rem 0.9rem;
    border-radius: 0.85rem;
    background: var(--md-sys-color-surface-container);
}

.vehicles-import-result__counter strong {
    font-size: 1.4rem;
}

.vehicles-import-result__counter span {
    color: var(--md-sys-color-on-surface-variant);
    font-size: 0.82rem;
}

.vehicles-import-result__counter.is-applied strong { color: #1e6b34; }
.vehicles-import-result__counter.is-failed strong { color: var(--md-sys-color-error); }

.vehicles-import-result__failed {
    flex-basis: 100%;
    margin: 0;
    color: var(--md-sys-color-error);
}

.vehicles-import-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
}

.vehicles-import-filter {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.35rem 0.75rem;
    border: 1px solid var(--md-sys-color-outline-variant);
    border-radius: 999px;
    background: #fff;
    color: var(--md-sys-color-on-surface);
    font: inherit;
    font-size: 0.85rem;
    cursor: pointer;
}

.vehicles-import-filter strong {
    min-width: 1.4rem;
    padding: 0 0.35rem;
    border-radius: 999px;
    background: var(--md-sys-color-surface-container);
    text-align: center;
}

.vehicles-import-filter.is-to_apply strong { background: #dff3e4; color: #1e6b34; }
.vehicles-import-filter.is-warning strong { background: #fff4e5; color: #7a4b00; }
.vehicles-import-filter.is-conflict strong { background: #ffe8d6; color: #8a3a00; }
.vehicles-import-filter.is-error strong { background: var(--md-sys-color-error-container); color: var(--md-sys-color-error); }

.vehicles-import-filter.is-active {
    border-color: var(--md-sys-color-primary);
    background: var(--md-sys-color-primary-container);
    color: var(--md-sys-color-on-primary-container);
    font-weight: 700;
}

.vehicles-import-rows {
    border: 1px solid var(--md-sys-color-outline-variant);
    border-radius: 0.85rem;
    overflow: auto;
}

.vehicles-import-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
}

.vehicles-import-table th {
    position: sticky;
    top: 0;
    padding: 0.55rem 0.75rem;
    background: var(--md-sys-color-surface-container);
    color: var(--md-sys-color-on-surface-variant);
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.03em;
    text-align: left;
    text-transform: uppercase;
}

.vehicles-import-table td {
    padding: 0.55rem 0.75rem;
    border-top: 1px solid var(--md-sys-color-outline-variant);
    vertical-align: top;
}

.vehicles-import-table__row {
    width: 3.5rem;
    color: var(--md-sys-color-on-surface-variant);
    font-variant-numeric: tabular-nums;
}

.vehicles-import-table__muted {
    color: var(--md-sys-color-on-surface-variant);
}

.vehicles-import-change,
.vehicles-import-message {
    display: block;
    line-height: 1.35;
}

.vehicles-import-change + .vehicles-import-change,
.vehicles-import-message + .vehicles-import-message {
    margin-top: 0.3rem;
}

.vehicles-import-change__label {
    display: block;
    color: var(--md-sys-color-on-surface-variant);
    font-size: 0.78rem;
}

.vehicles-import-change__values {
    font-variant-numeric: tabular-nums;
}

.vehicles-import-change__state {
    margin-left: 0.35rem;
    font-size: 0.75rem;
    color: var(--md-sys-color-on-surface-variant);
}

.vehicles-import-change.is-conflict .vehicles-import-change__state { color: #8a3a00; font-weight: 700; }
.vehicles-import-change.is-unchanged { opacity: 0.7; }

.vehicles-import-message.is-error { color: var(--md-sys-color-error); }
.vehicles-import-message.is-warning { color: #7a4b00; }
.vehicles-import-message.is-result { color: var(--md-sys-color-on-surface-variant); font-style: italic; }

.vehicles-import-message__cell {
    display: inline-block;
    margin-right: 0.3rem;
    padding: 0 0.35rem;
    border-radius: 0.3rem;
    background: var(--md-sys-color-surface-container);
    color: var(--md-sys-color-on-surface);
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: 0.75rem;
    font-style: normal;
}

.vehicles-import-pager {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.5rem;
    font-size: 0.85rem;
    color: var(--md-sys-color-on-surface-variant);
}

.vehicles-import-pager span {
    margin-right: auto;
}

.vehicles-import-conflicts {
    display: inline-flex;
    align-items: flex-start;
    gap: 0.45rem;
    font-size: 0.85rem;
    cursor: pointer;
}

.vehicles-import-conflicts input {
    margin-top: 0.15rem;
}

@media (max-width: 800px) {
    .vehicles-import-latest li {
        grid-template-columns: 1fr auto;
    }

    .vehicles-import-latest__when,
    .vehicles-import-latest__summary {
        grid-column: 1 / -1;
    }

    .vehicles-import-steps__label {
        display: none;
    }

    .vehicles-import-steps__item.is-current .vehicles-import-steps__label {
        display: inline;
    }
}

/* Pagina Admin Import XLS */
.xls-imports-filters {
    grid-template-columns: repeat(auto-fill, minmax(11rem, 1fr));
}

.xls-imports-filters__actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
    grid-column: -2 / -1;
    white-space: nowrap;
}

@media (max-width: 700px) {
    .xls-imports-filters__actions {
        grid-column: 1 / -1;
    }
}

.xls-imports-table tr.is-clickable {
    cursor: pointer;
}

.xls-imports-table tr.is-clickable:hover {
    background: rgba(0, 123, 224, 0.04);
}

.xls-imports-table .is-num {
    text-align: right;
    font-variant-numeric: tabular-nums;
}

.xls-imports-table .is-error {
    color: var(--md-sys-color-error);
    font-weight: 700;
}

.xls-imports-table__file {
    max-width: 18rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.xls-imports-drawer .detail-drawer__header h2 {
    flex: 1 1 auto;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.xls-imports-drawer .detail-drawer__body {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.xls-imports-info {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(14rem, 1fr));
    gap: 0.6rem 1.25rem;
    margin: 0;
}

.xls-imports-info dt {
    color: var(--md-sys-color-on-surface-variant);
    font-size: 0.75rem;
}

.xls-imports-info dd {
    margin: 0.1rem 0 0;
    font-size: 0.9rem;
    overflow-wrap: anywhere;
}

.xls-imports-info dd.is-code {
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: 0.75rem;
}

.xls-imports-tabs {
    display: flex;
    gap: 0.25rem;
    border-bottom: 1px solid var(--md-sys-color-outline-variant);
}

.xls-imports-tabs__tab {
    padding: 0.6rem 1rem;
    border: 0;
    border-bottom: 2px solid transparent;
    background: transparent;
    color: var(--md-sys-color-on-surface-variant);
    font: inherit;
    font-weight: 600;
    cursor: pointer;
}

.xls-imports-tabs__tab.is-active {
    border-bottom-color: var(--md-sys-color-primary);
    color: var(--md-sys-color-primary);
}

.xls-imports-vehicle-link {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    color: var(--md-sys-color-primary);
    font-weight: 700;
    text-decoration: none;
}

.xls-imports-vehicle-link:hover {
    text-decoration: underline;
}

.xls-imports-vehicle-link .material-symbols-outlined {
    font-size: 0.95rem;
}

/* Invio in asta B2Bid (lista Stock): anteprima, avanzamento ed esito */
.vehicles-b2bid-dialog {
    width: min(100%, 44rem);
    max-height: min(44rem, calc(100vh - 3rem));
}

.vehicles-b2bid-dialog__body {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    flex: 1 1 auto;
    min-height: 10rem;
    padding: 1rem 1.35rem;
    overflow-y: auto;
    border-top: 1px solid var(--md-sys-color-outline-variant);
}

.vehicles-b2bid-dialog__summary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(8.5rem, 1fr));
    gap: 0.75rem;
}

.vehicles-b2bid-dialog__stat {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    padding: 0.85rem 1rem;
    border-radius: 0.9rem;
    background: var(--md-sys-color-surface-container);
}

.vehicles-b2bid-dialog__stat .material-symbols-outlined {
    color: var(--md-sys-color-on-surface-variant);
}

.vehicles-b2bid-dialog__stat strong {
    font-size: 1.5rem;
    line-height: 1.1;
}

.vehicles-b2bid-dialog__stat span:last-child {
    color: var(--md-sys-color-on-surface-variant);
    font-size: 0.85rem;
}

.vehicles-b2bid-dialog__stat.has-problems strong {
    color: var(--md-sys-color-error);
}

.vehicles-b2bid-dialog__list h3 {
    margin: 0 0 0.5rem;
    font-size: 0.95rem;
}

.vehicles-b2bid-dialog__list ul {
    margin: 0;
    padding: 0;
    list-style: none;
    border: 1px solid var(--md-sys-color-outline-variant);
    border-radius: 0.75rem;
}

.vehicles-b2bid-dialog__list li {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.35rem 0.75rem;
    padding: 0.6rem 0.85rem;
    font-size: 0.9rem;
}

.vehicles-b2bid-dialog__list li + li {
    border-top: 1px solid var(--md-sys-color-outline-variant);
}

.vehicles-b2bid-dialog__list li > span:last-child {
    color: var(--md-sys-color-on-surface-variant);
}

.vehicles-b2bid-dialog__progress {
    height: 0.5rem;
    overflow: hidden;
    border-radius: 999px;
    background: var(--md-sys-color-surface-container-high, var(--md-sys-color-surface-container));
}

.vehicles-b2bid-dialog__progress-bar {
    display: block;
    height: 100%;
    background: var(--md-sys-color-primary);
    transition: width 0.3s ease;
}

.vehicle-detail__qr-btn:disabled {
    cursor: default;
    opacity: 1;
}

/* Personalizzazioni Plus: notifiche push (Firebase) */
.settings-firebase__info {
    display: grid;
    grid-template-columns: repeat(3, auto);
    justify-content: start;
    gap: 0.5rem 2.5rem;
    margin: 0.75rem 0 0;
}

.settings-firebase__info dt {
    color: var(--md-sys-color-on-surface-variant);
    font-size: 0.78rem;
}

.settings-firebase__info dd {
    margin: 0;
    overflow-wrap: anywhere;
    font-weight: 500;
}

.settings-firebase__info p {
    grid-column: 1 / -1;
    margin: 0;
}

@media (max-width: 720px) {
    .settings-firebase__info {
        grid-template-columns: 1fr;
    }
}

.settings-firebase__editor,
.settings-firebase__test {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    margin-top: 1rem;
}

.settings-firebase__textarea {
    min-height: 8rem;
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: 0.8rem;
    resize: vertical;
}

.settings-firebase__editor-actions,
.settings-firebase__test-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-end;
    gap: 0.5rem;
}

.settings-firebase__test-row .md-field {
    flex: 1 1 18rem;
}

/* «Avvisa i fotografi» (lista Stock e scheda): riepilogo, fotografi filtrabili */
.vehicles-photo-request-dialog {
    width: min(100%, 44rem);
    max-height: min(46rem, calc(100vh - 3rem));
}

.vehicles-photo-request-dialog__body {
    display: flex;
    flex-direction: column;
    gap: 0.9rem;
    flex: 1 1 auto;
    min-height: 10rem;
    padding: 1rem 1.35rem;
    overflow-y: auto;
    border-top: 1px solid var(--md-sys-color-outline-variant);
}

.vehicles-photo-request-dialog__summary {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    margin: 0;
    padding: 0.75rem 1rem;
    list-style: none;
    border-radius: 0.9rem;
    background: var(--md-sys-color-surface-container);
}

.vehicles-photo-request-dialog__summary li {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.92rem;
}

.vehicles-photo-request-dialog__summary .material-symbols-outlined {
    font-size: 1.15rem;
    color: var(--md-sys-color-on-surface-variant);
}

.vehicles-photo-request-dialog__summary li.is-warning .material-symbols-outlined {
    color: var(--md-sys-color-tertiary, #b26a00);
}

.vehicles-photo-request-dialog__head {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem 1rem;
}

.vehicles-photo-request-dialog__head h3 {
    margin: 0;
    font-size: 0.95rem;
}

.vehicles-photo-request-dialog__search {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    flex: 1 1 14rem;
    max-width: 20rem;
    padding: 0.35rem 0.75rem;
    border: 1px solid var(--md-sys-color-outline-variant);
    border-radius: 999px;
}

.vehicles-photo-request-dialog__search input {
    flex: 1;
    min-width: 0;
    border: 0;
    outline: 0;
    background: transparent;
    color: inherit;
    font: inherit;
}

.vehicles-photo-request-dialog__search .material-symbols-outlined {
    font-size: 1.1rem;
    color: var(--md-sys-color-on-surface-variant);
}

.vehicles-photo-request-dialog__list {
    margin: 0;
    padding: 0;
    list-style: none;
    border: 1px solid var(--md-sys-color-outline-variant);
    border-radius: 0.75rem;
}

.vehicles-photo-request-dialog__list li {
    padding: 0.55rem 0.85rem;
}

.vehicles-photo-request-dialog__list li + li {
    border-top: 1px solid var(--md-sys-color-outline-variant);
}

.vehicles-photo-request-dialog__list li.is-selected {
    background: var(--md-sys-color-secondary-container, var(--md-sys-color-surface-container));
}

.vehicles-photo-request-dialog__photographer {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    cursor: pointer;
}

.vehicles-photo-request-dialog__name {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-width: 0;
}

.vehicles-photo-request-dialog__name small,
.vehicles-photo-request-dialog__device {
    color: var(--md-sys-color-on-surface-variant);
    font-size: 0.82rem;
}

.vehicles-photo-request-dialog__device {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    white-space: nowrap;
}

.vehicles-photo-request-dialog__device .material-symbols-outlined {
    font-size: 1.05rem;
}

.vehicles-photo-request-dialog__device.is-off {
    opacity: 0.7;
}

.vehicles-photo-request-dialog__note {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    margin: 0.3rem 0 0 1.95rem;
    color: var(--md-sys-color-on-surface-variant);
    font-size: 0.82rem;
}

.vehicles-photo-request-dialog__note .material-symbols-outlined {
    font-size: 1rem;
}

/* Scheda veicolo: richieste «Da fotografare» aperte */
.vehicle-detail__photo-requests {
    margin-top: 0.9rem;
    padding: 0.7rem 0.9rem;
    border-radius: 0.9rem;
    background: var(--md-sys-color-surface-container);
}

.vehicle-detail__photo-requests > .vehicle-detail__stat-label {
    display: flex;
    align-items: center;
    gap: 0.35rem;
}

.vehicle-detail__photo-requests > .vehicle-detail__stat-label .material-symbols-outlined {
    font-size: 1.05rem;
}

.vehicle-detail__photo-requests ul {
    margin: 0.35rem 0 0;
    padding: 0;
    list-style: none;
}

.vehicle-detail__photo-requests li {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.25rem 0.6rem;
    min-height: 2.25rem;
    font-size: 0.9rem;
}

.vehicle-detail__photo-requests li > span {
    flex: 1;
    color: var(--md-sys-color-on-surface-variant);
}

/* Scheda veicolo: classificazione sul catalogo superbrands replicato */
.vehicle-detail__catalog {
    margin-top: 0.9rem;
}

.vehicle-detail__catalog-head {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    min-height: 2.25rem;
}

.vehicle-detail__catalog-head .vehicle-detail__stat-label {
    margin-bottom: 0;
}

.vehicle-detail__catalog-edit {
    margin-left: auto;
}

.vehicle-detail__catalog-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.55rem;
    margin-top: 0.4rem;
}

.vehicle-detail__catalog-form .md-field--outline {
    margin: 0;
}

.vehicle-detail__catalog-actions {
    grid-column: 1 / -1;
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
}

/* Esito del centro e segnalazione (DEV-59 del centro superbrands) */
.vehicle-detail__catalog-wide {
    grid-column: 1 / -1;
}

.vehicle-detail__catalog-wide .md-chip {
    margin-left: 0.4rem;
    min-height: 22px;
}

.vehicle-detail__correction-chip--ok {
    background: rgba(15, 123, 63, 0.12);
    color: var(--md-sys-color-success);
}

.vehicle-detail__correction-chip--ko {
    background: var(--md-sys-color-error-container);
    color: var(--md-sys-color-error);
}

.stock-rule-catalog-toggle {
    margin-bottom: 0.5rem;
}

@media (max-width: 720px) {
    .vehicle-detail__catalog-grid {
        grid-template-columns: minmax(0, 1fr);
    }
}

/* Luoghi QR */
.qr-places-page {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.qr-places-toolbar {
    grid-template-columns: minmax(14rem, 2fr) repeat(3, minmax(10rem, 1fr)) auto;
}

.qr-places-toolbar > .md-btn {
    justify-self: start;
    width: auto;
}

.qr-places-page .md-table__num {
    text-align: right;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.qr-places-page .md-table tr.is-muted td:not(.md-table__actions) {
    color: var(--md-sys-color-on-surface-variant);
}

.qr-places-page .md-field--outline textarea {
    font: inherit;
    padding: 0.7rem 0.9rem 0.45rem;
    resize: vertical;
}

.qr-places-page__description {
    margin-top: 0.15rem;
    font-size: 0.85rem;
    color: var(--md-sys-color-on-surface-variant);
    overflow-wrap: anywhere;
}

.qr-place-detail {
    gap: 1.5rem;
}

.qr-place-detail__qr {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
    padding: 1.25rem 1rem;
    border: 1px solid var(--md-sys-color-outline-variant);
    border-radius: var(--md-sys-shape-corner-md, 12px);
    background: var(--md-sys-color-surface-container-low);
}

.qr-place-detail__image {
    width: min(280px, 100%);
    height: auto;
    aspect-ratio: 1;
    padding: 0.5rem;
    border-radius: var(--md-sys-shape-corner-sm);
    background: #fff;
}

.qr-place-detail__code {
    font-size: 0.9rem;
    letter-spacing: 0.08em;
    color: var(--md-sys-color-on-surface-variant);
}

.qr-place-detail__code strong {
    color: var(--md-sys-color-on-surface);
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}

.qr-place-detail__downloads {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.5rem;
}

.qr-place-detail__info .md-field__readonly {
    color: var(--md-sys-color-on-surface);
    overflow-wrap: anywhere;
}

.qr-place-detail__tab-actions {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 0.75rem;
}

@media (max-width: 900px) {
    .qr-places-toolbar {
        grid-template-columns: minmax(0, 1fr);
    }
}

.vehicles-qr-place {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    white-space: nowrap;
}

.vehicles-qr-place .material-symbols-outlined {
    font-size: 1rem;
    color: var(--md-sys-color-primary);
}

.vehicles-qr-place.is-disabled {
    color: var(--md-sys-color-on-surface-variant);
    text-decoration: line-through;
}

.vehicles-qr-place.is-disabled .material-symbols-outlined {
    color: inherit;
}

/* Dialog Luogo QR della scheda veicolo */
.md-dialog--qr-place {
    width: min(100%, 34rem);
}

/* Scheda veicolo: dialog Vista 360 / Wrap360 */
.vehicle-wrap360-dialog {
    width: min(100%, 40rem);
    display: flex;
    flex-direction: column;
    gap: 1.1rem;
}

.vehicle-wrap360-dialog__section {
    display: flex;
    flex-direction: column;
    gap: 0.7rem;
    padding-top: 1rem;
    border-top: 1px solid var(--md-sys-color-outline-variant, #e3e6ea);
}

.vehicle-wrap360-dialog__heading {
    margin: 0;
    font-size: 0.95rem;
    font-weight: 600;
}

.vehicle-wrap360-dialog__hint,
.vehicle-wrap360-dialog__empty {
    margin: 0;
    font-size: 0.875rem;
    line-height: 1.45;
    color: var(--md-sys-color-on-surface-variant);
}

.vehicle-wrap360-dialog__links {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.55rem;
}

.vehicle-wrap360-dialog__link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.65rem 0.75rem;
    border: 1px solid var(--md-sys-color-outline-variant, #e3e6ea);
    border-radius: 12px;
}

.vehicle-wrap360-dialog__link-icon {
    color: var(--md-sys-color-primary);
}

.vehicle-wrap360-dialog__link-text {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}

.vehicle-wrap360-dialog__url {
    font-size: 0.8rem;
    color: var(--md-sys-color-on-surface-variant);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

@media (max-width: 560px) {
    .vehicle-wrap360-dialog__link {
        flex-wrap: wrap;
    }
}

.vehicle-qr-place-dialog__since {
    margin: 0.2rem 0 0;
    font-size: 0.85rem;
    color: var(--md-sys-color-on-surface-variant);
}

.vehicle-qr-place-dialog__assign {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 0.75rem;
    align-items: end;
    margin-top: 1.1rem;
}

.vehicle-qr-place-dialog__history-title {
    margin: 1.25rem 0 0.5rem;
    font-size: 0.8rem;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--md-sys-color-on-surface-variant);
}

.vehicle-qr-place-dialog__empty {
    margin: 0;
    font-size: 0.9rem;
    color: var(--md-sys-color-on-surface-variant);
}

.vehicle-qr-place-dialog__history {
    display: flex;
    flex-direction: column;
    gap: 0.55rem;
    max-height: 16rem;
    margin: 0;
    padding: 0;
    overflow-y: auto;
    list-style: none;
}

.vehicle-qr-place-dialog__history li {
    display: flex;
    flex-wrap: wrap;
    gap: 0.2rem 0.5rem;
    padding-bottom: 0.55rem;
    border-bottom: 1px solid var(--md-sys-color-outline-variant);
}

.vehicle-qr-place-dialog__from {
    color: var(--md-sys-color-on-surface-variant);
}

.vehicle-qr-place-dialog__meta {
    flex-basis: 100%;
    font-size: 0.82rem;
    color: var(--md-sys-color-on-surface-variant);
}

@media (max-width: 600px) {
    .vehicle-qr-place-dialog__assign {
        grid-template-columns: minmax(0, 1fr);
    }
}

/* Utenti: email sotto il nome, colonna e pannello dell'App mobile. */
.users-name {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.users-name span {
    color: var(--md-sys-color-on-surface-variant);
    font-size: 0.78rem;
}

.users-app {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
}

.users-app__icon {
    font-size: 18px;
    color: var(--md-sys-color-success);
}

.users-app.is-off .users-app__icon,
.users-app.is-off .users-app__version {
    color: var(--md-sys-color-on-surface-variant);
}

.users-app__version {
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}

.users-app__note,
.users-app--none {
    color: var(--md-sys-color-on-surface-variant);
    font-size: 0.78rem;
}

.md-badge--neutral {
    background: var(--md-sys-color-surface-container-high);
    color: var(--md-sys-color-on-surface-variant);
}

.users-app-empty {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 16px;
    border: 1px dashed var(--md-sys-color-outline);
    border-radius: var(--md-sys-shape-corner-md);
    color: var(--md-sys-color-on-surface-variant);
    font-size: 0.88rem;
}

.users-devices {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.users-device {
    display: flex;
    gap: 14px;
    padding: 14px 16px;
    border: 1px solid var(--md-sys-color-outline-variant);
    border-radius: var(--md-sys-shape-corner-md);
    background: var(--md-sys-color-surface-container);
}

.users-device__icon {
    display: grid;
    flex: 0 0 auto;
    place-items: center;
    width: 40px;
    height: 40px;
    border-radius: 12px;
    background: rgba(15, 123, 63, 0.12);
    color: var(--md-sys-color-success);
    font-size: 22px;
}

.users-device.is-off .users-device__icon {
    background: var(--md-sys-color-surface-container-high);
    color: var(--md-sys-color-on-surface-variant);
}

.users-device__body {
    flex: 1;
    min-width: 0;
}

.users-device__title {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    justify-content: space-between;
    gap: 4px 12px;
}

.users-device__version {
    font-size: 0.85rem;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}

.users-device__meta {
    margin: 2px 0 8px;
    color: var(--md-sys-color-on-surface-variant);
    font-size: 0.8rem;
}

.users-device__tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.users-device__tags .md-chip {
    gap: 4px;
}

.users-device__tags .material-symbols-outlined {
    font-size: 16px;
}

/* Card e drawer Wrap360 (Personalizzazioni Plus) */
.wrap360-accounts {
    margin-top: 0.5rem;
}

.wrap360-accounts__table {
    overflow-x: auto;
}

.wrap360-accounts__notes {
    display: block;
    color: var(--md-sys-color-on-surface-variant);
    font-size: 0.82rem;
}

.wrap360-accounts__sets {
    color: var(--md-sys-color-on-surface-variant);
    font-size: 0.85rem;
}

.wrap360-endpoints {
    margin-top: 1.25rem;
    padding-top: 1rem;
    border-top: 1px solid var(--md-sys-color-outline-variant);
}

.wrap360-endpoints h4 {
    margin: 0 0 0.25rem;
}

.wrap360-sets {
    list-style: none;
    margin: 0.75rem 0 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}

.wrap360-set {
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    padding: 0.6rem 0.5rem 0.6rem 0.25rem;
    border: 1px solid var(--md-sys-color-outline-variant);
    border-radius: 12px;
    background: var(--md-sys-color-surface);
}

.wrap360-set.sortable-ghost {
    opacity: 0.45;
}

.wrap360-set__handle {
    cursor: grab;
    color: var(--md-sys-color-on-surface-variant);
    padding-top: 0.9rem;
}

.wrap360-set__position {
    min-width: 1.5rem;
    padding-top: 0.95rem;
    font-weight: 600;
    color: var(--md-sys-color-on-surface-variant);
    text-align: center;
}

.wrap360-set__fields {
    flex: 1;
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 12rem);
    gap: 0.5rem 0.75rem;
}

.wrap360-set__fields .md-field {
    margin: 0;
}

.wrap360-set__frames {
    grid-column: 1 / -1;
}

.wrap360-set__frames-label {
    display: block;
    font-size: 0.8rem;
    color: var(--md-sys-color-on-surface-variant);
    margin-bottom: 0.25rem;
}

.wrap360-frames {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.35rem;
    min-height: 2.5rem;
    padding: 0.3rem 0.5rem;
    border: 1px solid var(--md-sys-color-outline);
    border-radius: 8px;
}

.wrap360-frames:focus-within {
    border-color: var(--md-sys-color-primary);
    box-shadow: 0 0 0 1px var(--md-sys-color-primary);
}

.wrap360-frames__list {
    display: contents;
    list-style: none;
    margin: 0;
    padding: 0;
}

.wrap360-frame {
    cursor: grab;
    display: inline-flex;
    align-items: center;
    gap: 0.15rem;
    padding-right: 0.2rem;
}

.wrap360-frame__remove {
    display: inline-flex;
    border: 0;
    background: transparent;
    padding: 0;
    cursor: pointer;
    color: inherit;
}

.wrap360-frame__remove .material-symbols-outlined {
    font-size: 1rem;
}

.wrap360-frames__all {
    font-style: italic;
    color: var(--md-sys-color-on-surface-variant);
}

.wrap360-frames__input {
    flex: 1;
    min-width: 7rem;
    border: 0;
    outline: none;
    background: transparent;
    font: inherit;
    padding: 0.2rem 0;
}

.wrap360-seen {
    margin-top: 0.85rem;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.wrap360-seen__chips {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
}

.wrap360-seen__chips .md-chip {
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 0.2rem;
    border: 0;
}

.wrap360-seen__chips .material-symbols-outlined {
    font-size: 1rem;
}

@media (max-width: 640px) {
    .wrap360-set__fields {
        grid-template-columns: 1fr;
    }
}

/* Drawer dell'account Wrap360: due colonne con scroll indipendente (set a destra, riordinabili senza scorrere il resto). */
.wrap360-drawer__body {
    overflow: hidden;
    padding-bottom: 0;
}

.wrap360-drawer__columns {
    flex: 1;
    min-height: 0;
    display: grid;
    grid-template-columns: minmax(0, 5fr) minmax(0, 6fr);
    gap: 0 1.5rem;
}

.wrap360-drawer__col {
    min-height: 0;
    overflow: auto;
    padding: 0 0.25rem 1.5rem 0;
}

.wrap360-drawer__col--sets {
    padding-left: 1.5rem;
    border-left: 1px solid var(--md-sys-color-outline-variant);
}

.wrap360-drawer__sets {
    border-bottom: 0;
}

@media (max-width: 900px) {
    .wrap360-drawer__body {
        overflow: auto;
    }

    .wrap360-drawer__columns {
        display: block;
    }

    .wrap360-drawer__col {
        overflow: visible;
        padding: 0;
    }

    .wrap360-drawer__col--sets {
        padding-left: 0;
        border-left: 0;
    }
}

/* Drawer Wrap360: copia set e «Prova su uno scatto» */
.wrap360-sets__actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.wrap360-sets__copy {
    max-width: 14rem;
    height: 2.5rem;
    padding: 0 0.6rem;
    border: 1px solid var(--md-sys-color-outline);
    border-radius: 999px;
    background: var(--md-sys-color-surface);
    font: inherit;
}

.wrap360-preview__search {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
}

.wrap360-preview__search .md-field {
    flex: 1;
    margin: 0;
}

.wrap360-preview__search .md-btn {
    margin-top: 0.35rem;
}

.wrap360-preview__result {
    margin-top: 0.75rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.wrap360-preview__result-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    color: var(--md-sys-color-on-surface-variant);
}

.wrap360-shoot {
    border: 1px solid var(--md-sys-color-outline-variant);
    border-radius: 12px;
    padding: 0.75rem;
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}

.wrap360-shoot__head {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.wrap360-shoot__vehicles {
    margin: 0.25rem 0 0;
    padding-left: 1.1rem;
}

.wrap360-shoot__summary {
    margin: 0;
    font-weight: 500;
}

.wrap360-shoot__warnings {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    color: var(--md-sys-color-on-surface-variant);
}

.wrap360-shoot__warnings li {
    display: flex;
    gap: 0.35rem;
    align-items: flex-start;
}

.wrap360-shoot__warnings .material-symbols-outlined {
    font-size: 1.1rem;
    color: #b26a00;
}

.wrap360-shoot__links {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.wrap360-shoot__set h4 {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin: 0 0 0.4rem;
}

.wrap360-shoot__set.is-ignored {
    opacity: 0.55;
}

.wrap360-thumbs {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(96px, 1fr));
    gap: 0.4rem;
}

.wrap360-thumb {
    position: relative;
    border-radius: 6px;
    overflow: hidden;
    aspect-ratio: 4 / 3;
    background: var(--md-sys-color-surface-variant, #eef1f4);
    outline: 2px solid transparent;
}

.wrap360-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    opacity: 0.45;
}

.wrap360-thumb.is-selected {
    outline-color: var(--md-sys-color-primary);
}

.wrap360-thumb.is-selected img {
    opacity: 1;
}

.wrap360-thumb.is-pano {
    outline: 2px dashed var(--md-sys-color-outline);
}

.wrap360-thumb__frame,
.wrap360-thumb__order {
    position: absolute;
    top: 3px;
    padding: 0 0.35rem;
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 600;
    line-height: 1.35rem;
}

.wrap360-thumb__frame {
    left: 3px;
    background: rgba(255, 255, 255, 0.9);
    color: var(--md-sys-color-on-surface);
}

.wrap360-thumb__order {
    right: 3px;
    min-width: 1.35rem;
    text-align: center;
    background: var(--md-sys-color-primary);
    color: var(--md-sys-color-on-primary);
}

.wrap360-access__actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 0.5rem;
}

/* Voce di menu Wrap360: contatore degli scatti da gestire */
.nav-item__badge {
    margin-left: auto;
    min-width: 1.35rem;
    padding: 0 0.4rem;
    border-radius: 999px;
    background: var(--md-sys-color-error);
    color: var(--md-sys-color-on-error);
    font-size: 0.72rem;
    font-weight: 600;
    line-height: 1.35rem;
    text-align: center;
}

.app-shell.nav-collapsed .nav-item__badge {
    position: absolute;
    top: 2px;
    right: 2px;
    min-width: 1.1rem;
    padding: 0 0.25rem;
    font-size: 0.65rem;
    line-height: 1.1rem;
}

/* Pagina Wrap360 */
.wrap360-summary {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.wrap360-summary__card {
    padding: 0.9rem 1rem;
    border-radius: 14px;
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
}

.wrap360-summary__card.is-off {
    opacity: 0.7;
}

.wrap360-summary__card header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
}

.wrap360-summary__card p {
    margin: 0;
}

.wrap360-summary__sets {
    font-size: 0.85rem;
}

.wrap360-summary__meta,
.wrap360-muted {
    color: var(--md-sys-color-on-surface-variant);
    font-size: 0.82rem;
}

.wrap360-inline-icon {
    font-size: 1rem;
    vertical-align: -3px;
    margin-right: 0.2rem;
    color: #b26a00;
}

.wrap360-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    margin: 1rem 0 0.75rem;
}

.wrap360-tabs__tab {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.4rem 0.9rem;
    border: 1px solid var(--md-sys-color-outline-variant);
    border-radius: 999px;
    background: var(--md-sys-color-surface);
    font: inherit;
    cursor: pointer;
}

.wrap360-tabs__tab.is-active {
    background: var(--md-sys-color-primary);
    border-color: var(--md-sys-color-primary);
    color: var(--md-sys-color-on-primary);
}

.wrap360-tabs__count {
    min-width: 1.4rem;
    padding: 0 0.35rem;
    border-radius: 999px;
    background: rgba(0, 0, 0, 0.08);
    font-size: 0.75rem;
    line-height: 1.3rem;
    text-align: center;
}

.wrap360-tabs__tab.is-active .wrap360-tabs__count {
    background: rgba(255, 255, 255, 0.25);
}

.wrap360-tabs__tab.is-alert:not(.is-active) .wrap360-tabs__count {
    background: var(--md-sys-color-error);
    color: var(--md-sys-color-on-error);
}

.wrap360-code {
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    letter-spacing: 0.02em;
}

.wrap360-facts {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 0.6rem 1.25rem;
    margin: 0 0 0.75rem;
}

.wrap360-facts dt {
    font-size: 0.78rem;
    color: var(--md-sys-color-on-surface-variant);
}

.wrap360-facts dd {
    margin: 0.1rem 0 0;
}

.wrap360-candidates {
    list-style: none;
    margin: 0.5rem 0 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.wrap360-candidates li {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--md-sys-color-outline-variant);
    border-radius: 10px;
}

.wrap360-candidates li.is-selected {
    border-color: var(--md-sys-color-primary);
    box-shadow: 0 0 0 1px var(--md-sys-color-primary);
}

.wrap360-candidates label {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    cursor: pointer;
    flex: 1;
}

.wrap360-replace {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

/* Il dialogo di abbinamento si apre sopra il dettaglio dello scatto */
.wrap360-match-scrim {
    z-index: 70;
}

.wrap360-match {
    z-index: 71;
}

/* Dialogo «Abbina a un veicolo» */
.wrap360-match__body {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.wrap360-match__section {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.wrap360-match__section + .wrap360-match__section {
    padding-top: 1.25rem;
    border-top: 1px solid var(--md-sys-color-outline-variant);
}

.wrap360-match__help {
    margin: 0;
    color: var(--md-sys-color-on-surface-variant);
    font-size: 0.88rem;
    line-height: 1.45;
}

.wrap360-match__search {
    display: flex;
    align-items: flex-end;
    gap: 0.75rem;
    padding-top: 0.6rem;
}

.wrap360-match__search .md-field {
    flex: 1;
    margin: 0;
}

.wrap360-match__search .md-btn {
    flex-shrink: 0;
    height: 2.75rem;
}

.wrap360-match__title {
    margin: 0;
    font-size: 0.78rem;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--md-sys-color-on-surface-variant);
}

.wrap360-match__empty {
    padding: 1rem;
    border: 1px dashed var(--md-sys-color-outline-variant);
    border-radius: 10px;
    text-align: center;
    color: var(--md-sys-color-on-surface-variant);
}

.wrap360-match__results {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.wrap360-match__vehicle {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 0.75rem 0.9rem;
    border: 1px solid var(--md-sys-color-outline-variant);
    border-radius: 12px;
    cursor: pointer;
    transition: border-color 0.15s ease, background 0.15s ease;
}

.wrap360-match__vehicle:hover {
    background: var(--md-sys-color-surface-variant, #f3f5f8);
}

.wrap360-match__vehicle.is-selected {
    border-color: var(--md-sys-color-primary);
    box-shadow: 0 0 0 1px var(--md-sys-color-primary);
}

.wrap360-match__vehicle input {
    margin-top: 0.2rem;
}

.wrap360-match__vehicle-text {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    min-width: 0;
}

.wrap360-match__vehicle-text strong {
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    letter-spacing: 0.02em;
}

.wrap360-match__vehicle-text small {
    color: var(--md-sys-color-on-surface-variant);
    overflow-wrap: anywhere;
}

.wrap360-match__replace {
    display: flex;
    align-items: flex-start;
    gap: 0.6rem;
    padding: 0.7rem 0.9rem;
    border-radius: 10px;
    background: var(--md-sys-color-surface-variant, #f3f5f8);
    cursor: pointer;
}

.wrap360-match__replace input {
    margin-top: 0.15rem;
}
