/* UI compatta — meno padding, tabelle dense, meno scroll */

.ap-crumb {
    margin-bottom: 0.5rem;
    font-size: 0.75rem;
}

.ap-page-hd {
    margin-bottom: 0.75rem;
}

.ap-page-title {
    font-size: 1.25rem;
    font-weight: 700;
    line-height: 1.3;
}

.ap-page-sub {
    margin-top: 0.125rem;
    font-size: 0.8125rem;
    color: var(--color-muted);
}

.ap-section {
    margin-top: 1rem;
}

.ap-section-hd {
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.ap-section-title {
    font-size: 0.875rem;
    font-weight: 600;
}

[x-cloak] {
    display: none !important;
}

.ap-panel {
    overflow: hidden;
    border-radius: 0.75rem;
    border: 1px solid rgba(108, 117, 125, 0.15);
    background: var(--color-bg-surface);
}

.ap-card {
    border-radius: 0.75rem;
    border: 1px solid rgba(108, 117, 125, 0.15);
    background: var(--color-bg-surface);
    padding: 0.5rem 0.625rem;
}

.ap-empty {
    border-radius: 0.75rem;
    border: 1px dashed rgba(108, 117, 125, 0.25);
    background: rgba(248, 249, 250, 0.5);
    padding: 0.875rem;
    text-align: center;
    font-size: 0.8125rem;
    color: var(--color-muted);
}

.ap-table-wrap {
    overflow-x: auto;
    border-radius: 0.75rem;
    border: 1px solid rgba(108, 117, 125, 0.15);
}

.ap-table {
    width: 100%;
    min-width: 100%;
    border-collapse: collapse;
    font-size: 0.75rem;
    line-height: 1.25;
}

.ap-table thead {
    background: #F8F9FA;
}

.ap-table th {
    padding: 0.3rem 0.5rem;
    text-align: left;
    font-size: 0.625rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--color-muted);
    white-space: nowrap;
}

.ap-table th.ap-num,
.ap-table td.ap-num {
    text-align: right;
}

.ap-table td {
    padding: 0.3rem 0.5rem;
    color: #212529;
    vertical-align: middle;
}

.ap-table tbody tr {
    border-top: 1px solid rgba(108, 117, 125, 0.1);
}

.ap-table tbody tr:hover {
    background: rgba(248, 249, 250, 0.65);
}

.ap-table .ap-muted {
    color: var(--color-muted);
}

.ap-table .ap-bold {
    font-weight: 600;
}

.ap-list {
    display: flex;
    flex-direction: column;
    gap: 0.375rem;
}

.ap-list-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    border-radius: 0.625rem;
    border: 1px solid rgba(108, 117, 125, 0.15);
    background: var(--color-bg-surface);
    padding: 0.4375rem 0.5rem;
}

.ap-list-row-icon {
    flex-shrink: 0;
    display: flex;
    height: 1.625rem;
    width: 1.625rem;
    align-items: center;
    justify-content: center;
    border-radius: 0.4375rem;
}

.ap-list-row-icon svg {
    height: 0.875rem;
    width: 0.875rem;
}

.ap-list-row-body {
    min-width: 0;
    flex: 1;
}

.ap-list-row-title {
    font-size: 0.8125rem;
    font-weight: 500;
    line-height: 1.25;
}

.ap-list-row-sub {
    font-size: 0.6875rem;
    color: var(--color-muted);
    line-height: 1.25;
}

.ap-list-row-end {
    flex-shrink: 0;
    font-size: 0.75rem;
    font-weight: 600;
}

.ap-tabs {
    display: flex;
    gap: 0.125rem;
    overflow-x: auto;
    padding: 0.25rem 0.5rem 0;
    margin-bottom: -1px;
}

.ap-tab {
    display: inline-flex;
    flex-shrink: 0;
    align-items: center;
    gap: 0.3125rem;
    border: 0;
    border-bottom: 2px solid transparent;
    background: transparent;
    padding: 0.375rem 0.5rem;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--color-muted);
    white-space: nowrap;
    cursor: pointer;
    transition: color 0.15s, border-color 0.15s;
}

.ap-tab:hover {
    color: #212529;
    border-bottom-color: rgba(108, 117, 125, 0.35);
}

.ap-tab--active {
    color: var(--color-primary);
    border-bottom-color: var(--color-primary);
}

.ap-tab--active:hover {
    color: var(--color-primary);
    border-bottom-color: var(--color-primary);
}

.ap-tab-badge {
    border-radius: 9999px;
    padding: 0 0.3125rem;
    font-size: 0.625rem;
    font-weight: 500;
    line-height: 1.25rem;
    background: #F8F9FA;
    color: var(--color-muted);
}

.ap-tab-badge--active {
    background: rgba(26, 90, 54, 0.1);
    color: var(--color-primary);
}

