.ddm-prev-comm-page {
    max-width: 1180px;
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 14px;
    position: relative;
    z-index: 6;
}

body.ddm-pc-open .top-bar,
body.ddm-pc-open .main-content > .top-bar {
    display: none !important;
}

body.ddm-pc-open .content-body > :not([data-ddm-prev-comm-host]) {
    display: none !important;
    visibility: hidden !important;
    height: 0 !important;
    max-height: 0 !important;
    overflow: hidden !important;
    pointer-events: none !important;
}

.content-body:has([data-ddm-prev-comm-host]) > :not([data-ddm-prev-comm-host]) {
    display: none !important;
    visibility: hidden !important;
    height: 0 !important;
    max-height: 0 !important;
    overflow: hidden !important;
    pointer-events: none !important;
}

.content-body:has([data-ddm-prev-comm-host]) > .ddm-dash-keep,
.content-body:has([data-ddm-prev-comm-host]) > div:has(.dashboard-module) {
    display: none !important;
}

.main-content:has([data-ddm-prev-comm-host]) > .top-bar {
    display: none !important;
}

.ddm-pc-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
    position: sticky;
    top: 0;
    z-index: 40;
    background: #f1f5f9;
    padding: 8px 0 10px;
}

.ddm-pc-toolbar h2 {
    margin: 0;
    font-size: 20px;
    color: #0f172a;
}

.ddm-pc-toolbar input,
.ddm-pc-toolbar select {
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    padding: 8px 10px;
    font: inherit;
    font-size: 14px;
}

.ddm-pc-toolbar .ddm-pc-cerca {
    min-width: 180px;
    flex: 1;
}

.ddm-pc-filtro {
    display: flex;
    flex-direction: column;
    gap: 2px;
    font-size: 11px;
    font-weight: 700;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.ddm-pc-filtro select {
    min-width: 150px;
    text-transform: none;
    font-weight: 600;
    color: #0f172a;
    letter-spacing: 0;
}

.ddm-pc-btn {
    appearance: none;
    cursor: pointer;
    border-radius: 8px;
    border: 1px solid #cbd5e1;
    background: #fff;
    color: #334155;
    font: inherit;
    font-weight: 700;
    font-size: 13px;
    padding: 8px 14px;
}

.ddm-pc-btn.primary {
    background: #3d9c35;
    border-color: #3d9c35;
    color: #fff;
}

.ddm-pc-btn.primary.saved {
    background: #166534;
    border-color: #166534;
}

.ddm-pc-btn:disabled {
    opacity: 0.7;
    cursor: wait;
}

.ddm-pc-err {
    flex: 1 1 100%;
    background: #fef2f2;
    border: 1px solid #fecaca;
    color: #b91c1c;
    border-radius: 8px;
    padding: 8px 12px;
    font-size: 13px;
    font-weight: 700;
}

.ddm-pc-btn.danger {
    border-color: #fecaca;
    color: #b91c1c;
    background: #fef2f2;
}

.ddm-pc-list {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 14px;
    overflow: auto;
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.05);
}

.ddm-pc-list table {
    width: 100%;
    border-collapse: collapse;
}

.ddm-pc-list th,
.ddm-pc-list td {
    text-align: left;
    padding: 9px 10px;
    border-bottom: 1px solid #e2e8f0;
    font-size: 13px;
    white-space: nowrap;
}

.ddm-pc-list td:nth-child(3),
.ddm-pc-list td:nth-child(4) {
    white-space: normal;
    min-width: 120px;
}

.ddm-pc-list th {
    background: #f8fafc;
    font-size: 11px;
    text-transform: uppercase;
    color: #64748b;
    letter-spacing: 0.04em;
}

.ddm-pc-list tbody tr {
    cursor: pointer;
}

.ddm-pc-list tbody tr:hover {
    background: #f8fafc;
}

.ddm-pc-list td.ddm-pc-azioni {
    width: 1%;
    white-space: nowrap;
    text-align: right;
}

.ddm-pc-list td.ddm-pc-azioni .ddm-pc-btn {
    padding: 6px 10px;
    font-size: 12px;
}

