/* ============================================
   Sistema de Manutenção Preventiva CCB - v3
   CSS responsivo (mobile-first)
   ============================================ */

* { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background: #f5f5f7; color: #1d1d1f; line-height: 1.5; min-height: 100vh;
    font-size: 14px;
}

/* === LOGIN === */
.login-fundo { display:flex; align-items:center; justify-content:center; min-height:100vh; padding:20px; }
.login-card {
    background:#fff; padding:28px 22px; border-radius:12px;
    box-shadow:0 2px 14px rgba(0,0,0,0.06); width:100%; max-width:380px;
}
.login-card h1 { font-size:20px; margin-bottom:4px; text-align:center; }
.login-card .subtitulo { text-align:center; color:#6e6e73; margin-bottom:20px; font-size:14px; }
.login-card .logo-img { display:block; margin:0 auto 18px; max-width:180px; width: 80%; height: auto; }
.aviso-teste {
    background:#fff8e1; border:1px solid #ffd76b; border-radius:8px;
    padding:10px 12px; font-size:12px; color:#7a5a00; margin-bottom:16px;
}

/* === APP LAYOUT === */
.app { display:flex; min-height:100vh; position: relative; }

/* Botão hambúrguer (só aparece no celular) */
.btn-hamburger {
    display: none;
    position: fixed;
    top: 12px; left: 12px;
    z-index: 100;
    background: #1a3a5c;
    color: #fff;
    border: none;
    width: 44px; height: 44px;
    border-radius: 8px;
    font-size: 20px;
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(0,0,0,0.2);
}

/* Overlay quando sidebar está aberta no mobile */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 90;
}
.sidebar-overlay.aberto { display: block; }