.ap-tab-panel {
    padding: 0.625rem;
}

.ap-kpi-label {
    font-size: 0.625rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--color-muted);
}

.ap-kpi-value {
    margin-top: 0.125rem;
    font-size: 0.875rem;
    font-weight: 700;
    line-height: 1.25;
}

.ap-form label {
    display: block;
    margin-bottom: 0.25rem;
    font-size: 0.8125rem;
    font-weight: 500;
}

.ap-form .ap-input,
.ap-form input:not([type="checkbox"]):not([type="radio"]),
.ap-form select,
.ap-form textarea {
    width: 100%;
    border-radius: 0.5rem;
    border: 1px solid rgba(108, 117, 125, 0.3);
    background: var(--color-bg-surface);
    padding: 0.375rem 0.625rem;
    font-size: 0.8125rem;
    color: #212529;
}

.ap-form textarea {
    min-height: 4rem;
}

.ap-form .ap-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.5rem;
    border-top: 1px solid rgba(108, 117, 125, 0.2);
    padding-top: 0.75rem;
}

.ap-btn {
    border-radius: 0.5rem;
    padding: 0.375rem 0.75rem;
    font-size: 0.8125rem;
    font-weight: 600;
}

.ap-btn-primary {
    background: var(--color-accent);
    color: #fff;
}

.ap-btn-ghost {
    border: 1px solid rgba(108, 117, 125, 0.3);
    color: var(--color-muted);
}

.ap-veicolo-summary {
    display: grid;
    gap: 0.5rem;
}

@media (min-width: 1024px) {
    .ap-veicolo-summary {
        grid-template-columns: minmax(13rem, 2fr) minmax(18rem, 3fr);
        align-items: stretch;
    }
}

.ap-veicolo-card {
    display: flex;
    min-height: 11.5rem;
}

@media (min-width: 1024px) {
    .ap-veicolo-card {
        min-height: 100%;
    }
}

.ap-veicolo-card-media {
    position: relative;
    flex: 1;
    min-height: 11.5rem;
    background: #F8F9FA;
}

.ap-veicolo-card-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(to top, rgba(33, 37, 41, 0.92) 0%, rgba(33, 37, 41, 0.55) 42%, rgba(33, 37, 41, 0.15) 100%);
}

.ap-veicolo-card-body {
    position: absolute;
    inset: auto 0 0 0;
    padding: 0.875rem;
}

.ap-stat-grid {
    display: grid;
    gap: 0.5rem;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-content: start;
}

@media (min-width: 640px) {
    .ap-stat-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

.ap-stat-tile {
    border-radius: 0.75rem;
    border: 1px solid rgba(108, 117, 125, 0.15);
    background: var(--color-bg-surface);
    padding: 0.5rem 0.625rem;
}

.ap-stat-tile--primary {
    border-color: rgba(26, 90, 54, 0.2);
    background: rgba(26, 90, 54, 0.04);
}

.ap-stat-tile--warning {
    border-color: rgba(239, 108, 0, 0.25);
    background: rgba(239, 108, 0, 0.06);
}

.ap-stat-tile--success {
    border-color: rgba(46, 125, 50, 0.2);
    background: rgba(46, 125, 50, 0.05);
}

.ap-stat-tile-sub {
    margin-top: 0.125rem;
    font-size: 0.6875rem;
    line-height: 1.25;
    color: var(--color-muted);
}

@media (min-width: 640px) {
    .ap-stat-tile--wide {
        grid-column: span 3;
    }
}

@media (max-width: 639px) {
    .ap-stat-tile--wide {
        grid-column: span 2;
    }
}

.ap-tab-cards {
    display: grid;
    gap: 0.5rem;
    width: fit-content;
    max-width: 100%;
    grid-template-columns: repeat(1, minmax(11rem, 1fr));
}

@media (min-width: 640px) {
    .ap-tab-cards {
        grid-template-columns: repeat(2, minmax(11rem, 14rem));
    }
}

@media (min-width: 1024px) {
    .ap-tab-cards {
        grid-template-columns: repeat(3, minmax(11rem, 14rem));
    }
}

.ap-tab-cards--2 {
    grid-template-columns: repeat(1, minmax(11rem, 1fr));
}

@media (min-width: 640px) {
    .ap-tab-cards--2 {
        grid-template-columns: repeat(2, minmax(11rem, 16rem));
    }
}

.ap-tab-cards--media {
    grid-template-columns: repeat(3, 4.5rem);
}

@media (min-width: 640px) {
    .ap-tab-cards--media {
        grid-template-columns: repeat(4, 4.5rem);
    }
}

@media (min-width: 1024px) {
    .ap-tab-cards--media {
        grid-template-columns: repeat(5, 4.5rem);
    }
}

.ap-tab-table {
    width: max-content;
    max-width: 100%;
}

.ap-tab-table--full {
    width: 100%;
}

.ap-dt-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

.ap-dt-search-wrap {
    position: relative;
    display: flex;
    align-items: center;
    min-width: 10rem;
    flex: 1 1 12rem;
    max-width: 18rem;
}

.ap-dt-search-icon {
    position: absolute;
    left: 0.5rem;
    height: 0.875rem;
    width: 0.875rem;
    color: var(--color-muted);
    pointer-events: none;
}

.ap-dt-search {
    width: 100%;
    border-radius: 0.5rem;
    border: 1px solid rgba(108, 117, 125, 0.25);
    background: var(--color-bg-surface);
    padding: 0.375rem 0.625rem 0.375rem 1.75rem;
    font-size: 0.75rem;
    color: #212529;
}

.ap-dt-search:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 1px var(--color-primary);
}

