/* ===== Reset e Variáveis ===== */
* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
    --primary-color: #2563eb;
    --primary-dark: #1e40af;
    --primary-light: #3b82f6;
    --secondary-color: #64748b;
    --success-color: #10b981;
    --warning-color: #f59e0b;
    --danger-color: #ef4444;
    --info-color: #06b6d4;
    --bg-primary: #ffffff;
    --bg-secondary: #f8fafc;
    --bg-tertiary: #f1f5f9;
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --text-light: #94a3b8;
    --border-color: #e2e8f0;
    --border-light: #f1f5f9;
    --shadow-sm: 0 1px 2px 0 rgba(0,0,0,.05);
    --shadow-md: 0 4px 6px -1px rgba(0,0,0,.1);
    --shadow-lg: 0 10px 15px -3px rgba(0,0,0,.1);
    --shadow-xl: 0 20px 25px -5px rgba(0,0,0,.1);
    --spacing-xs: .5rem;
    --spacing-sm: .75rem;
    --spacing-md: 1rem;
    --spacing-lg: 1.5rem;
    --spacing-xl: 2rem;
    --radius-sm: .375rem;
    --radius-md: .5rem;
    --radius-lg: .75rem;

    /* Status de equipamento */
    --status-ok:        #d1fae5;
    --status-ok-txt:    #065f46;
    --status-manut:     #fef9c3;
    --status-manut-txt: #713f12;
    --status-parado:    #fee2e2;
    --status-parado-txt:#7f1d1d;
    --status-peca:      #fef3c7;
    --status-peca-txt:  #92400e;
    --status-transf:    #e0e7ff;
    --status-transf-txt:#3730a3;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    padding: var(--spacing-md) var(--spacing-xs);
}

body.embed-mode {
    background: #f8fafc;
    padding: 0;
}
body.embed-mode .container { padding: 0 .5rem; }
body.embed-mode .main-layout {
    height: calc(100vh - 190px);
    min-height: 440px;
}

.container { width: 100%; margin: 0 auto; padding: 0 var(--spacing-md); }

/* ===== Header ===== */
.header {
    background: var(--bg-primary);
    border-radius: var(--radius-lg);
    padding: .75rem var(--spacing-md);
    margin-bottom: var(--spacing-sm);
    box-shadow: var(--shadow-md);
}
.header-content { display: flex; justify-content: space-between; align-items: center; gap: var(--spacing-lg); flex-wrap: wrap; }
.header-left h1 { color: var(--primary-color); font-size: 1.4rem; font-weight: 700; margin-bottom: .2rem; }
.header-left p { color: var(--text-secondary); font-size: .95rem; }
.header-actions { display: flex; gap: .75rem; flex-wrap: wrap; }

/* ===== Botões principais ===== */
.btn-primary {
    padding: var(--spacing-sm) var(--spacing-lg);
    background: var(--primary-color);
    color: white; border: none;
    border-radius: var(--radius-md);
    font-size: .875rem; font-weight: 600;
    cursor: pointer; transition: all .2s ease; white-space: nowrap;
    display: inline-flex; align-items: center; gap: .4rem;
}
.btn-primary:hover { background: var(--primary-dark); transform: translateY(-1px); box-shadow: var(--shadow-md); }

