body {
    background-color: #f8f9fc;
    color: #5a5c69;
}

@page {
    size: A4;
    margin: 1.2cm;
}

.calendar {
    margin-top: 1rem;
    border: 1px solid #e3e6f0;
    border-radius: 0.35rem;
    background: #fff;
}

.calendar-header {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid #e3e6f0;
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.85rem;
}

.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
}

.calendar-cell {
    min-height: 90px;
    border-right: 1px solid #e3e6f0;
    border-bottom: 1px solid #e3e6f0;
    padding: 0.5rem;
    font-size: 0.85rem;
    background: #fff;
}

.calendar-cell.header {
    background: #f8f9fc;
    font-weight: 600;
    text-align: center;
}

.calendar-cell.empty {
    background: #f8f9fc;
}

.calendar-cell.has-event {
    background: rgba(28, 200, 138, 0.12);
}

.calendar-cell .day-number {
    display: block;
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.calendar-cell .event {
    background: #fff;
    border: 1px solid #e3e6f0;
    border-radius: 0.35rem;
    padding: 0.35rem;
    margin-bottom: 0.35rem;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.calendar-cell .event strong {
    display: block;
    font-size: 0.8rem;
}

.calendar-link {
    margin-top: 0.75rem;
}

.print-layout {
    background: #fff;
    padding: 1rem;
}

.print-header {
    display: flex;
    justify-content: space-between;
    border-bottom: 2px solid #e3e6f0;
    margin-bottom: 1rem;
    padding-bottom: 1rem;
}

.print-body h3 {
    font-size: 0.95rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: #6c757d;
}

.print-toolbar {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1rem;
}

.preventivo-print .print-columns {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 1.5rem;
}

.preventivo-print .print-box {
    flex: 1;
    min-width: 220px;
}

.preventivo-print .print-box.align-right {
    text-align: right;
}

.print-section {
    margin-top: 1.5rem;
}

.print-section ul {
    margin: 0.5rem 0 0;
    padding-left: 1.2rem;
}

.rich-text p {
    margin-bottom: 0.75rem;
}

.rich-text p:last-child {
    margin-bottom: 0;
}

.rich-text ul,
.rich-text ol {
    margin: 0.75rem 0 0.5rem;
    padding-left: 1.25rem;
}

.rich-text li {
    margin-bottom: 0.35rem;
}

.print-rich-text p {
    margin: 0 0 0.5rem;
}

.print-rich-text p:last-child {
    margin-bottom: 0;
}

.print-rich-text ul,
.print-rich-text ol {
    margin: 0.75rem 0 0.5rem;
    padding-left: 1.25rem;
}

.print-rich-text li {
    margin-bottom: 0.35rem;
}

.drag-cell {
    width: 36px;
    text-align: center;
}

.drag-handle {
    cursor: grab;
    user-select: none;
    font-size: 1.1rem;
    line-height: 1;
    color: #6b7280;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 0.35rem;
    padding: 0.15rem 0.3rem;
}

.drag-handle:hover,
.drag-handle:focus {
    color: #2563eb;
    background: rgba(37, 99, 235, 0.1);
    outline: none;
}

.drag-handle:active {
    cursor: grabbing;
}

.sortable-ghost {
    opacity: 0.5;
    background: #e9f0ff;
}

.sortable-drag {
    opacity: 0.8;
}

.print-signature {
    display: flex;
    justify-content: space-between;
    gap: 2rem;
    margin-top: 2.5rem;
}

.signature-line {
    width: 220px;
    border-bottom: 1px solid #e3e6f0;
    margin-top: 1.5rem;
}

.empty {
    text-align: center;
    color: #858796;
}

.no-print {
    display: flex;
    gap: 1rem;
}

@media print {
    html,
    body { background: #fff !important; }
    .topbar,
    .footer,
    .sticky-footer,
    .copyright,
    .btn,
    .btn-link,
    .user-area,
    .no-print,
    .sidebar,
    .navbar-nav { display: none !important; }
    .container,
    .container-fluid,
    #content-wrapper,
    #content,
    #wrapper { padding: 0 !important; margin: 0 !important; background: #fff !important; }
    body { background: #fff; }
    .card { box-shadow: none !important; border: none !important; }
    .proforma-print,
    .preventivo-print { margin: 0 auto; }
}

.preventivo-tipo select {
    padding-left: 0.75rem;
    padding-right: 0.75rem;
}

.badge-proforma-bozza {
    background-color: #858796;
    color: #fff;
}

.badge-una-tantum {
    background-color: #f0a637;
    color: #fff;
    border-radius: 0.8rem;
    font-weight: 600;
    padding: 0.25rem 0.5rem;
}

.cliente-tab-panel {
    transition: box-shadow 180ms ease, transform 180ms ease;
}

.cliente-tab-panel.is-active {
    animation: clienteTabFadeIn 180ms ease-out;
}

.cliente-tab-panel.panel-flash {
    box-shadow: 0 0 0 2px rgba(78, 115, 223, 0.22), 0 0.15rem 0.75rem rgba(58, 59, 69, 0.15) !important;
    transform: translateY(-1px);
}

[data-tab-target].btn {
    transition: transform 120ms ease, box-shadow 120ms ease;
}

[data-tab-target].btn:hover,
[data-tab-target].btn:focus {
    transform: translateY(-1px);
}

@keyframes clienteTabFadeIn {
    from {
        opacity: 0;
        transform: translateY(6px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.badge-proforma-emessa {
    background-color: #4e73df;
    color: #fff;
}

.badge-proforma-inviata {
    background-color: #1cc88a;
    color: #fff;
}

.badge-proforma-scaduta {
    background-color: #f6c23e;
    color: #fff;
}

.badge-proforma-annullata {
    background-color: #e74a3b;
    color: #fff;
}

.badge-proforma-incassata {
    background-color: #36b9cc;
    color: #fff;
}

.badge-scadenza-once {
    background-color: #f6a63a;
    color: #fff;
}

.proforma-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    justify-content: flex-end;
    align-items: center;
}

.proforma-actions .action-btn {
    min-width: 95px;
    padding: 0.35rem 0.75rem;
    font-size: 0.82rem;
}

.proforma-actions .action-btn-icon {
    min-width: 38px;
    padding: 0.35rem;
}

.proforma-actions form {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    flex-wrap: wrap;
    margin: 0;
}

.proforma-actions .form-control {
    min-width: 130px;
}

.proforma-actions .form-control-sm {
    padding: 0.35rem 0.65rem;
    font-size: 0.85rem;
}

.proforma-actions .action-input {
    max-width: 150px;
}

.proforma-actions .input-group {
    max-width: 190px;
}

.preventivo-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    justify-content: flex-end;
    align-items: center;
}

.preventivo-actions .action-btn {
    min-width: 95px;
    padding: 0.35rem 0.75rem;
    font-size: 0.82rem;
}

.preventivo-actions .action-btn-icon {
    min-width: 38px;
    padding: 0.35rem;
}

.preventivo-actions form {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    flex-wrap: wrap;
    margin: 0;
}

@media screen {
    .proforma-print {
        max-width: 960px;
        margin: 0 auto;
    }
}

.proforma-print {
    font-family: "Helvetica Neue", Arial, sans-serif;
    color: #1b1b1b;
    padding: 1.5cm;
    width: 100%;
    max-width: none;
    min-height: calc(29.7cm - 3cm);
    margin: 0;
    box-sizing: border-box;
    background: #fff;
    display: flex;
    flex-direction: column;
}

.proforma-print .print-header {
    align-items: flex-start;
    border-bottom: 1px solid #d7dbe2;
    margin-bottom: 1.5rem;
    gap: 2rem;
}

.proforma-print .brand-block img {
    max-height: 60px;
}

.proforma-print .header-meta {
    display: flex;
    justify-content: space-between;
    width: 100%;
    gap: 2rem;
    font-size: 1rem;
}

.proforma-print .meta-box {
    font-size: 1rem;
    line-height: 1.45;
}

.proforma-print .meta-box h3,
.proforma-print .meta-box .meta-title {
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: 0.55rem;
}

.proforma-print .meta-box p {
    margin: 0.35rem 0;
}

.proforma-print .meta-box.text-right {
    text-align: right;
}

.proforma-print .document-meta {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    font-size: 1.3rem;
    margin-bottom: 1.8rem;
}

.proforma-print .document-meta p {
    margin: 0.25rem 0;
}

.proforma-print .document-title {
    text-align: center;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    font-size: 2.1rem;
    margin: 2.2rem 0 2.6rem;
}

.proforma-print .proforma-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 3.2rem;
    font-size: 1rem;
}

.proforma-print .proforma-table thead tr {
    background: #eef0f5;
}

.proforma-print .proforma-table th,
.proforma-print .proforma-table td {
    border: 1px solid #d7dbe2;
    padding: 0.4rem 0.5rem;
}

.proforma-print .proforma-table th {
    text-transform: uppercase;
    font-size: 1rem;
    letter-spacing: 0.03em;
    text-align: left;
}

.proforma-print .proforma-table td.text-center {
    text-align: center;
}

.proforma-print .proforma-table td.text-right {
    text-align: right;
}

.proforma-print .print-summary {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 2.4rem;
}

.proforma-print .print-summary .totals {
    min-width: 320px;
    font-size: 1rem;
}

.proforma-print .print-summary .totals p {
    display: flex;
    justify-content: space-between;
    margin: 0.7rem 0;
}

.proforma-print .print-summary .totals p span {
    font-weight: 600;
}

.proforma-print .print-summary .totals p.total {
    margin-top: 0.9rem;
    font-size: 1.1rem;
    font-weight: 700;
}

.proforma-print .payment-note {
    margin-top: 2rem;
    font-size: 1rem;
    color: #1f2329;
}

.proforma-print .footer-note {
    margin-top: auto;
    text-align: left;
    font-size: 1rem;
    color: #2f3339;
    padding-top: 2rem;
}

.proforma-print .company-box h3 {
    margin-top: 0.45rem;
}

.proforma-total-preview-box,
.live-total-preview-box {
    background-color: #eaf7ef;
    border-color: #c5e7cf !important;
}
