/* Inventário de ferramentas */

.invferr-export-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}

/* KPIs — classes e IDs exclusivos (evita conflito com .stat-number do dashboard e outros módulos) */
.invferr-stats-section {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 25px;
}

.invferr-kpi-card {
    background: var(--fundo-stat-card, #fff);
    border-radius: 12px;
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 15px;
    box-shadow: var(--borda-stat-card, 0 1px 3px rgba(0, 0, 0, 0.08));
    transition: transform 0.2s, box-shadow 0.2s;
    border-left: 4px solid transparent;
}

.invferr-kpi-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
}

.invferr-kpi-icon {
    width: 50px;
    height: 50px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    flex-shrink: 0;
    background: linear-gradient(135deg, #1e40af, #3b82f6);
    color: #fff;
}

.invferr-kpi-icon.invferr-kpi--disponivel {
    background: linear-gradient(135deg, #059669, #10b981);
}

.invferr-kpi-icon.invferr-kpi--em-uso {
    background: linear-gradient(135deg, #d97706, #f59e0b);
}

.invferr-kpi-icon.invferr-kpi--manutencao {
    background: linear-gradient(135deg, #ea580c, #fb923c);
}

.invferr-kpi-content {
    flex: 1;
    min-width: 0;
}

.invferr-kpi-value {
    font-size: 24px;
    font-weight: 700;
    color: var(--color-stat-number, #1f2937);
    line-height: 1;
    margin-bottom: 4px;
}

.invferr-kpi-label {
    font-size: 12px;
    color: var(--color-stat-content, #64748b);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-top: 4px;
}

.invferr-col-thumb {
    width: 72px;
    text-align: center;
    vertical-align: middle;
}

.invferr-thumb {
    width: 56px;
    height: 56px;
    object-fit: cover;
    border-radius: 8px;
    border: 1px solid #e5e7eb;
}

.invferr-sem-img {
    color: #94a3b8;
    font-size: 13px;
}

.invferr-preview-wrap {
    margin-top: 10px;
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.invferr-preview-wrap img {
    max-width: 220px;
    max-height: 160px;
    object-fit: contain;
    border-radius: 8px;
    border: 1px solid #e5e7eb;
}

.invferr-table-wrap {
    background: white;
    border-radius: 12px;
    padding: 0;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.invferr-desc-preview {
    max-width: 280px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 13px;
}

.invferr-pagination {
    margin-top: 16px;
}

/* Modal — alinhado ao restante do admin (usa .active e .show como noutras páginas) */
.invferr-modal.modal {
    display: none !important;
    position: fixed;
    inset: 0;
    z-index: 10050;
    background: rgba(15, 23, 42, 0.55);
    align-items: flex-start;
    justify-content: center;
    padding: 24px 16px;
    overflow-y: auto;
}

@media (max-width: 768px) {
    .invferr-modal.modal {
        padding: 12px 8px;
        align-items: stretch;
    }

    .invferr-modal .modal-content {
        width: 100%;
        max-width: 100%;
        max-height: min(92vh, 960px);
    }
}

.invferr-modal.modal.active,
.invferr-modal.modal.show {
    display: flex !important;
}

/* Modais largos: ocupam boa parte do ecrã, corpo com scroll */
.invferr-modal .modal-content {
    background: var(--surface, #fff);
    border-radius: 12px;
    width: min(92vw, 1200px);
    max-width: min(92vw, 1200px);
    max-height: min(90vh, 960px);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15);
}

.invferr-modal .modal-content.modal-large {
    width: min(92vw, 1200px);
    max-width: min(92vw, 1200px);
}

.invferr-modal .modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid #e5e7eb;
    flex-shrink: 0;
}

.invferr-modal .modal-header h3 {
    margin: 0;
    font-size: 1.15rem;
}

.invferr-modal .modal-close {
    border: none;
    background: transparent;
    font-size: 1.5rem;
    line-height: 1;
    cursor: pointer;
    color: #64748b;
}

.invferr-modal .modal-body {
    padding: 20px;
    flex: 1 1 auto;
    overflow-y: auto;
    overflow-x: hidden;
    min-height: 0;
    -webkit-overflow-scrolling: touch;
}

.invferr-modal .form-row {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
}

.invferr-modal .form-group {
    flex: 1;
    min-width: 200px;
    margin-bottom: 14px;
}

.invferr-modal .form-group label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    margin-bottom: 6px;
    color: #374151;
}

.invferr-modal .modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid #f3f4f6;
}

.invferr-hist-sub {
    font-size: 14px;
    color: #64748b;
    margin-bottom: 16px;
}

.invferr-timeline {
    display: flex;
    flex-direction: column;
    gap: 12px;
    max-height: min(58vh, 560px);
    overflow-y: auto;
}

.invferr-tl-item {
    border-left: 3px solid #1e40af;
    padding: 10px 14px 10px 16px;
    background: #f8fafc;
    border-radius: 0 8px 8px 0;
}

.invferr-tl-item.event-edicao {
    border-left-color: #6366f1;
}

.invferr-tl-item.event-mudanca_status {
    border-left-color: #059669;
}

.invferr-tl-meta {
    font-size: 12px;
    color: #64748b;
    margin-bottom: 6px;
}

.invferr-tl-body {
    font-size: 14px;
    color: #1f2937;
    line-height: 1.45;
}

.status-badge.invferr-st-disponivel {
    background: rgba(34, 197, 94, 0.15);
    color: #15803d;
}

.status-badge.invferr-st-em_uso {
    background: rgba(234, 179, 8, 0.2);
    color: #a16207;
}

.status-badge.invferr-st-manutencao {
    background: rgba(249, 115, 22, 0.15);
    color: #c2410c;
}

.status-badge.invferr-st-emprestado {
    background: rgba(59, 130, 246, 0.15);
    color: #1d4ed8;
}

.status-badge.invferr-st-baixado {
    background: rgba(100, 116, 139, 0.2);
    color: #475569;
}

.text-muted {
    font-weight: 400;
    color: #94a3b8;
}

/* Acções na grelha (visíveis mesmo sem licencas-styles em cache) */
.invferr-th-accoes,
.invferr-td-accoes {
    min-width: 190px;
    text-align: right;
    vertical-align: middle;
}

.invferr-accoes {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    justify-content: flex-end;
    align-items: center;
}

.invferr-accoes .btn-action {
    padding: 6px 10px;
    border: none;
    border-radius: 6px;
    font-size: 12px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.invferr-accoes .btn-view {
    background: #dbeafe;
    color: #1e40af;
}

.invferr-accoes .btn-associate {
    background: #e0e7ff;
    color: #4338ca;
}

.invferr-accoes .btn-edit {
    background: #fef3c7;
    color: #d97706;
}

.invferr-accoes .btn-delete {
    background: #fee2e2;
    color: #dc2626;
}

/* Modal detalhe */
.invferr-solo-ref {
    font-size: 14px;
    font-weight: 600;
    color: #1e40af;
    margin-bottom: 12px;
}

.invferr-det-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    margin-bottom: 16px;
    align-items: flex-start;
}

.invferr-det-imagem-wrap {
    flex: 0 0 auto;
}

.invferr-det-img {
    max-width: 240px;
    max-height: 180px;
    object-fit: contain;
    border-radius: 8px;
    border: 1px solid #e5e7eb;
}

.invferr-det-dl {
    flex: 1;
    min-width: 200px;
    margin: 0;
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 8px 16px;
    font-size: 14px;
}

.invferr-det-dl dt {
    margin: 0;
    font-weight: 600;
    color: #64748b;
}

.invferr-det-dl dd {
    margin: 0;
    color: #1f2937;
}

.invferr-det-texto {
    white-space: pre-wrap;
    padding: 10px 12px;
    background: #f8fafc;
    border-radius: 8px;
    font-size: 14px;
}

.invferr-det-texto.muted {
    color: #64748b;
}

.invferr-det-footer {
    flex-wrap: wrap;
}
