.ddm-compiti-page {
    max-width: 1100px;
}

.ddm-compiti-intro {
    color: #475569;
    font-size: 14px;
    margin: 0 0 16px;
}

.ddm-compiti-form {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    padding: 16px;
    margin-bottom: 24px;
}

.ddm-compiti-form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 12px;
    margin-bottom: 12px;
}

.ddm-compiti-form-grid .span-2 {
    grid-column: span 2;
}

@media (max-width: 768px) {
    .ddm-compiti-form-grid {
        grid-template-columns: 1fr;
    }
    .ddm-compiti-form-grid .span-2 {
        grid-column: span 1;
    }
}

.ddm-compiti-form label {
    display: flex;
    flex-direction: column;
    gap: 4px;
    font-size: 13px;
    font-weight: 600;
    color: #475569;
}

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

.ddm-compiti-form .btn-primary {
    background: #3d9c35;
    color: #fff;
    border: none;
    border-radius: 8px;
    padding: 10px 18px;
    font-weight: 600;
    cursor: pointer;
}

.ddm-compiti-form .btn-primary:hover {
    background: #358c2e;
}

.ddm-compiti-empty,
.ddm-compiti-error {
    color: #64748b;
    font-size: 14px;
}

.ddm-compiti-done {
    margin-top: 24px;
    opacity: 0.85;
}