.sidebar {
    width:210px; background:#1a3a5c; color:#fff; padding:18px 0;
    display:flex; flex-direction:column; gap:6px;
    flex-shrink: 0;
}
.sidebar-logo {
    padding:14px 16px 18px; text-align:center;
    border-bottom:1px solid rgba(255,255,255,0.15); margin-bottom:14px;
}
.sidebar-logo .logo-container {
    background:#fff; padding:8px 6px; border-radius:6px;
    display:inline-block; margin-bottom:4px;
}
.sidebar-logo img { max-width:120px; display:block; }
.sidebar-logo .setor-label {
    font-size:11px; color:#a8c4e0; margin-top:10px;
    text-transform:uppercase; letter-spacing:1px;
}
.sidebar-logo .setor-valor { font-size:14px; font-weight:600; }
.sidebar-logo .papel-coord {
    background:#f5b800; color:#1a3a5c; font-size:10px;
    padding:2px 8px; border-radius:10px; display:inline-block;
    margin-top:6px; font-weight:600; letter-spacing:0.5px;
}
.seletor-setor {
    margin:8px 14px 4px; padding:8px;
    background:rgba(255,255,255,0.08); border-radius:6px;
}
.seletor-setor label {
    font-size:10px; color:#a8c4e0; text-transform:uppercase;
    letter-spacing:0.5px; display:block; margin-bottom:4px;
}
.seletor-setor select {
    width:100%; padding:6px 8px; background:#fff; color:#1d1d1f;
    border:none; border-radius:5px; font-size:13px;
    font-family:inherit; cursor:pointer;
}
.menu-btn {
    padding:12px 18px; background:none; border:none; color:#fff;
    text-align:left; cursor:pointer; font-size:14px; font-family:inherit;
    border-left:3px solid transparent; transition:all 0.15s;
    text-decoration:none; display:block;
    min-height: 44px;
}
.menu-btn:hover { background:rgba(255,255,255,0.08); }
.menu-btn.ativo {
    background:rgba(255,255,255,0.12);
    border-left-color:#4a9eff; font-weight:500;
}
.menu-rodape {
    margin-top:auto; padding:14px 18px;
    border-top:1px solid rgba(255,255,255,0.15);
    font-size:12px; color:#a8c4e0;
}
.menu-rodape a { color:#fff; text-decoration:none; cursor:pointer; }
.menu-rodape .nome-usr { color:#fff; font-weight:500; }

.conteudo { flex:1; padding:24px 28px; overflow-x:hidden; min-width: 0; }
.titulo-pag { font-size:22px; font-weight:600; color:#1a3a5c; margin-bottom:6px; }
.subtitulo-pag { font-size:13px; color:#6e6e73; margin-bottom:20px; }

/* === DASHBOARD HEADER === */
.dash-header {
    background:#1a3a5c; color:#fff; padding:14px 22px;
    border-radius:10px; margin-bottom:14px; display:flex;
    align-items:center; gap:18px; box-shadow:0 2px 6px rgba(0,0,0,0.08);
    flex-wrap: wrap;
}
.dash-header-logo-wrap {
    background:#fff; padding:6px 8px;
    border-radius:6px; flex-shrink:0;
}
.dash-header-logo { width:60px; height:auto; display:block; }
.dash-header-texto { flex:1; min-width: 200px; }
.dash-header h1 { font-size:22px; font-weight:600; margin:0; line-height:1.2; }
.dash-header .sub { font-size:12px; color:#a8c4e0; margin-top:2px; }
.dash-header-data {
    text-align:right; font-size:12px;
    color:#a8c4e0; flex-shrink:0;
}
.dash-header-data strong { color:#fff; font-size:14px; display:block; margin-top:2px; }

/* === CARDS DO DASHBOARD === */
.dash-cards {
    display:grid; grid-template-columns:repeat(4, 1fr);
    gap:14px; margin-bottom:18px;
}
.dash-card {
    background:#fff; border-radius:10px; overflow:hidden;
    box-shadow:0 1px 3px rgba(0,0,0,0.04);
    transition: transform 0.15s, box-shadow 0.15s;
}
.dash-card.clicavel { cursor: pointer; }
.dash-card.clicavel:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(0,0,0,0.1);
}
.dash-card .topo {
    padding:8px 14px; color:#fff; font-size:13px;
    font-weight:500; text-align:center;
}
.dash-card .corpo {
    padding:14px; display:flex; align-items:center;
    justify-content:center; min-height:80px;
}
.dash-card .valor { font-size:30px; font-weight:600; color:#1d1d1f; }
.dash-card .valor-grande { font-size:26px; font-weight:600; }
.dash-card .barra {
    height:6px; background:#e5e5ea; margin:0 14px 12px;
    border-radius:3px; overflow:hidden;
}
.dash-card .barra-fill { height:100%; transition:width 0.4s; }
.dash-card .perc { padding:0 14px 10px; font-size:11px; color:#888; text-align:left; }
.dc-verde .topo { background:#16a07e; } .dc-verde .barra-fill { background:#16a07e; }
.dc-amarelo .topo { background:#f5b800; } .dc-amarelo .barra-fill { background:#f5b800; }
.dc-vermelho .topo { background:#e74848; } .dc-vermelho .barra-fill { background:#e74848; }
.dc-azul .topo { background:#1a3a5c; }

.dash-graficos {
    display:grid; grid-template-columns:repeat(4, 1fr);
    gap:14px; margin-bottom:18px;
}
.dash-graf {
    background:#fff; border-radius:10px; overflow:hidden;
    box-shadow:0 1px 3px rgba(0,0,0,0.04);
    min-height:280px; display:flex; flex-direction:column;
}
.dash-graf .titulo-graf {
    padding:8px 14px; background:#1a3a5c; color:#fff;
    font-size:13px; font-weight:500; text-align:center;
}
.dash-graf .corpo-graf { flex:1; padding:14px; position:relative; min-height: 220px; }
.dash-bottom { display:grid; grid-template-columns:repeat(2, 1fr); gap:14px; }

/* === FILTROS === */
.filtros {
    background:#fff; padding:12px 14px; border-radius:8px; margin-bottom:14px;
    display:flex; gap:10px; align-items:center; flex-wrap:wrap;
    font-size:13px; box-shadow:0 1px 3px rgba(0,0,0,0.04);
}
.filtros label { color:#6e6e73; font-size:12px; }
.filtros select { padding:8px 10px; border:1px solid #d2d2d7; border-radius:6px; font-size:13px; min-height: 38px; }

/* === TABELAS === */
.tabela-wrap {
    background:#fff; border-radius:10px; overflow:hidden;
    box-shadow:0 1px 3px rgba(0,0,0,0.04); overflow-x:auto;
    -webkit-overflow-scrolling: touch;
}
table { width:100%; border-collapse:collapse; }
table thead { background:#f5f5f7; }
table th {
    padding:10px 12px; font-size:11px; color:#6e6e73;
    text-transform:uppercase; letter-spacing:0.5px;
    font-weight:500; text-align:left; white-space: nowrap;
}
table td { padding:10px 12px; font-size:13px; border-top:1px solid #f0f0f3; }
table tr:hover td { background:#fafafa; }

/* === BADGES === */
.badge {
    display:inline-block; padding:2px 8px;
    border-radius:10px; font-size:11px; font-weight:500;
}
.b-pend { background:#fde4e4; color:#a02828; }
.b-and { background:#e6f0ff; color:#0066cc; }
.b-fin { background:#e6f7eb; color:#1e7a3c; }
.b-prog { background:#fff4e6; color:#a06900; }
.b-canc { background:#f0f0f3; color:#6e6e73; }
.b-coord { background:#fff8e1; color:#a06900; }
.b-oper { background:#e6f0ff; color:#0066cc; }
.b-online { background:#e6f7eb; color:#1e7a3c; }
.b-ok { background:#e6f7eb; color:#1e7a3c; }
.b-parcial { background:#fff4e6; color:#a06900; }
.b-nao { background:#fde4e4; color:#a02828; }

/* === BOTÕES === */
.btn {
    display:inline-flex; align-items:center; gap:6px;
    padding:10px 16px; border-radius:7px;
    border:1px solid #d2d2d7; background:#fff; color:#1d1d1f;
    text-decoration:none; font-size:13px; cursor:pointer;
    font-family:inherit;
    min-height: 38px;
    white-space: nowrap;
}
.btn:hover { background:#f5f5f7; }
.btn-primario { background:#1a3a5c; color:#fff; border-color:#1a3a5c; }
.btn-primario:hover { background:#14304a; }
.btn-sucesso { background:#16a07e; color:#fff; border-color:#16a07e; }
.btn-sucesso:hover { background:#138867; }
.btn-perigo { background:#e74848; color:#fff; border-color:#e74848; }
.btn-perigo:hover { background:#c93b3b; }
.btn-pequeno { padding: 6px 10px; font-size: 11px; min-height: 30px; }
.barra-acoes {
    display:flex; gap:8px; margin-bottom:14px;
    justify-content:flex-end; flex-wrap:wrap;
}

/* === FORMULÁRIO === */
.form-grid {
    display:grid; grid-template-columns:repeat(auto-fit, minmax(220px, 1fr));
    gap:14px; background:#fff; padding:20px;
    border-radius:10px; box-shadow:0 1px 3px rgba(0,0,0,0.04);
}
.form-grid.uma-col { grid-template-columns:1fr; }
.campo { display:flex; flex-direction:column; }
.campo.col-2 { grid-column:span 2; }
.campo label { font-size:12px; color:#6e6e73; margin-bottom:4px; }
input, select, textarea {
    padding:10px 12px; border:1px solid #d2d2d7;
    border-radius:7px; font-size:14px; font-family:inherit; background:#fff;
    min-height: 40px;
}
input:focus, select:focus, textarea:focus {
    outline:none; border-color:#1a3a5c;
    box-shadow:0 0 0 3px rgba(26,58,92,0.15);
}
textarea { resize:vertical; min-height:60px; }
.acoes-form { margin-top:16px; display:flex; gap:8px; flex-wrap:wrap; }
.titulo-form { font-size:16px; font-weight:600; margin-bottom:14px; color:#1a3a5c; }

/* === ALERTAS === */
.alerta { padding:10px 14px; border-radius:8px; margin-bottom:14px; font-size:13px; }
.a-suc { background:#e6f7eb; color:#1e7a3c; border:1px solid #b8e0c5; }
.a-erro { background:#fdecec; color:#b32e2e; border:1px solid #f1bbbb; }
.a-info { background:#e6f0ff; color:#0066cc; border:1px solid #b8d4f0; }
.a-aviso { background:#fff8e1; color:#7a5a00; border:1px solid #ffd76b; }
.vazio { text-align:center; padding:40px 20px; color:#6e6e73; font-size:13px; }
.banner-coord-vis {
    background:#fff8e1; border:1px solid #ffd76b;
    padding:8px 14px; border-radius:6px;
    font-size:12px; color:#7a5a00; margin-bottom:14px;
}

/* === EXPORTANDO (loader) === */
.exportando {
    position:fixed; inset:0; background:rgba(0,0,0,0.6);
    display:flex; align-items:center; justify-content:center; z-index:9999;
}
.exportando-card {
    background:#fff; padding:24px 32px;
    border-radius:10px; text-align:center;
}
.exportando-card .spinner {
    display:inline-block; width:24px; height:24px;
    border:3px solid #e5e5ea; border-top-color:#1a3a5c;
    border-radius:50%; animation:girar 0.8s linear infinite; margin-bottom:10px;
}
@keyframes girar { to { transform:rotate(360deg); } }

/* === CHECKLIST === */
.checklist-grid {
    display:grid; grid-template-columns: 1fr; gap: 10px;
}
.checklist-item {
    background: #fff; border-radius: 10px; padding: 14px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
    display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
}
.checklist-item .casa-nome {
    font-weight: 600; flex: 1; min-width: 150px; color: #1a3a5c;
}
.checklist-item .botoes-status { display: flex; gap: 6px; flex-wrap: wrap; }
.btn-status {
    padding: 10px 14px; border-radius: 6px;
    border: 1px solid #d2d2d7; background: #fff; cursor: pointer;
    font-size: 13px; font-weight: 500;
    min-height: 38px;
    color: #1d1d1f;
    -webkit-appearance: none;
    appearance: none;
    font-family: inherit;
    line-height: 1.2;
    white-space: nowrap;
}
.btn-status.ativo-ok { background: #16a07e; color: #fff; border-color: #16a07e; }
.btn-status.ativo-parcial { background: #f5b800; color: #fff; border-color: #f5b800; }
.btn-status.ativo-nao { background: #e74848; color: #fff; border-color: #e74848; }
.checklist-item .info-extra { width:100%; font-size: 12px; color: #888; margin-top:6px; }

/* === REUNIÃO TRIMESTRAL === */
.tri-card {
    background: #fff; border-radius: 10px; padding: 18px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04); margin-bottom: 14px;
}
.tri-card-header {
    display: flex; justify-content: space-between; align-items: center;
    flex-wrap: wrap; gap: 10px; margin-bottom: 12px;
}
.tri-card-header h3 {
    font-size: 16px; color: #1a3a5c; margin: 0;
}
.tri-casa {
    background: #f9f9fb; border-radius: 8px; padding: 14px;
    margin-bottom: 12px; border-left: 4px solid #1a3a5c;
}
.tri-casa h4 {
    font-size: 15px; color: #1a3a5c; margin: 0 0 10px; font-weight: 600;
}
.tri-topico { margin: 12px 0; }
.tri-topico .label-topico {
    font-size: 12px; font-weight: 600; color: #1a3a5c;
    margin-bottom: 6px; text-transform: uppercase; letter-spacing: 0.5px;
}
.tri-topico .auto-info {
    background: #e6f0ff; border: 1px solid #b8d4f0;
    padding: 8px 12px; border-radius: 6px;
    font-size: 12px; color: #0066cc; margin-bottom: 6px;
}

/* === RESPONSIVIDADE === */

/* Tablets */
@media (max-width: 1100px) {
    .dash-cards { grid-template-columns: repeat(2, 1fr); }
    .dash-graficos { grid-template-columns: repeat(2, 1fr); }
}

/* Celulares - sidebar vira drawer */
@media (max-width: 800px) {
    .btn-hamburger { display: block; }
    .sidebar {
        position: fixed;
        top: 0; left: -100%;
        height: 100vh;
        width: 240px;
        z-index: 95;
        transition: left 0.25s;
        overflow-y: auto;
    }
    .sidebar.aberto { left: 0; }
    .conteudo {
        padding: 60px 16px 20px;
        width: 100%;
    }
    .dash-header { padding: 12px 14px; }
    .dash-header h1 { font-size: 18px; }
    .dash-header-texto { min-width: 0; flex-basis: 100%; }
    .dash-header-data { flex-basis: 100%; text-align: left; }
    .titulo-pag { font-size: 18px; }
    .form-grid { grid-template-columns: 1fr; padding: 16px; }
    .campo.col-2 { grid-column: span 1; }
    .dash-bottom { grid-template-columns: 1fr; }
    .barra-acoes { justify-content: stretch; }
    .barra-acoes .btn { flex: 1; justify-content: center; }
    .filtros { flex-direction: column; align-items: stretch; }
    .filtros select { width: 100%; }
}

@media (max-width: 500px) {
    .dash-cards { grid-template-columns: 1fr; }
    .dash-graficos { grid-template-columns: 1fr; }
    .dash-card .valor { font-size: 28px; }
    body { font-size: 13px; }
    .conteudo { padding: 60px 12px 16px; }
}