.ddm-pc-badge {
    display: inline-flex;
    border-radius: 999px;
    padding: 2px 8px;
    font-size: 12px;
    font-weight: 700;
}

.ddm-pc-badge.bozza { background: #f1f5f9; color: #475569; }
.ddm-pc-badge.inviato { background: #dbeafe; color: #1d4ed8; }
.ddm-pc-badge.accettato { background: #dcfce7; color: #166534; }
.ddm-pc-badge.rifiutato { background: #fee2e2; color: #b91c1c; }
.ddm-pc-badge.scaduto { background: #ffedd5; color: #c2410c; }

.ddm-pc-si {
    display: inline-flex;
    border-radius: 999px;
    padding: 2px 8px;
    font-size: 12px;
    font-weight: 800;
}
.ddm-pc-si.yes { background: #dcfce7; color: #166534; }
.ddm-pc-si.no { background: #f1f5f9; color: #64748b; }

.ddm-pc-ordine-ok {
    font-size: 13px;
    font-weight: 800;
    color: #166534;
    background: #dcfce7;
    border-radius: 8px;
    padding: 6px 10px;
}

.ddm-pc-card {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 14px;
    padding: 16px 18px;
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.05);
}

.ddm-pc-card h3 {
    margin: 0 0 12px;
    font-size: 16px;
}

.ddm-pc-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.ddm-pc-grid .full { grid-column: 1 / -1; }

.ddm-pc-field {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.ddm-pc-field label {
    font-size: 12px;
    font-weight: 700;
    color: #475569;
}

.ddm-pc-field input,
.ddm-pc-field textarea,
.ddm-pc-field select {
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    padding: 8px 10px;
    font: inherit;
    font-size: 14px;
}

.ddm-pc-suggest {
    position: relative;
}

.ddm-pc-suggest-list {
    position: absolute;
    z-index: 20;
    left: 0;
    right: 0;
    top: 100%;
    background: #fff;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    max-height: 220px;
    overflow: auto;
    box-shadow: 0 8px 20px rgba(15, 23, 42, 0.12);
}

.ddm-pc-suggest-list button {
    display: block;
    width: 100%;
    text-align: left;
    border: 0;
    background: #fff;
    padding: 8px 10px;
    cursor: pointer;
    font: inherit;
    font-size: 13px;
}

.ddm-pc-suggest-list button:hover {
    background: #f0fdf4;
}

.ddm-pc-internal {
    background: linear-gradient(180deg, #fff7ed 0%, #fff 55%);
    border-color: #fdba74;
}

.ddm-pc-internal h3 {
    color: #9a3412;
}

.ddm-pc-internal .hint {
    margin: 0 0 12px;
    font-size: 13px;
    color: #9a3412;
}

.ddm-pc-righe {
    width: 100%;
    border-collapse: collapse;
}

.ddm-pc-righe th,
.ddm-pc-righe td {
    padding: 6px;
    border-bottom: 1px solid #e2e8f0;
    vertical-align: top;
}

.ddm-pc-righe input,
.ddm-pc-righe textarea {
    width: 100%;
    box-sizing: border-box;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    padding: 6px 8px;
    font: inherit;
    font-size: 13px;
}

.ddm-pc-righe .col-qta,
.ddm-pc-righe .col-prezzo,
.ddm-pc-righe .col-costo {
    width: 90px;
}

.ddm-pc-righe-cliente textarea[name="descrizione"] {
    min-height: 160px;
    width: 100%;
    resize: vertical;
    line-height: 1.4;
    font-family: inherit;
}

.ddm-pc-internal textarea[name="voce"],
.ddm-pc-internal textarea[name="note_interne"] {
    min-height: 52px;
    resize: vertical;
}

.ddm-pc-totale {
    text-align: right;
    font-size: 18px;
    font-weight: 800;
    margin-top: 10px;
}

.ddm-pc-empty {
    padding: 24px;
    text-align: center;
    color: #64748b;
}

@media (max-width: 800px) {
    .ddm-pc-grid { grid-template-columns: 1fr; }
}