.ap-dt-toolbar-end {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    margin-left: auto;
}

.ap-dt-range {
    font-size: 0.6875rem;
    color: var(--color-muted);
    white-space: nowrap;
}

.ap-dt-pagesize-wrap {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
}

.ap-dt-pagesize-label {
    font-size: 0.6875rem;
    color: var(--color-muted);
}

.ap-dt-pagesize {
    border-radius: 0.4375rem;
    border: 1px solid rgba(108, 117, 125, 0.25);
    background: var(--color-bg-surface);
    padding: 0.25rem 0.375rem;
    font-size: 0.6875rem;
    color: #212529;
}

.ap-dt-sortable {
    cursor: pointer;
    user-select: none;
}

.ap-dt-sortable:hover {
    color: var(--color-primary);
}

.ap-dt-sorted {
    color: var(--color-primary);
}

.ap-dt-th-inner {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
}

.ap-dt-sort-icon {
    height: 0.75rem;
    width: 0.75rem;
    flex-shrink: 0;
}

.ap-dt-sort-icon--idle {
    opacity: 0.35;
}

.ap-dt-empty {
    padding: 0.75rem !important;
    text-align: center;
    color: var(--color-muted);
}

.ap-dt-footer {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-end;
    gap: 0.25rem;
    margin-top: 0.5rem;
}

.ap-dt-page-btn {
    min-width: 1.75rem;
    border-radius: 0.4375rem;
    border: 1px solid rgba(108, 117, 125, 0.2);
    background: var(--color-bg-surface);
    padding: 0.25rem 0.4375rem;
    font-size: 0.6875rem;
    font-weight: 600;
    color: var(--color-muted);
    transition: border-color 0.15s, color 0.15s, background 0.15s;
}

.ap-dt-page-btn:hover:not(:disabled) {
    border-color: rgba(26, 90, 54, 0.25);
    color: var(--color-primary);
    background: rgba(26, 90, 54, 0.04);
}

.ap-dt-page-btn--active {
    border-color: rgba(26, 90, 54, 0.3);
    background: rgba(26, 90, 54, 0.08);
    color: var(--color-primary);
}

.ap-dt-page-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.ap-tab-stats {
    display: grid;
    gap: 0.5rem;
    width: 100%;
    margin-bottom: 0.5rem;
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

@media (min-width: 640px) {
    .ap-tab-stats {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

@media (min-width: 1024px) {
    .ap-tab-stats {
        grid-template-columns: repeat(6, minmax(0, 1fr));
    }
}

.ap-empty--fit {
    width: fit-content;
    max-width: 100%;
    min-width: 12rem;
}

.ap-btn-sm { padding: 0.25rem 0.625rem; font-size: 0.75rem; }
.ap-btn-xs { padding: 0.125rem 0.5rem; font-size: 0.6875rem; }
.ap-modal-backdrop {
    position: fixed;
    inset: 0;
    z-index: 50;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(33, 37, 41, 0.45);
    padding: 1rem;
}
.ap-modal {
    width: 100%;
    max-width: 28rem;
    border-radius: 0.75rem;
    background: #fff;
    padding: 1rem;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.15);
}
.ap-modal-title { font-size: 1rem; font-weight: 700; margin-bottom: 0.75rem; }
.ap-modal-actions { display: flex; justify-content: flex-end; gap: 0.5rem; margin-top: 0.75rem; }
.ap-field { margin-bottom: 0.625rem; }
.ap-label { display: block; font-size: 0.75rem; font-weight: 600; color: var(--color-muted); margin-bottom: 0.25rem; }
.ap-input { width: 100%; border-radius: 0.5rem; border: 1px solid rgba(108, 117, 125, 0.25); padding: 0.375rem 0.625rem; font-size: 0.8125rem; }
.ap-check { display: flex; align-items: center; gap: 0.375rem; font-size: 0.8125rem; margin: 0.5rem 0; }
