/* CLEM main.css — complementari als estils inline de template.php */

.clem-badge {
    display: inline-block;
    padding: .15rem .5rem;
    border-radius: 12px;
    font-size: .78rem;
    font-weight: 600;
}
.badge-admin  { background: #dbeafe; color: #1e40af; }
.badge-user   { background: #d1fae5; color: #065f46; }
.badge-ok     { background: #d1fae5; color: #065f46; }
.badge-warn   { background: #fef3c7; color: #92400e; }
.badge-err    { background: #fee2e2; color: #991b1b; }

.clem-table {
    width: 100%;
    border-collapse: collapse;
    font-size: .9rem;
}
.clem-table th {
    padding: .6rem .75rem;
    border-bottom: 2px solid #e5e7eb;
    text-align: left;
    font-weight: 600;
    color: #374151;
}
.clem-table td {
    padding: .55rem .75rem;
    border-bottom: 1px solid #f3f4f6;
    vertical-align: middle;
}
.clem-table tr:hover td { background: #f9fafb; }

.clem-modal {
    display: none;
    position: fixed;
    top: 0; right: 0; bottom: 0; left: 0;
    background: rgba(0,0,0,.4);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}
.clem-modal.open { display: flex; }
.clem-modal-body {
    background: #fff;
    border-radius: 10px;
    padding: 1.5rem;
    width: 100%;
    max-width: 480px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 8px 32px rgba(0,0,0,.18);
}
.clem-modal-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: #1e3a5f;
    margin-bottom: 1rem;
}
.modal-footer {
    display: flex;
    gap: .75rem;
    justify-content: flex-end;
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid #e5e7eb;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}
.form-group select {
    width: 100%;
    padding: .5rem .75rem;
    border: 1px solid #ccc;
    border-radius: 6px;
    font-size: 1rem;
}
.form-group textarea {
    width: 100%;
    padding: .5rem .75rem;
    border: 1px solid #ccc;
    border-radius: 6px;
    font-size: .95rem;
    resize: vertical;
}
.form-group input[type="checkbox"] {
    width: auto;
    margin-right: .4rem;
}

.clem-empty {
    text-align: center;
    padding: 2.5rem 1rem;
    color: #9ca3af;
    font-size: .95rem;
}

.box-aportacions {
    background: #1e3a5f;
    color: #fff;
    border-radius: 8px;
    padding: 1rem 1.5rem;
    margin-bottom: 1.25rem;
    display: flex;
    align-items: center;
    gap: 1.5rem;
    flex-wrap: wrap;
}
.box-aportacions .ap-item { font-size: .9rem; }
.box-aportacions .ap-val  { font-size: 1.25rem; font-weight: 700; }
.box-aportacions .ap-lbl  { font-size: .78rem; opacity: .75; }

/* F-01: Banner fills sense cobertura */
#uncovered-banner {
    background: #fef3c7;
    border-left: 4px solid #f59e0b;
    border-radius: 6px;
    margin: .75rem 1rem 0;
}
#uncovered-banner-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .75rem;
    padding: .65rem 1rem;
}
#uncovered-banner-text {
    font-size: .9rem;
    color: #92400e;
    font-weight: 500;
}
#uncovered-banner-dismiss {
    background: none;
    border: none;
    color: #92400e;
    cursor: pointer;
    font-size: 1rem;
    padding: 0 .25rem;
    line-height: 1;
    flex-shrink: 0;
}
#uncovered-banner-dismiss:hover { color: #78350f; }

/* Barra de missatges del sistema (Fase D T318) */
.sys-messages-bar {
    margin: .5rem 1rem 0;
    display: flex;
    flex-direction: column;
    gap: .4rem;
}
.sys-msg {
    display: flex;
    align-items: flex-start;
    gap: .6rem;
    padding: .6rem .85rem;
    border-radius: 6px;
    border-left: 4px solid transparent;
    font-size: .88rem;
    line-height: 1.45;
}
.sys-msg-icon  { flex-shrink: 0; font-size: 1rem; line-height: 1.45; }
.sys-msg-text  { flex: 1; }
.sys-msg-text a { font-weight: 600; text-decoration: underline; color: inherit; }
.sys-msg-close {
    background: none; border: none; cursor: pointer;
    font-size: .9rem; padding: 0 0 0 .4rem; flex-shrink: 0;
    opacity: .6; align-self: center; line-height: 1;
}
.sys-msg-close:hover { opacity: 1; }

.sys-msg-warning { background: #fffbeb; border-color: #f59e0b; color: #92400e; }
.sys-msg-danger  { background: #fef2f2; border-color: #ef4444; color: #991b1b; }
.sys-msg-success { background: #f0fdf4; border-color: #22c55e; color: #166534; }
.sys-msg-info    { background: #eff6ff; border-color: #3b82f6; color: #1e40af; }
.sys-msg-admin   { background: #f5f3ff; border-color: #8b5cf6; color: #4c1d95; }

/* ── Responsive mòbil (T368) ───────────────────────────────────────────────── */
@media (max-width: 768px) {
    .clem-table {
        display: block;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
}
@media (max-width: 600px) {
    .form-row { grid-template-columns: 1fr; }
}

/* BUG-B: animació "dada fresca" per a ítems actualitzats per polling */
@keyframes item-fresh-flash {
    0%   { background-color: inherit; box-shadow: none; }
    10%  { background-color: #fde68a; box-shadow: 0 0 0 3px #f59e0b; }
    60%  { background-color: #fde68a; box-shadow: 0 0 0 3px #f59e0b; }
    100% { background-color: inherit; box-shadow: none; }
}
.item-fresh {
    animation: item-fresh-flash 4s ease-out;
    position: relative;
}