.btn-secondary {
    padding: var(--spacing-sm) var(--spacing-lg);
    background: white;
    color: var(--primary-color);
    border: 1.5px solid var(--primary-color);
    border-radius: var(--radius-md);
    font-size: .875rem; font-weight: 600;
    cursor: pointer; transition: all .2s ease; white-space: nowrap;
    display: inline-flex; align-items: center; gap: .4rem;
}
.btn-secondary:hover { background: #eff6ff; transform: translateY(-1px); }

.btn-danger {
    padding: 6px 12px; background: #fee2e2; color: #dc2626;
    border: 1px solid #fecaca; border-radius: 6px;
    cursor: pointer; font-size: .8rem; font-weight: 600;
    transition: all .2s;
}
.btn-danger:hover { background: #fecaca; }

/* ===== Notificação de status ===== */
#notifBanner {
    display: none;
    position: fixed; top: 1rem; right: 1rem; left: 1rem;
    z-index: 99999;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 8px 30px rgba(0,0,0,.2);
    overflow: hidden;
    animation: slideDown .3s ease;
    max-width: 500px;
    margin: 0 auto;
}
.notif-bar { height: 5px; background: var(--warning-color); }
.notif-bar.ok    { background: var(--success-color); }
.notif-bar.alerta { background: var(--warning-color); }
.notif-bar.critico { background: var(--danger-color); }
.notif-inner { padding: 1rem 1.25rem; display: flex; gap: .75rem; align-items: flex-start; }
.notif-icon { font-size: 1.5rem; flex-shrink: 0; }
.notif-body { flex: 1; }
.notif-title { font-weight: 700; font-size: .95rem; color: var(--text-primary); }
.notif-msg { font-size: .82rem; color: var(--text-secondary); margin-top: 2px; }
.notif-time { font-size: .72rem; color: var(--text-light); margin-top: 4px; }
.btn-notif-close { background: none; border: none; font-size: 1.3rem; cursor: pointer; color: var(--text-light); flex-shrink: 0; }
.btn-notif-close:hover { color: var(--text-primary); }

@keyframes slideDown { from { opacity: 0; transform: translateY(-20px); } to { opacity: 1; transform: translateY(0); } }

/* ===== Layout principal (mapa + lista) ===== */
/* ===== Layout principal — viewport-based ===== */
/*
   Estratégia: mapa + painel lateral ocupam altura fixa baseada no viewport.
   Isso evita que a lista de obras/equipamentos empurre o layout para baixo.
   A tabela de equipamentos fica abaixo em seção colapsável.
*/
.main-layout {
    display: grid;
    grid-template-columns: 1fr 400px;
    gap: var(--spacing-md);
    margin-bottom: var(--spacing-md);
    /* Altura dinâmica: viewport - header - summary - margens */
    height: calc(100vh - 230px);
    min-height: 460px;
    max-height: 720px;
}
@media (max-width: 1200px) {
    .main-layout { grid-template-columns: 1fr 360px; }
}
@media (max-width: 1024px) {
    .main-layout {
        grid-template-columns: 1fr;
        height: auto;
        max-height: none;
    }
    .obras-panel { height: 380px; }
}

/* ===== Mapa ===== */
.map-section {
    background: var(--bg-primary);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    min-height: 0; /* essencial para flex children com overflow */
}
.map-header {
    padding: .6rem var(--spacing-lg);
    border-bottom: 1px solid var(--border-color);
    display: flex; justify-content: space-between; align-items: center;
    background: var(--bg-secondary);
    flex-shrink: 0;
}
.map-header h2 { font-size: .9rem; font-weight: 700; color: var(--text-primary); }
.map-legend { display: flex; gap: .6rem; flex-wrap: wrap; }
.legend-dot { display: inline-flex; align-items: center; gap: 4px; font-size: .72rem; color: var(--text-secondary); }
.legend-dot span { width: 9px; height: 9px; border-radius: 50%; display: inline-block; }
.dot-ok      { background: #10b981; }
.dot-alerta  { background: #f59e0b; }
.dot-critico { background: #ef4444; }
.dot-inativo { background: #94a3b8; }

/* Mapa preenche todo o espaço disponível no flex container */
#mapContainer {
    flex: 1;
    min-height: 0;
    width: 100%;
    background: #e8f0fe;
    position: relative;
}
.map-placeholder {
    position: absolute; inset: 0;
    display: flex; flex-direction: column;
    align-items: center; justify-content: center;
    gap: .75rem; color: var(--text-secondary);
    font-size: .9rem;
}
.map-placeholder .map-icon { font-size: 2.5rem; }
.map-api-warning {
    background: #fffbeb; border: 1px solid #fde68a;
    border-radius: 8px; padding: .5rem 1rem;
    font-size: .78rem; color: #92400e;
    text-align: center; margin: 0 1rem;
}

/* ===== Painel de Obras — scroll independente ===== */
.obras-panel {
    background: var(--bg-primary);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    display: flex; flex-direction: column;
    overflow: hidden;
    min-height: 0;
}
.panel-header {
    padding: .65rem var(--spacing-lg);
    border-bottom: 1px solid var(--border-color);
    background: var(--bg-secondary);
    display: flex; justify-content: space-between; align-items: center;
    flex-shrink: 0;
}
.panel-header h2 { font-size: .9rem; font-weight: 700; color: var(--text-primary); }

/* Panel body com scroll — min-height:0 é obrigatório para funcionar em flex */
.panel-body {
    flex: 1;
    overflow-y: auto;
    padding: .6rem;
    min-height: 0;
    scrollbar-width: thin;
    scrollbar-color: #cbd5e1 transparent;
}
.panel-body::-webkit-scrollbar { width: 5px; }
.panel-body::-webkit-scrollbar-track { background: transparent; }
.panel-body::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 3px; }

/* ===== Obra — acordeão compacto ===== */
.obra-item {
    border: 1.5px solid var(--border-color);
    border-radius: 8px;
    margin-bottom: .45rem;
    overflow: hidden;
    background: var(--bg-secondary);
    transition: border-color .15s, box-shadow .15s;
}
.obra-item:hover { border-color: #667eea; box-shadow: 0 2px 8px rgba(102,126,234,.1); }
.obra-item.expanded { border-color: #667eea; background: #fafafe; }

.obra-item-header {
    padding: .55rem .8rem;
    display: flex; align-items: center; gap: .55rem;
    cursor: pointer; user-select: none;
}
.obra-icon { font-size: 1.1rem; flex-shrink: 0; }
.obra-info { flex: 1; min-width: 0; }
.obra-nome { font-weight: 700; font-size: .82rem; color: var(--text-primary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.obra-end  { font-size: .7rem; color: var(--text-secondary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.obra-status-dot { width: 9px; height: 9px; border-radius: 50%; flex-shrink: 0; }

/* Badge com contagem de equipamentos */
.obra-equip-count {
    background: #e0e7ff; color: #3730a3;
    font-size: .65rem; font-weight: 800;
    padding: 2px 6px; border-radius: 10px;
    flex-shrink: 0; white-space: nowrap;
}
.obra-equip-count.tem-critico { background: #fee2e2; color: #dc2626; }
.obra-equip-count.tem-alerta  { background: #fef3c7; color: #92400e; }

/* Chevron de expansão */
.obra-chevron {
    font-size: .65rem; color: #9ca3af; flex-shrink: 0;
    transition: transform .2s;
}
.obra-item.expanded .obra-chevron { transform: rotate(180deg); }

/* Lista de equipamentos — oculta por padrão */
.obra-equip-list {
    padding: 0 .6rem .5rem;
    display: flex; flex-direction: column; gap: .3rem;
    display: none; /* colapsado por padrão */
}
.obra-item.expanded .obra-equip-list { display: flex; }

/* Botões de ação rápida na obra header */
.obra-acoes {
    display: flex; gap: 3px; flex-shrink: 0;
}
.obra-acoes button {
    padding: 3px 6px; border-radius: 5px;
    border: 1px solid var(--border-color); background: white;
    cursor: pointer; font-size: .7rem; color: var(--text-secondary);
    transition: all .12s; line-height: 1.2;
}
.obra-acoes button:hover { background: #f1f5f9; }

/* ===== Cards de Equipamento — compactos ===== */
.equip-card {
    border: 1px solid var(--border-color);
    border-radius: 7px;
    padding: .4rem .6rem;
    background: white;
    display: flex; align-items: flex-start; gap: .5rem;
    transition: box-shadow .12s;
}
.equip-card:hover { box-shadow: 0 2px 6px rgba(0,0,0,.08); border-color: #667eea; }
.equip-card-body { flex: 1; min-width: 0; }
.equip-card-nome { font-weight: 600; font-size: .78rem; color: var(--text-primary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.equip-card-meta { font-size: .68rem; color: var(--text-secondary); }
.equip-card-actions { display: flex; gap: 3px; flex-shrink: 0; padding-top: 1px; }
.btn-status { padding: 3px 6px; border-radius: 5px; border: none; cursor: pointer; font-size: .68rem; font-weight: 600; transition: all .12s; }
.btn-edit   { padding: 3px 6px; border-radius: 5px; border: 1px solid var(--border-color); background: white; cursor: pointer; font-size: .68rem; color: var(--text-secondary); line-height: 1; }
.btn-edit:hover { background: var(--bg-secondary); }

/* Badge de Status */
.status-badge {
    display: inline-flex; align-items: center; gap: 4px;
    padding: 2px 8px; border-radius: 20px;
    font-size: .7rem; font-weight: 700;
}
.status-badge.operando    { background: var(--status-ok);     color: var(--status-ok-txt); }
.status-badge.manutencao  { background: var(--status-manut);  color: var(--status-manut-txt); }
.status-badge.parado      { background: var(--status-parado); color: var(--status-parado-txt); }
.status-badge.aguard-peca { background: var(--status-peca);   color: var(--status-peca-txt); }
.status-badge.transferido { background: var(--status-transf); color: var(--status-transf-txt); }

/* ===== Seção de Equipamentos (tabela completa) ===== */
.equipamentos-section {
    background: var(--bg-primary);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    margin-bottom: var(--spacing-md);
    overflow: hidden;
}
/* Tabela colapsável: quando colapsada, só mostra o header */
.equipamentos-section.collapsed .table-wrapper,
.equipamentos-section.collapsed .section-filters { display: none; }
.equipamentos-section .section-header { cursor: default; }

/* Wrapper da tabela com scroll vertical */
.table-wrapper {
    overflow-x: auto;
    max-height: 400px;
    overflow-y: auto;
    scrollbar-width: thin;
}
.section-header {
    padding: var(--spacing-md) var(--spacing-lg);
    border-bottom: 1px solid var(--border-color);
    background: var(--bg-secondary);
    display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: .75rem;
}
.section-header h2 { font-size: 1rem; font-weight: 700; color: var(--text-primary); }
.section-filters { display: flex; gap: .6rem; align-items: center; flex-wrap: wrap; }
.filter-select, .filter-input {
    padding: .4rem .75rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    font-size: .82rem;
    color: var(--text-primary);
    background: white;
    outline: none;
}
.filter-select:focus, .filter-input:focus { border-color: var(--primary-color); box-shadow: 0 0 0 2px rgba(37,99,235,.1); }

.equip-table {
    width: 100%; border-collapse: collapse; font-size: .82rem;
}
.equip-table th {
    padding: .6rem 1rem; text-align: left; font-weight: 700;
    font-size: .75rem; color: var(--text-secondary);
    background: var(--bg-tertiary); border-bottom: 1px solid var(--border-color);
    white-space: nowrap;
}
.equip-table td {
    padding: .55rem 1rem; border-bottom: 1px solid var(--border-light);
    color: var(--text-primary);
}
.equip-table tr:hover td { background: var(--bg-secondary); }
.equip-table .td-actions { display: flex; gap: 4px; }

/* ===== Modais ===== */
.modal-overlay {
    position: fixed; inset: 0;
    background: rgba(0,0,0,.5);
    backdrop-filter: blur(2px);
    display: flex; align-items: center; justify-content: center;
    z-index: 9000;
}
.modal-card {
    background: white;
    width: 580px;
    max-width: 95vw;
    max-height: 90vh;
    border-radius: 12px;
    display: flex; flex-direction: column;
    box-shadow: 0 20px 60px rgba(0,0,0,.3);
}
.modal-card.modal-lg { width: 720px; }
.modal-card.modal-sm { width: 420px; }

.modal-header {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid #e5e7eb;
    display: flex; justify-content: space-between; align-items: center;
    background: #f9fafb;
    border-radius: 12px 12px 0 0;
}
.modal-header h3 { margin: 0; font-size: 1.15rem; font-weight: 700; color: var(--text-primary); }
.modal-header-gradient {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
}
.modal-header-gradient h3 { color: white; }

.btn-close-modal {
    background: none; border: none; font-size: 1.5rem;
    cursor: pointer; color: #6b7280; line-height: 1;
    transition: color .15s;
}
.btn-close-modal:hover { color: #111; }
.btn-close-white { color: white; opacity: .85; }
.btn-close-white:hover { color: white; opacity: 1; }

.modal-body-scroll {
    padding: 1.5rem;
    overflow-y: auto;
    flex: 1;
}
.modal-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid #e5e7eb;
    display: flex; justify-content: flex-end; gap: .6rem;
    background: #f9fafb;
    border-radius: 0 0 12px 12px;
}

/* ===== Form elements ===== */
.form-row { margin-bottom: 1rem; }
.form-row label {
    display: block; font-size: .82rem; font-weight: 600;
    color: #374151; margin-bottom: 4px;
}
.inp {
    width: 100%; padding: .55rem .75rem;
    border: 1px solid #d1d5db; border-radius: 6px;
    font-size: .9rem; box-sizing: border-box;
    font-family: inherit;
}
.inp:focus { outline: none; border-color: #667eea; box-shadow: 0 0 0 2px rgba(102,126,234,.2); }
.inp[readonly] { background: #f3f4f6; color: #6b7280; cursor: default; }

.form-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: .75rem; }
.form-grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: .75rem; }

/* Toggle Switch */
.toggle-row { display: flex; align-items: center; gap: .6rem; }
.toggle-label { font-size: .85rem; font-weight: 600; color: #374151; }
.toggle-switch {
    position: relative; width: 40px; height: 22px;
    display: inline-block;
}
.toggle-switch input { opacity: 0; width: 0; height: 0; }
.toggle-slider {
    position: absolute; cursor: pointer; inset: 0;
    background: #d1d5db; border-radius: 22px; transition: .3s;
}
.toggle-slider:before {
    position: absolute; content: "";
    height: 16px; width: 16px; left: 3px; bottom: 3px;
    background: white; border-radius: 50%; transition: .3s;
    box-shadow: var(--shadow-sm);
}
.toggle-switch input:checked + .toggle-slider { background: #667eea; }
.toggle-switch input:checked + .toggle-slider:before { transform: translateX(18px); }

/* Acessórios dropdown */
.multi-select-wrapper { position: relative; }
.multi-select-trigger {
    width: 100%; padding: .55rem .75rem;
    border: 1px solid #d1d5db; border-radius: 6px;
    background: white; cursor: pointer;
    display: flex; justify-content: space-between; align-items: center;
    font-size: .9rem; color: #374151;
    user-select: none;
}
.multi-select-trigger:hover { border-color: #667eea; }
.multi-select-trigger.open { border-color: #667eea; box-shadow: 0 0 0 2px rgba(102,126,234,.2); }
.multi-select-dropdown {
    display: none; position: absolute; top: calc(100% + 4px); left: 0; right: 0;
    background: white; border: 1px solid #d1d5db; border-radius: 8px;
    box-shadow: var(--shadow-lg); z-index: 99999; max-height: 200px; overflow-y: auto;
}
.multi-select-dropdown.open { display: block; }
.multi-option {
    padding: .45rem .8rem; display: flex; align-items: center; gap: .5rem;
    cursor: pointer; font-size: .85rem; transition: background .1s;
}
.multi-option:hover { background: #f5f3ff; }
.multi-option input[type="checkbox"] { cursor: pointer; accent-color: #667eea; }
.selected-chips { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 6px; }
.chip {
    background: #ede9fe; color: #6d28d9;
    font-size: .72rem; padding: 2px 8px;
    border-radius: 12px; font-weight: 600;
    display: inline-flex; align-items: center; gap: 3px;
}
.chip-remove { cursor: pointer; opacity: .7; font-size: .8rem; }
.chip-remove:hover { opacity: 1; }

/* File upload */
.file-upload-area {
    border: 1.5px dashed #d1d5db; border-radius: 8px;
    padding: .75rem; display: flex; align-items: center; gap: .75rem;
    cursor: pointer; transition: border-color .15s;
}
.file-upload-area:hover { border-color: #667eea; background: #fafafa; }
.file-placeholder { font-size: .85rem; color: #9ca3af; flex: 1; }
.btn-browse {
    background: #667eea; color: white; border: none;
    border-radius: 6px; padding: .4rem .85rem;
    font-size: .82rem; font-weight: 600; cursor: pointer;
    white-space: nowrap;
}

/* Busca de insumo */
.insumo-search-box { display: flex; gap: .5rem; align-items: center; }
.insumo-search-box .inp { flex: 1; }
.btn-buscar { background: #667eea; color: white; border: none; border-radius: 6px; padding: .55rem 1rem; cursor: pointer; font-weight: 600; white-space: nowrap; }
.btn-buscar:hover { background: #5a6fd8; }
.btn-limpar { background: #fee2e2; color: #dc2626; border: 1px solid #fecaca; border-radius: 6px; padding: .55rem .9rem; cursor: pointer; font-weight: 600; }
.btn-limpar:hover { background: #fecaca; }

/* Insumo selecionado preview */
.insumo-preview {
    background: #f0f1ff; border: 1px solid #c7d2fe;
    border-radius: 8px; padding: .6rem .9rem;
    margin-top: .4rem; font-size: .82rem; color: #3730a3;
    display: none;
}
.insumo-preview.visible { display: block; }

/* Modal seletor de insumo */
.modal-seletor-box {
    background: white; width: 680px; max-width: 95vw;
    max-height: 82vh; border-radius: 12px;
    display: flex; flex-direction: column;
    box-shadow: 0 20px 60px rgba(0,0,0,.3);
}
.modal-header-seletor {
    padding: 1.25rem 1.5rem;
    display: flex; justify-content: space-between; align-items: center;
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white; border-radius: 12px 12px 0 0;
}
.modal-header-seletor h3 { margin: 0; font-size: 1.1rem; color: white; }
.modal-body-seletor { padding: 1.25rem; overflow-y: auto; }
.seletor-search { width: 100%; padding: .6rem .9rem; border: 1.5px solid #d1d5db; border-radius: 8px; font-size: .9rem; margin-bottom: .75rem; outline: none; }
.seletor-search:focus { border-color: #667eea; }
.lista-seletor { display: grid; gap: 6px; }
.card-seletor-item {
    border: 1px solid #e5e7eb; padding: 10px 14px;
    border-radius: 8px; cursor: pointer;
    transition: border-color .15s, background .15s;
}
.card-seletor-item:hover { border-color: #667eea; background: #f5f3ff; }
.seletor-item-cod { font-weight: 700; font-size: .8rem; color: #667eea; }
.seletor-item-desc { font-size: .88rem; color: var(--text-primary); margin-top: 2px; }
.seletor-item-info { font-size: .75rem; color: var(--text-secondary); margin-top: 2px; }

/* Modal de status */
.status-options { display: flex; flex-direction: column; gap: .5rem; margin: .75rem 0; }
.status-option {
    display: flex; align-items: center; gap: .75rem;
    padding: .75rem 1rem; border-radius: 10px;
    border: 2px solid transparent; cursor: pointer;
    transition: all .15s;
}
.status-option:hover { transform: translateY(-1px); }
.status-option.selected { border-color: currentColor; }
.status-option.opt-operando    { background: var(--status-ok);     color: var(--status-ok-txt); }
.status-option.opt-manutencao  { background: var(--status-manut);  color: var(--status-manut-txt); }
.status-option.opt-parado      { background: var(--status-parado); color: var(--status-parado-txt); }
.status-option.opt-aguard-peca { background: var(--status-peca);   color: var(--status-peca-txt); }
.status-option.opt-transferido { background: var(--status-transf); color: var(--status-transf-txt); }
.status-opt-icon { font-size: 1.4rem; }
.status-opt-body { flex: 1; }
.status-opt-nome { font-weight: 700; font-size: .9rem; }
.status-opt-desc { font-size: .75rem; opacity: .8; }

/* Histórico de status */
.historico-title { font-weight: 700; font-size: .88rem; color: #374151; margin: 1rem 0 .5rem; }
.hist-status-row {
    display: flex; align-items: center; gap: .6rem;
    padding: .5rem 0; border-bottom: 1px solid #f3f4f6;
    font-size: .82rem;
}
.hist-status-badge { flex-shrink: 0; }
.hist-status-info { flex: 1; color: var(--text-secondary); }
.hist-status-data { font-size: .72rem; color: var(--text-light); white-space: nowrap; }

/* ===== Summary cards ===== */
.summary-row {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: .5rem;
    margin-bottom: .6rem;
}
.summary-card {
    background: var(--bg-primary);
    border-radius: var(--radius-md);
    padding: .6rem .85rem;
    box-shadow: var(--shadow-sm);
    border-left: 4px solid transparent;
    display: flex; flex-direction: column; gap: .1rem;
}
.summary-card.ok     { border-left-color: var(--success-color); }
.summary-card.warn   { border-left-color: var(--warning-color); }
.summary-card.danger { border-left-color: var(--danger-color); }
.summary-card.info   { border-left-color: var(--info-color); }
.summary-card.primary{ border-left-color: var(--primary-color); }
.summary-num { font-size: 1.5rem; font-weight: 800; color: var(--text-primary); }
.summary-lbl { font-size: .75rem; color: var(--text-secondary); font-weight: 500; }
.summary-sub { font-size: .7rem; color: var(--text-light); }

/* ===== Empty state ===== */
.empty-state {
    text-align: center; padding: 2.5rem 1rem;
    color: var(--text-secondary); font-size: .9rem;
}
.empty-state .empty-icon { font-size: 2.5rem; margin-bottom: .5rem; }

/* ===== Scrollbar ===== */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: var(--bg-tertiary); border-radius: var(--radius-sm); }
::-webkit-scrollbar-thumb { background: var(--secondary-color); border-radius: var(--radius-sm); }
::-webkit-scrollbar-thumb:hover { background: #475569; }

/* ===== Animações ===== */
@keyframes fadeIn { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: translateY(0); } }
.main-layout, .summary-row, .equipamentos-section { animation: fadeIn .4s ease; }

/* ===== Responsivo ===== */
@media (max-width: 768px) {
    body { padding: var(--spacing-sm) var(--spacing-xs); }
    .header-left h1 { font-size: 1.3rem; }
    .form-grid-2, .form-grid-3 { grid-template-columns: 1fr; }
    .modal-card { max-height: 95vh; }
}

/* ===== Loading spinner ===== */
.loading-spinner {
    width: 36px; height: 36px;
    border: 3px solid var(--border-color);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin .7s linear infinite;
    margin: 1.5rem auto;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ===== Geocode feedback ===== */
.geocode-feedback {
    font-size: .75rem; margin-top: 4px;
    padding: .3rem .6rem; border-radius: 5px;
    display: none;
}
.geocode-feedback.ok { display: block; background: #d1fae5; color: #065f46; }
.geocode-feedback.err { display: block; background: #fee2e2; color: #7f1d1d; }


/* ============================================================
   CHECKLIST & TIMER DE PARADA
   ============================================================ */

/* Timer de parada — exibido nos cards e na tabela */
.timer-parada {
  display: inline-flex; align-items: center; gap: 5px;
  background: #fef2f2; border: 1px solid #fecaca;
  color: #dc2626; border-radius: 6px;
  padding: 3px 8px; font-size: .72rem; font-weight: 700;
  font-family: 'Courier New', monospace;
  white-space: nowrap; margin-top: 4px;
}
.timer-parada .timer-icon { font-size: .8rem; flex-shrink: 0; }
.timer-parada.manutencao  { background: #fffbeb; border-color: #fde68a; color: #92400e; }
.timer-parada.aguard-peca { background: #fff7ed; border-color: #fed7aa; color: #c2410c; }

/* Botão de checklist nos cards */
.btn-checklist {
  padding: 4px 8px; border-radius: 6px;
  border: 1px solid #667eea; background: #eff6ff;
  cursor: pointer; font-size: .72rem; font-weight: 700;
  color: #667eea; transition: all .15s;
}
.btn-checklist:hover { background: #667eea; color: white; }

/* Badge número do chamado */
.chamado-badge {
  display: inline-flex; align-items: center; gap: 4px;
  background: #f0f1ff; border: 1px solid #c7d2fe;
  color: #3730a3; border-radius: 5px;
  padding: 2px 7px; font-size: .7rem; font-weight: 700;
  white-space: nowrap;
}

/* ── Modal Checklist ── */
.modal-checklist { width: 640px; }

.checklist-equip-info {
  background: #f8fafc; border-radius: 10px;
  padding: .85rem 1rem; margin-bottom: 1rem;
  border: 1px solid var(--border-color);
  display: flex; flex-direction: column; gap: .3rem;
}
.checklist-equip-nome { font-weight: 700; font-size: 1rem; color: var(--text-primary); }
.checklist-equip-meta { font-size: .8rem; color: var(--text-secondary); display: flex; gap: 1rem; flex-wrap: wrap; }

/* Timer grande no modal */
.timer-grande {
  display: flex; flex-direction: column; align-items: center;
  background: #fef2f2; border: 2px solid #fecaca;
  border-radius: 12px; padding: 1rem; margin-bottom: 1rem;
}
.timer-grande.manutencao { background: #fffbeb; border-color: #fde68a; }
.timer-grande.aguard-peca { background: #fff7ed; border-color: #fed7aa; }
.timer-grande.operando   { background: #f0fdf4; border-color: #bbf7d0; }
.timer-grande-label { font-size: .78rem; font-weight: 600; color: #6b7280; margin-bottom: .25rem; }
.timer-grande-valor {
  font-size: 2rem; font-weight: 800;
  font-family: 'Courier New', monospace;
  color: #dc2626; letter-spacing: 2px;
}
.timer-grande-valor.manutencao  { color: #92400e; }
.timer-grande-valor.aguard-peca { color: #c2410c; }
.timer-grande-valor.operando    { color: #166534; }
.timer-grande-inicio { font-size: .72rem; color: #9ca3af; margin-top: .25rem; }

/* Histórico de checklist */
.checklist-hist-title {
  font-weight: 700; font-size: .88rem; color: #374151;
  margin: 1rem 0 .5rem; display: flex; justify-content: space-between;
  align-items: center;
}
.checklist-hist-row {
  border: 1px solid #e5e7eb; border-radius: 8px;
  padding: .65rem .85rem; margin-bottom: .5rem;
  background: #fafafa;
}
.checklist-hist-header {
  display: flex; justify-content: space-between;
  align-items: center; gap: .5rem; flex-wrap: wrap;
  margin-bottom: .3rem;
}
.checklist-hist-status { flex-shrink: 0; }
.checklist-hist-chamado { flex-shrink: 0; }
.checklist-hist-data { font-size: .72rem; color: #9ca3af; white-space: nowrap; }
.checklist-hist-desc {
  font-size: .82rem; color: #374151;
  margin-top: .25rem; line-height: 1.4;
}
.checklist-hist-acao {
  font-size: .78rem; color: #6b7280;
  margin-top: .2rem; font-style: italic;
}
.checklist-hist-responsavel {
  font-size: .74rem; color: #9ca3af; margin-top: .2rem;
}

/* Sessão de parada na tabela */
.td-timer { font-family: 'Courier New', monospace; font-size: .75rem; }
.td-chamado { font-size: .75rem; }

/* Separador de seção no modal */
.section-divider {
  font-size: .75rem; font-weight: 700; color: #9ca3af;
  text-transform: uppercase; letter-spacing: .05em;
  margin: 1rem 0 .5rem; padding-top: .75rem;
  border-top: 1px solid #e5e7eb;
}

/* ── Ícones de categoria de equipamento ── */
.equip-tipo-icon {
  display: inline-flex; align-items: center; justify-content: center;
  width: 38px; height: 38px; border-radius: 10px;
  font-size: 1.25rem; flex-shrink: 0;
  box-shadow: 0 2px 6px rgba(0,0,0,.12);
}
/* Badge de categoria no card */
.equip-categoria-badge {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: .68rem; font-weight: 700; padding: 2px 6px;
  border-radius: 4px; margin-top: 2px; white-space: nowrap;
  overflow: hidden; max-width: 140px; text-overflow: ellipsis;
}
/* Cluster de obras no mapa */
.map-cluster-label {
  position: absolute; top: -8px; right: -8px;
  background: #ef4444; color: white;
  border-radius: 50%; width: 18px; height: 18px;
  font-size: .65rem; font-weight: 800;
  display: flex; align-items: center; justify-content: center;
}
/* InfoWindow multi-obra */
.iw-obra-item {
  padding: 5px 0; border-bottom: 1px solid #e5e7eb;
}
.iw-obra-item:last-child { border-bottom: none; }
.iw-obra-nome { font-weight: 700; font-size: .88rem; color: #1e293b; }
.iw-obra-gerente { font-size: .74rem; color: #64748b; margin-top: 1px; }
.iw-obra-equips { font-size: .75rem; margin-top: 4px; }

/* ============================================================
   FEATURES 1, 3, 6, 7, 8 — KPIs, alertas, custo, SLA
   ============================================================ */

/* ── Alertas de vencimento ── */
.alertas-section {
  background: #fffbeb;
  border: 1px solid #fde68a;
  border-radius: var(--radius-lg);
  margin-bottom: .6rem;
  overflow: hidden;
}
.alertas-header {
  display: flex; justify-content: space-between; align-items: center;
  padding: .6rem 1rem;
  background: #fef3c7;
  font-weight: 700; font-size: .85rem; color: #92400e;
}
.alerta-row {
  display: flex; align-items: center; gap: .75rem; flex-wrap: wrap;
  padding: .45rem 1rem; border-top: 1px solid #fde68a;
  font-size: .78rem;
}
.alerta-equip { font-weight: 700; color: #1e293b; }
.alerta-tipo  { color: #64748b; background: #e5e7eb; padding: 1px 7px; border-radius: 4px; }
.alerta-obra  { color: #6d28d9; }
.alerta-prazo { margin-left: auto; white-space: nowrap; font-size: .77rem; }

/* ── Modal KPI ── */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: .75rem;
  margin-bottom: 1.25rem;
}
@media (max-width: 680px) { .kpi-grid { grid-template-columns: 1fr 1fr; } }
.kpi-card {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 1rem;
  text-align: center;
}
.kpi-valor {
  font-size: 2rem; font-weight: 800;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  line-height: 1;
}
.kpi-label { font-size: .78rem; font-weight: 700; color: #374151; margin-top: .4rem; }
.kpi-sub   { font-size: .68rem; color: #9ca3af; margin-top: .2rem; }

/* Barra de tempo */
.kpi-barra-titulo {
  font-size: .78rem; font-weight: 700; color: #374151; margin-bottom: .4rem;
}
.kpi-barra {
  display: flex; height: 20px; border-radius: 10px;
  overflow: hidden; background: #e5e7eb;
  margin-bottom: .4rem;
}
.kpi-barra-seg { height: 100%; transition: width .5s ease; }
.kpi-barra-seg.operando   { background: #10b981; }
.kpi-barra-seg.manutencao { background: #f59e0b; }
.kpi-barra-seg.parado     { background: #ef4444; }
.kpi-barra-legenda {
  display: flex; gap: 1rem; font-size: .72rem; margin-bottom: 1rem;
}

/* Custo no modal KPI */
.kpi-custo-box {
  background: #fff1f2; border: 1px solid #fecdd3;
  border-radius: 10px; padding: 1rem; margin-top: .5rem;
  display: flex; flex-direction: column; align-items: center; gap: .2rem;
}
.kpi-custo-label { font-size: .78rem; color: #9f1239; font-weight: 600; }
.kpi-custo-valor { font-size: 1.8rem; font-weight: 800; color: #dc2626;
  font-family: 'Courier New', monospace; }
.kpi-custo-base  { font-size: .72rem; color: #9ca3af; }

/* Custo no modal checklist */
#custoImprodutividadeBox {
  flex-direction: column; align-items: center;
  border: 2px solid #fecaca; background: #fff1f2;
  border-radius: 12px; padding: 1rem; margin-bottom: 1rem;
}
#custoImprodutividadeBox.manutencao {
  border-color: #fde68a; background: #fffbeb;
}
#custoParadaValor {
  font-size: 1.6rem; font-weight: 800;
  color: #dc2626; font-family: 'Courier New', monospace;
}
#custoImprodutividadeBox.manutencao #custoParadaValor { color: #92400e; }

/* Tag de etapa da obra nos cards */
.etapa-badge {
  display: inline-flex; align-items: center; gap: 3px;
  background: #f0f9ff; color: #0369a1;
  border: 1px solid #bae6fd; border-radius: 4px;
  font-size: .65rem; font-weight: 700; padding: 1px 6px;
  white-space: nowrap; margin-top: 2px;
}

/* SLA indicator na tabela */
.sla-ok  { color: #10b981; font-weight: 700; font-size: .72rem; }
.sla-err { color: #ef4444; font-weight: 700; font-size: .72rem; }

/* Botão KPI na tabela */
.btn-kpi {
  padding: 3px 7px; border-radius: 5px;
  border: 1px solid #c7d2fe; background: #eef2ff;
  cursor: pointer; font-size: .72rem; color: #4f46e5;
  font-weight: 600; transition: all .12s;
}
.btn-kpi:hover { background: #4f46e5; color: white; }

/* ============================================================
   MELHORIAS 1–9 — Novos estilos (v20260411)
   ============================================================ */

/* ── Variáveis de status novos ── */
:root {
  --status-sem-op:     #fde8d8;
  --status-sem-op-txt: #9a3412;
  --status-outros:     #ede9fe;
  --status-outros-txt: #4c1d95;
}

/* ── Status badge sem-operador ── */
.status-badge.sem-operador {
  background: var(--status-sem-op);
  color: var(--status-sem-op-txt);
}
.status-badge.outros {
  background: var(--status-outros);
  color: var(--status-outros-txt);
}

/* ── Opção no select de status ── */
.opt-sem-operador { border-left: 4px solid #9a3412 !important; }
.opt-outros       { border-left: 4px solid #6366f1 !important; }
.opt-sem-operador.selected { background: #fde8d8; }
.opt-outros.selected       { background: #ede9fe; }

/* ── Timer com sem-operador ── */
.timer-grande.sem-operador {
  background: #fde8d8;
  border-color: #fdba74;
}
.timer-grande-valor.sem-operador { color: #9a3412; }

/* ── Chip equip-status no painel ── */
.equip-chip.status-sem-operador {
  background: var(--status-sem-op);
  color: var(--status-sem-op-txt);
  border: 1px solid #fdba74;
}
.equip-chip.status-outros {
  background: var(--status-outros);
  color: var(--status-outros-txt);
  border: 1px solid #c4b5fd;
}

/* ── Barra KPI sem-operador ── */
.kpi-barra-seg.sem-operador { background: #9a3412; }

/* ── Linha alerta threshold na tabela (MELHORIA 7) ── */
.linha-alerta-threshold {
  background: #fff7ed !important;
  border-left: 3px solid #f59e0b;
  animation: pulsarAlerta 2s ease-in-out infinite;
}
@keyframes pulsarAlerta {
  0%, 100% { background: #fff7ed !important; }
  50%       { background: #fef3c7 !important; }
}

/* ── Horas improdutivas no card da obra (MELHORIA 6) ── */
.obra-horas-mes {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: .7rem;
  color: #dc2626;
  font-weight: 600;
  margin-top: 2px;
}

/* ── Aviso de operador no checklist (MELHORIA 9) ── */
.aviso-operador-box {
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  border-radius: 8px;
  padding: .6rem .85rem;
  font-size: .8rem;
  color: #1d4ed8;
  margin-bottom: .75rem;
}

/* ── Informações do fornecedor no modal e-mail (MELHORIA 2) ── */
.email-forn-info {
  background: #fffbeb;
  border: 1px solid #fde68a;
  border-radius: 8px;
  padding: .75rem 1rem;
  margin-bottom: 1rem;
  font-size: .85rem;
  display: flex;
  flex-direction: column;
  gap: .25rem;
}

/* ── Linhas do log de e-mails (MELHORIA 8) ── */
.email-log-row {
  display: flex;
  align-items: center;
  gap: .6rem;
  flex-wrap: wrap;
  padding: .35rem .5rem;
  border-bottom: 1px solid #f1f5f9;
  font-size: .78rem;
}
.email-log-row:last-child { border-bottom: none; }
.email-log-status { font-weight: 700; flex-shrink: 0; }
.email-log-tipo   { color: #64748b; background: #f1f5f9; border-radius: 4px; padding: 1px 6px; }
.email-log-para   { color: #1d4ed8; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.email-log-data   { font-size: .7rem; color: #9ca3af; white-space: nowrap; margin-left: auto; }

/* ── Resumo do relatório por período (MELHORIA 1) ── */
.relatorio-resumo {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 1rem;
  margin-bottom: 1rem;
}
.relatorio-kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: .65rem;
}
@media (max-width: 600px) {
  .relatorio-kpi-grid { grid-template-columns: 1fr 1fr; }
}
.relatorio-tabela-wrap {
  overflow-x: auto;
  margin-top: .5rem;
}
.relatorio-tabela {
  width: 100%;
  border-collapse: collapse;
  font-size: .8rem;
}
.relatorio-tabela th {
  background: #f1f5f9;
  font-weight: 700;
  font-size: .72rem;
  color: #374151;
  padding: 6px 10px;
  text-align: left;
  border-bottom: 2px solid #e2e8f0;
}
.relatorio-tabela td {
  padding: 5px 10px;
  border-bottom: 1px solid #f1f5f9;
  vertical-align: middle;
}
.relatorio-tabela tr:hover td { background: #f8fafc; }

/* ── Comparativo KPI multi-equipamento (MELHORIA 5) ── */
.kpi-comp-titulo {
  font-size: .8rem;
  font-weight: 700;
  color: #374151;
  margin-bottom: .6rem;
  padding-top: .75rem;
  border-top: 1px solid #e5e7eb;
}
.kpi-comp-row {
  display: grid;
  grid-template-columns: 1fr auto 120px auto;
  gap: .5rem;
  align-items: center;
  padding: .45rem .65rem;
  border-radius: 7px;
  margin-bottom: .35rem;
  font-size: .78rem;
}
.kpi-comp-nome {
  font-weight: 600;
  color: #1e293b;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.kpi-comp-barra-wrap {
  height: 8px;
  background: #e5e7eb;
  border-radius: 4px;
  overflow: hidden;
}
.kpi-comp-barra {
  height: 100%;
  border-radius: 4px;
  transition: width .4s ease;
  min-width: 2px;
}
.kpi-comp-horas {
  font-family: monospace;
  font-weight: 700;
  font-size: .75rem;
  text-align: right;
  white-space: nowrap;
}

/* ── Modal tamanhos novos ── */
.modal-md { width: 580px; }

/* ── Historico de status ── */
.historico-title {
  font-weight: 700;
  font-size: .85rem;
  color: #374151;
  margin: 1rem 0 .5rem;
  padding-top: .75rem;
  border-top: 1px solid #e5e7eb;
}
.hist-status-row {
  display: flex;
  align-items: center;
  gap: .5rem;
  flex-wrap: wrap;
  padding: .4rem .5rem;
  border-bottom: 1px solid #f1f5f9;
  font-size: .78rem;
}
.hist-status-row:last-child { border-bottom: none; }
.hist-status-badge { flex-shrink: 0; }
.hist-status-info  { color: #64748b; flex: 1; min-width: 0; font-size: .75rem; }
.hist-status-data  { font-size: .7rem; color: #9ca3af; margin-left: auto; white-space: nowrap; }

/* ============================================================
   REDESIGN PAINEL LATERAL + FILTRO + CHECKLIST DIÁRIO
   v20260412
   ============================================================ */

/* ── Obra Card v2 ── */
.obra-card-v2 {
  border-radius: 10px;
  border: 1px solid var(--border-color);
  background: var(--bg-primary);
  margin-bottom: .65rem;
  overflow: hidden;
  cursor: pointer;
  transition: box-shadow .15s, transform .12s;
}
.obra-card-v2:hover { box-shadow: 0 4px 16px rgba(0,0,0,.12); transform: translateY(-1px); }

/* Faixa lateral de status */
.obra-card-v2.lateral-ok      { border-left: 4px solid #10b981; }
.obra-card-v2.lateral-alerta  { border-left: 4px solid #f59e0b; }
.obra-card-v2.lateral-critico { border-left: 4px solid #ef4444; }
.obra-card-v2.lateral-inativo { border-left: 4px solid #94a3b8; }

/* Header da obra */
.obra-v2-header {
  display: flex;
  align-items: center;
  gap: .6rem;
  padding: .65rem .85rem .5rem;
}
.obra-v2-dot {
  width: 10px; height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
  box-shadow: 0 0 0 3px rgba(0,0,0,.08);
}
.obra-v2-info { flex: 1; min-width: 0; }
.obra-v2-nome {
  font-weight: 700;
  font-size: .88rem;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.obra-v2-end {
  font-size: .72rem;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 1px;
}
.obra-v2-alerta {
  font-size: .68rem;
  color: #dc2626;
  font-weight: 600;
  margin-top: 2px;
}

/* Contadores */
.obra-v2-contadores {
  display: flex;
  gap: .3rem;
  flex-shrink: 0;
}
.obra-v2-cnt {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
}
.obra-v2-num {
  font-size: .9rem;
  font-weight: 800;
  line-height: 1;
  min-width: 22px;
  text-align: center;
  border-radius: 5px;
  padding: 1px 4px;
}
.obra-v2-num.ok     { color: #059669; background: #d1fae5; }
.obra-v2-num.warn   { color: #b45309; background: #fef3c7; }
.obra-v2-num.danger { color: #dc2626; background: #fee2e2; }
.obra-v2-lbl { font-size: .6rem; color: var(--text-light); font-weight: 600; text-transform: uppercase; }

/* Botões da obra */
.obra-v2-btns {
  display: flex;
  gap: .25rem;
  flex-shrink: 0;
}
.obra-v2-btn {
  width: 26px; height: 26px;
  border-radius: 6px;
  border: 1px solid var(--border-color);
  background: var(--bg-secondary);
  cursor: pointer;
  font-size: .8rem;
  display: flex; align-items: center; justify-content: center;
  transition: all .12s;
  color: var(--text-secondary);
}
.obra-v2-btn:hover { background: #eff6ff; border-color: var(--primary-color); color: var(--primary-color); }
.obra-v2-btn.red:hover { background: #fee2e2; border-color: #ef4444; color: #dc2626; }

/* Lista de equipamentos no painel */
.obra-v2-equips {
  padding: .4rem .6rem .55rem;
  display: flex;
  flex-direction: column;
  gap: .35rem;
  border-top: 1px solid var(--border-light);
}
.obra-v2-empty {
  padding: .4rem .85rem .55rem;
  font-size: .75rem;
  color: var(--text-light);
  font-style: italic;
  border-top: 1px solid var(--border-light);
}

/* Card de equipamento com ícone SVG */
.painel-equip-card {
  display: flex;
  align-items: center;
  gap: .55rem;
  padding: .45rem .55rem;
  border-radius: 8px;
  border: 1.5px solid transparent;
  background: #f8fafc;
  cursor: pointer;
  transition: all .13s;
}
.painel-equip-card:hover {
  background: white;
  box-shadow: 0 2px 8px rgba(0,0,0,.1);
  transform: translateX(2px);
}

/* Borda esquerda colorida por status */
.painel-equip-card.borda-operando     { border-left-color: #10b981; }
.painel-equip-card.borda-manutencao   { border-left-color: #f59e0b; }
.painel-equip-card.borda-parado       { border-left-color: #ef4444; }
.painel-equip-card.borda-aguard-peca  { border-left-color: #f59e0b; }
.painel-equip-card.borda-sem-operador { border-left-color: #9a3412; }
.painel-equip-card.borda-outros       { border-left-color: #6366f1; }

/* Ícone SVG do equipamento */
.painel-equip-icon {
  width: 36px; height: 36px;
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 1px 4px rgba(0,0,0,.1);
}
.painel-equip-icon svg { width: 22px; height: 22px; }

.painel-equip-body { flex: 1; min-width: 0; }
.painel-equip-nome {
  font-size: .78rem;
  font-weight: 700;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.painel-equip-status-row {
  display: flex;
  align-items: center;
  gap: .35rem;
  margin-top: 2px;
}
.painel-badge {
  font-size: .64rem;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 4px;
}
.painel-equip-timer {
  font-size: .65rem;
  font-family: 'Courier New', monospace;
  color: #dc2626;
  margin-top: 2px;
  font-weight: 600;
}
.painel-equip-ck {
  font-size: .7rem;
  flex-shrink: 0;
}
.ck-ok      { opacity: 1; }
.ck-pendente { opacity: .85; }

/* ── Ícone SVG na tabela ── */
.td-equip-icon {
  width: 32px; height: 32px;
  border-radius: 7px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 1px 3px rgba(0,0,0,.1);
}
.td-equip-icon svg { width: 20px; height: 20px; }

/* ── Botão Checklist Diário ── */
.btn-ck-diario {
  padding: 3px 7px;
  border-radius: 5px;
  border: 1px solid;
  cursor: pointer;
  font-size: .72rem;
  font-weight: 700;
  transition: all .12s;
}
.btn-ck-diario.ck-diario-ok {
  background: #d1fae5;
  border-color: #6ee7b7;
  color: #059669;
}
.btn-ck-diario.ck-diario-ok:hover { background: #a7f3d0; }
.btn-ck-diario.ck-diario-pend {
  background: #fee2e2;
  border-color: #fca5a5;
  color: #dc2626;
  animation: pulsarAlerta 2s ease-in-out infinite;
}
.btn-ck-diario.ck-diario-pend:hover { background: #fecaca; animation: none; }

/* ── FILTRO PROFISSIONAL ── */
.tabela-toolbar {
  background: white;
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  border: 1px solid var(--border-color);
  border-bottom: none;
  padding: .75rem 1rem;
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  flex-wrap: wrap;
}
.tabela-toolbar-left {
  display: flex;
  align-items: center;
  gap: .75rem;
  flex-shrink: 0;
}
.tabela-titulo {
  font-size: .95rem;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0;
  display: flex;
  align-items: center;
  gap: .5rem;
}
.tabela-contador {
  font-size: .72rem;
  font-weight: 600;
  color: var(--text-secondary);
  background: var(--bg-tertiary);
  border-radius: 20px;
  padding: 1px 8px;
}
.tabela-toolbar-filtros {
  display: flex;
  align-items: flex-end;
  gap: .85rem;
  flex: 1;
  flex-wrap: wrap;
}
.tabela-toolbar-right {
  flex-shrink: 0;
  display: flex;
  align-items: flex-end;
}
.filtro-bloco {
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.filtro-label {
  font-size: .68rem;
  font-weight: 700;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: .04em;
}
.filtro-sel {
  padding: .38rem .6rem;
  border: 1.5px solid var(--border-color);
  border-radius: var(--radius-md);
  font-size: .8rem;
  color: var(--text-primary);
  background: var(--bg-secondary);
  cursor: pointer;
  transition: border-color .15s;
  min-width: 140px;
}
.filtro-sel:focus { outline: none; border-color: var(--primary-color); }

/* Chips de status */
.filtro-status-chips {
  display: flex;
  gap: .3rem;
  flex-wrap: wrap;
}
.fchip {
  padding: .28rem .7rem;
  border-radius: 20px;
  border: 1.5px solid var(--border-color);
  font-size: .72rem;
  font-weight: 600;
  cursor: pointer;
  background: var(--bg-secondary);
  color: var(--text-secondary);
  transition: all .13s;
  white-space: nowrap;
}
.fchip:hover       { background: #eff6ff; border-color: var(--primary-color); color: var(--primary-color); }
.fchip.active      { background: var(--primary-color); border-color: var(--primary-color); color: white; }
.fchip-ok.active   { background: #10b981; border-color: #10b981; color: white; }
.fchip-warn.active { background: #f59e0b; border-color: #f59e0b; color: white; }
.fchip-danger.active { background: #ef4444; border-color: #ef4444; color: white; }
.fchip-dark.active { background: #9a3412; border-color: #9a3412; color: white; }
.fchip-info.active { background: #6366f1; border-color: #6366f1; color: white; }

/* Campo de busca */
.filtro-busca { min-width: 200px; }
.filtro-search-wrap {
  position: relative;
  display: flex;
  align-items: center;
}
.filtro-search-icon {
  position: absolute;
  left: .6rem;
  font-size: .8rem;
  color: var(--text-light);
  pointer-events: none;
}
.filtro-search-inp {
  padding: .38rem .6rem .38rem 2rem;
  border: 1.5px solid var(--border-color);
  border-radius: var(--radius-md);
  font-size: .8rem;
  width: 100%;
  background: var(--bg-secondary);
  color: var(--text-primary);
  transition: border-color .15s;
}
.filtro-search-inp:focus { outline: none; border-color: var(--primary-color); background: white; }
.filtro-clear-btn {
  position: absolute;
  right: .5rem;
  background: none;
  border: none;
  cursor: pointer;
  font-size: .75rem;
  color: var(--text-light);
  display: none;
  align-items: center;
  justify-content: center;
  width: 18px; height: 18px;
  border-radius: 50%;
  transition: all .1s;
}
.filtro-clear-btn:hover { background: #fee2e2; color: #dc2626; }

/* Botão recolher */
.btn-toggle-tabela {
  width: 32px; height: 32px;
  border: 1.5px solid var(--border-color);
  background: var(--bg-secondary);
  border-radius: var(--radius-md);
  cursor: pointer;
  font-size: .8rem;
  color: var(--text-secondary);
  display: flex; align-items: center; justify-content: center;
  transition: all .12s;
}
.btn-toggle-tabela:hover { background: #eff6ff; border-color: var(--primary-color); color: var(--primary-color); }

/* ── MODAL CHECKLIST DIÁRIO ── */
.modal-ckd {
  width: 680px;
  max-height: 90vh;
}
.ckd-header {
  background: linear-gradient(135deg, #1e40af 0%, #065f46 100%);
  padding: 1rem 1.25rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.ckd-header-left {
  display: flex;
  align-items: center;
  gap: .75rem;
}
.ckd-header-icon {
  font-size: 1.8rem;
  flex-shrink: 0;
}
.ckd-equip-banner {
  background: #f8fafc;
  border-bottom: 1px solid var(--border-color);
  padding: .75rem 1.25rem;
}
.ckd-equip-info-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: .3rem .75rem;
  margin-bottom: .6rem;
}
@media (max-width: 600px) {
  .ckd-equip-info-grid { grid-template-columns: 1fr 1fr; }
}
.ckd-lbl {
  font-size: .65rem;
  font-weight: 700;
  color: var(--text-light);
  text-transform: uppercase;
  letter-spacing: .04em;
  display: block;
}
.ckd-val {
  font-size: .8rem;
  font-weight: 600;
  color: var(--text-primary);
}
.ckd-progresso-wrap { margin-top: .4rem; }
.ckd-progresso-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 3px;
}
.ckd-pct {
  font-size: .75rem;
  font-weight: 800;
  color: var(--text-primary);
}
.ckd-progresso-bg {
  height: 8px;
  background: var(--border-color);
  border-radius: 4px;
  overflow: hidden;
}
.ckd-progresso-bar {
  height: 100%;
  border-radius: 4px;
  transition: width .4s ease, background .3s;
}

/* Corpo do checklist */
.ckd-body { padding: 1rem 1.25rem; }
.ckd-grupo {
  margin-bottom: 1.25rem;
}
.ckd-grupo-titulo {
  font-size: .8rem;
  font-weight: 700;
  color: #1e40af;
  background: #eff6ff;
  border-radius: 6px;
  padding: .45rem .75rem;
  margin-bottom: .5rem;
  border-left: 3px solid #3b82f6;
}
.ckd-item {
  display: flex;
  flex-direction: column;
  padding: .55rem .65rem;
  border-radius: 7px;
  border: 1.5px solid var(--border-color);
  margin-bottom: .35rem;
  background: white;
  transition: all .15s;
}
.ckd-item.ckd-ok { background: #f0fdf4; border-color: #86efac; }
.ckd-item.ckd-nc { background: #fff1f2; border-color: #fca5a5; }
.ckd-item.ckd-na { background: #f8fafc; border-color: #cbd5e1; opacity: .7; }
.ckd-item-texto {
  font-size: .8rem;
  color: var(--text-primary);
  line-height: 1.45;
  margin-bottom: .4rem;
}
.ckd-item-opcoes {
  display: flex;
  gap: .5rem;
  flex-wrap: wrap;
}
.ckd-radio {
  display: flex;
  align-items: center;
  gap: .3rem;
  font-size: .75rem;
  font-weight: 600;
  cursor: pointer;
  padding: .2rem .6rem;
  border-radius: 4px;
  border: 1px solid var(--border-color);
  background: var(--bg-secondary);
  transition: all .12s;
}
.ckd-radio:hover { background: #eff6ff; border-color: var(--primary-color); }
.ckd-radio.ok:hover { background: #d1fae5; border-color: #10b981; }
.ckd-radio.nc:hover { background: #fee2e2; border-color: #ef4444; }
.ckd-radio.na:hover { background: #f1f5f9; border-color: #94a3b8; }
.ckd-radio input[type="radio"] { accent-color: var(--primary-color); }
.ckd-obs-row { margin-top: .4rem; }
.ckd-obs-inp { width: 100%; }
.ckd-assinatura-row {
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border-color);
}
.ckd-no-norma {
  text-align: center;
  padding: 2rem 1rem;
  color: var(--text-secondary);
  background: #f8fafc;
  border-radius: 8px;
  border: 1px dashed var(--border-color);
}


/* ============================================================
   PORTAL DE OBRA — estilos adicionais compartilhados
   ============================================================ */

/* Badge chamado já existe, adiciona apenas os faltantes */
.aviso-operador-box {
  background: #fef3c7; border: 1px solid #fde68a;
  border-radius: 8px; padding: .65rem .85rem;
  font-size: .82rem; color: #92400e; margin-bottom: .5rem;
}

/* Garante que timer-parada já definido funcione no portal */
.portal-equip-card .timer-parada {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: .72rem; font-weight: 700;
  font-family: 'Courier New', monospace;
}

/* Botao desabilitado (Commit 2 - Nova Obra sem filiais) */
.btn-secondary[disabled] { opacity: .5; cursor: not-allowed; }
.btn-secondary[disabled]:hover { background: white; transform: none; }

/* =============================================================
   ICONE DE AJUDA (?) + POPUP - Bloco 2 (Custo por Hora)
   ============================================================= */
.help-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  margin-left: .4rem;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: #6b7280;
  color: #fff;
  font-size: .72rem;
  font-weight: 700;
  cursor: pointer;
  vertical-align: middle;
  line-height: 1;
  transition: background .15s;
}
.help-icon:hover { background: #4b5563; }
.help-icon:focus { outline: 2px solid #667eea; outline-offset: 2px; }

.help-popup {
  position: absolute;
  z-index: 1000;
  top: 100%;
  left: 0;
  right: 0;
  margin-top: .25rem;
  background: #fffbeb;
  border: 1px solid #fde68a;
  border-radius: 8px;
  padding: .75rem .9rem;
  font-size: .82rem;
  color: #92400e;
  line-height: 1.45;
  box-shadow: 0 4px 12px rgba(0,0,0,.15);
  max-width: 100%;
}
.help-popup strong { display: block; margin-bottom: .35rem; color: #78350f; }
.help-popup em { display: block; margin-top: .4rem; font-style: italic; }