.ddm-compiti-resoconto-sezione {
    margin-bottom: 24px;
    border-color: #bfdbfe;
    background: linear-gradient(180deg, #f8fbff 0%, #fff 100%);
}

.ddm-compiti-resoconto-intro {
    color: #64748b;
    font-size: 13px;
    margin: -8px 0 14px;
}

.ddm-resoconto-stats {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.ddm-resoconto-filtro {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    margin: 0 0 14px;
}

.ddm-resoconto-filtro-btn {
    appearance: none;
    border: 1px solid #cbd5e1;
    background: #fff;
    color: #475569;
    border-radius: 999px;
    padding: 5px 12px;
    font-size: 12px;
    font-weight: 700;
    font-family: inherit;
    cursor: pointer;
    transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.ddm-resoconto-filtro-btn:hover {
    border-color: #94a3b8;
    background: #f8fafc;
}

.ddm-resoconto-filtro-btn.is-active {
    background: #1e40af;
    border-color: #1e40af;
    color: #fff;
}

.ddm-resoconto-stat {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 700;
}

.ddm-resoconto-stat.pending {
    background: #fef3c7;
    color: #92400e;
}

.ddm-resoconto-stat.done {
    background: #dcfce7;
    color: #15803d;
}

.ddm-stato-badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 700;
}

.ddm-stato-badge.pending {
    background: #fef3c7;
    color: #92400e;
}

.ddm-stato-badge.done {
    background: #dcfce7;
    color: #15803d;
}

.tabella-resoconto tr.is-done {
    opacity: 0.82;
}

.count-badge.pending {
    background: #f59e0b;
    color: #fff;
}

.ddm-prio {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
}

.ddm-prio.bassa { background: #f1f5f9; color: #64748b; }
.ddm-prio.normale { background: #dbeafe; color: #1d4ed8; }
.ddm-prio.alta { background: #fef3c7; color: #92400e; }
.ddm-prio.urgente { background: #fee2e2; color: #b91c1c; }

.compiti-assegnati-sezione .count-badge.compiti {
    background: #3d9c35;
    color: #fff;
}

/* Dashboard: card compiti da fare */
.ddm-compiti-dash-cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 14px;
}

.ddm-compito-card {
    position: relative;
    display: flex;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.06);
    transition: box-shadow 0.15s ease, border-color 0.15s ease;
}

.ddm-compito-card:hover {
    border-color: #cbd5e1;
    box-shadow: 0 4px 14px rgba(15, 23, 42, 0.08);
}

.ddm-compito-card.is-overdue {
    border-color: #fecaca;
    background: #fffbfb;
}

.ddm-compito-card-accent {
    width: 5px;
    flex-shrink: 0;
    background: #3b82f6;
}

.ddm-compito-card.prio-bassa .ddm-compito-card-accent { background: #94a3b8; }
.ddm-compito-card.prio-normale .ddm-compito-card-accent { background: #3b82f6; }
.ddm-compito-card.prio-alta .ddm-compito-card-accent { background: #f59e0b; }
.ddm-compito-card.prio-urgente .ddm-compito-card-accent { background: #ef4444; }

.ddm-compito-card-body {
    flex: 1;
    padding: 14px 16px;
    min-width: 0;
}

.ddm-compito-card-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 10px;
    flex-wrap: wrap;
}

.ddm-compito-scadenza {
    font-size: 12px;
    font-weight: 600;
    color: #64748b;
}

.ddm-compito-scadenza.overdue {
    color: #b91c1c;
}

.ddm-compito-titolo {
    margin: 0 0 6px;
    font-size: 16px;
    line-height: 1.35;
    color: #0f172a;
}

.ddm-compito-desc {
    margin: 0 0 12px;
    font-size: 13px;
    line-height: 1.45;
    color: #64748b;
}

.ddm-compito-card-foot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    padding-top: 10px;
    border-top: 1px solid #f1f5f9;
}

.ddm-compito-meta {
    font-size: 12px;
    color: #64748b;
}

.ddm-compito-meta strong {
    color: #334155;
}

.btn-compito-done {
    background: #3d9c35;
    color: #fff;
    border: none;
    border-radius: 8px;
    padding: 8px 14px;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    white-space: nowrap;
}

.btn-compito-done:hover {
    background: #358c2e;
}

/* Dashboard: mini resoconto assegnati */
.ddm-compiti-dash-resoconto {
    margin-top: 0;
}

.ddm-compiti-mini-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.ddm-compito-mini {
    padding: 12px 14px;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    background: #fafafa;
}

.ddm-compito-mini.is-overdue {
    border-color: #fecaca;
    background: #fff7f7;
}

.ddm-compito-mini-main {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 6px;
    flex-wrap: wrap;
}

.ddm-compito-mini-main strong {
    font-size: 14px;
    color: #0f172a;
}

.ddm-compito-mini-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 10px 16px;
    font-size: 12px;
    color: #64748b;
    align-items: center;
}

.ddm-compiti-dash-link {
    margin: 12px 0 0;
    font-size: 12px;
    color: #64748b;
}

.tabella-compiti .btn-link {
    background: none;
    border: none;
    color: #3d9c35;
    cursor: pointer;
    font-size: 13px;
    padding: 0 6px 0 0;
}

.tabella-compiti .btn-link.danger {
    color: #b91c1c;
}

.btn-action-sm {
    background: #dcfce7;
    color: #15803d;
    border: 1px solid #86efac;
    border-radius: 6px;
    padding: 4px 10px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
}

.btn-action-sm:hover {
    background: #bbf7d0;
}

.ddm-compiti-modal {
    position: fixed;
    inset: 0;
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
}

.ddm-compiti-modal[hidden] {
    display: none !important;
}

.ddm-compiti-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.45);
}

.ddm-compiti-modal-box {
    position: relative;
    background: #fff;
    border-radius: 12px;
    padding: 20px;
    width: min(560px, 100%);
    max-height: 90vh;
    overflow: auto;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.2);
}

.ddm-compiti-modal-box h3 {
    margin: 0 0 16px;
    font-size: 18px;
}

.ddm-compiti-modal-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    margin-top: 8px;
}

.btn-secondary {
    background: #f1f5f9;
    color: #334155;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    padding: 10px 16px;
    font-weight: 600;
    cursor: pointer;
}

.tabella-compiti .actions {
    white-space: nowrap;
}

.sub-text {
    font-size: 12px;
    color: #64748b;
    margin-top: 4px;
}
