/* style.css - Folha de Estilos Consolidada para manio.online */

:root {
    --primary-color: #0A2540;
    --accent-color: #C6A87D;
    --bg-body: #F5F7FA;
    --sidebar-width: 260px;
    --header-height: 70px;
    --text-main: #333;
    --text-muted: #666;
    --touch-target: 46px;
}

/* Página de planos de inspeção: formulário seguido da listagem, sem grelha lateral. */
body:has(.tabs) .grid {
    display: block;
}

body:has(.tabs) .grid > section:first-child {
    max-width: none;
    margin-bottom: 28px;
}

body:has(.tabs) .actions {
    align-items: flex-start;
    flex-wrap: nowrap;
}

body:has(.tabs) .actions form {
    margin: 0;
}

body:has(.tabs) .actions .btn-voltar {
    width: 38px;
    height: 38px;
    min-height: 38px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0;
    border-radius: 6px;
    background-color: #F8FAFC;
    border: 1px solid #CBD5E1;
    background-position: center;
    background-repeat: no-repeat;
    background-size: 19px;
}

body:has(.tabs) .actions a.btn-voltar {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%230A2540' stroke-width='1.8'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' d='M16.862 4.487 19.5 7.125m-2.638-2.638a2.121 2.121 0 0 0-3 0L5.25 13.1V16.75h3.65l8.612-8.612a2.121 2.121 0 0 0 0-3Z'/%3E%3C/svg%3E");
}

body:has(.tabs) .actions button.danger {
    background-color: #FFF7F7;
    border-color: #FCA5A5;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%23B91C1C' stroke-width='1.8'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' d='m14.74 9-.346 9m-4.788 0L9.26 9m9.968-3.21c.342.052.682.107 1.022.166m-1.022-.165L18.16 19.673a2.25 2.25 0 0 1-2.244 2.077H8.084a2.25 2.25 0 0 1-2.244-2.077L4.772 5.79m14.456 0a48.108 48.108 0 0 0-3.478-.397m-12 .562c.34-.059.68-.114 1.022-.165m0 0a48.11 48.11 0 0 1 3.478-.397m7.5 0V4.875c0-1.242-.956-2.25-2.198-2.29a51.95 51.95 0 0 0-3.104 0A2.25 2.25 0 0 0 8.25 4.875v.918'/%3E%3C/svg%3E");
}

body:has(.tabs) .actions .btn-voltar:hover {
    background-color: #E2E8F0;
}

/* Execução de inspeções: escolhas OK/NOK adequadas a toque em telemóvel. */
body:has(.inspection) .task div[style] {
    display: flex !important;
    gap: 10px !important;
    margin-top: 10px !important;
}

body:has(.inspection) .task label:has(input[type="radio"]) {
    min-width: 96px;
    min-height: 46px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 16px;
    border: 1px solid #CBD5E1;
    border-radius: 7px;
    background: #FFFFFF;
    color: #334155;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

body:has(.inspection) .task label:has(input[type="radio"]) input {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
}

body:has(.inspection) .task label:has(input[value="OK"]:checked) {
    background: #DCFCE7;
    border-color: #16A34A;
    color: #166534;
}

body:has(.inspection) .task label:has(input[value="NOK"]:checked) {
    background: #FEE2E2;
    border-color: #DC2626;
    color: #991B1B;
}

body:has(.inspection) .task label:has(input[type="radio"]):focus-within {
    outline: 3px solid rgba(59, 130, 246, 0.35);
    outline-offset: 2px;
}

/* O atributo hidden deve prevalecer sobre o layout dos itens do seletor de alvos. */
.target-choice[hidden] {
    display: none !important;
}

/* Ações do cabeçalho de Inspeções: ícones tácteis e acessíveis. */
body:has(.inspection) .page-header-institucional a[href="planos_inspecoes.php"],
body:has(.inspection) .page-header-institucional .planner-button,
body:has(.inspection) .page-header-institucional .kanban-button {
    width: 46px;
    height: 46px;
    min-height: 46px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0;
    border-radius: 7px;
    background-position: center;
    background-repeat: no-repeat;
    background-size: 22px;
}

/* Cartões arrastáveis e ações por ícone no planner semanal. */
.planner-task[draggable="true"] { cursor: grab; }
.planner-task.dragging { opacity: .45; cursor: grabbing; }
.day-column.drop-active { background: #EFF6FF; border-color: #3B82F6; }
.planner-nav .drop-active { background-color: #365A83; outline: 3px solid rgba(59, 130, 246, .32); outline-offset: 2px; }
.planner-actions { display:flex; gap:6px; margin-top:9px; }
.planner-icon-action { width:32px; height:32px; display:inline-flex; align-items:center; justify-content:center; border:1px solid #CBD5E1; border-radius:6px; background-color:#FFF; background-repeat:no-repeat; background-position:center; background-size:17px; font-size:0; }
.planner-icon-action.execute { background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%23166534' stroke-width='2'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' d='m9 12 2 2 4-4m4.5 2a7.5 7.5 0 1 1-15 0 7.5 7.5 0 0 1 15 0Z'/%3E%3C/svg%3E"); }
.planner-icon-action.edit { background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%230A2540' stroke-width='1.8'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' d='m16.862 4.487 2.638 2.638m-2.638-2.638a2.121 2.121 0 0 0-3 0L5.25 13.1V16.75h3.65l8.612-8.612a2.121 2.121 0 0 0 0-3Z'/%3E%3C/svg%3E"); }
.planner-icon-action:hover { background-color:#F1F5F9; }
.planner-date-modal { position:fixed; inset:0; z-index:2000; display:none; align-items:center; justify-content:center; padding:20px; background:rgba(15,23,42,.48); }
.planner-date-modal.visible { display:flex; }
.planner-date-modal__card { width:min(100%,390px); background:#FFF; border-radius:10px; padding:22px; box-shadow:0 20px 45px rgba(15,23,42,.25); }
.planner-date-modal__card h2 { margin:0 0 8px; font-size:1.15rem; }
.planner-date-modal__card input { width:100%; min-height:46px; margin:14px 0 18px; padding:8px; }
.planner-date-modal__actions { display:flex; justify-content:flex-end; gap:8px; }

/* Escala tipográfica mais compacta no planner. */
.week-grid .day-title { font-size: .8rem; }
.week-grid .day-date { font-size: .75rem; }
.week-grid .planner-task { font-size: .65rem; }
.week-grid .planner-task h3 { font-size: .8rem; }
.week-grid .planner-task p,
.week-grid .empty-day { font-size: .65rem; }

@media (max-width: 700px) {
    .week-grid {
        grid-template-columns: 1fr !important;
        overflow-x: visible !important;
    }

    .week-grid .day-column {
        min-height: 0 !important;
    }
}

body:has(.inspection) .page-header-institucional a[href="planos_inspecoes.php"] {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%23FFFFFF' stroke-width='1.8'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' d='M10.5 6h9.75M10.5 12h9.75m-9.75 6h9.75M3.75 6H6v.008H3.75V6Zm0 6H6v.008H3.75V12Zm0 6H6v.008H3.75V18Z'/%3E%3C/svg%3E");
}

body:has(.inspection) .page-header-institucional .planner-button {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%230A2540' stroke-width='1.8'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' d='M8.25 3v3m7.5-3v3M3.75 9.75h16.5M5.25 5.25h13.5A1.5 1.5 0 0 1 20.25 6.75v12a1.5 1.5 0 0 1-1.5 1.5H5.25a1.5 1.5 0 0 1-1.5-1.5v-12a1.5 1.5 0 0 1 1.5-1.5Z'/%3E%3C/svg%3E");
}

body:has(.inspection) .page-header-institucional .kanban-button {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%230A2540' stroke-width='1.8'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' d='M4.5 5.25A2.25 2.25 0 0 1 6.75 3h2.5a2.25 2.25 0 0 1 2.25 2.25v2.5A2.25 2.25 0 0 1 9.25 10h-2.5A2.25 2.25 0 0 1 4.5 7.75v-2.5ZM12.5 5.25A2.25 2.25 0 0 1 14.75 3h2.5a2.25 2.25 0 0 1 2.25 2.25v2.5A2.25 2.25 0 0 1 17.25 10h-2.5a2.25 2.25 0 0 1-2.25-2.25v-2.5ZM4.5 16.25A2.25 2.25 0 0 1 6.75 14h2.5a2.25 2.25 0 0 1 2.25 2.25v2.5A2.25 2.25 0 0 1 9.25 21h-2.5a2.25 2.25 0 0 1-2.25-2.25v-2.5ZM12.5 16.25A2.25 2.25 0 0 1 14.75 14h2.5a2.25 2.25 0 0 1 2.25 2.25v2.5A2.25 2.25 0 0 1 17.25 21h-2.5a2.25 2.25 0 0 1-2.25-2.25v-2.5Z'/%3E%3C/svg%3E");
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: var(--bg-body);
    color: var(--text-main);
    display: flex;
    min-height: 100vh;
    flex-direction: column;
}

/* ==========================================
   1. SIDEBAR SÓBRIA E RESPONSIVA
   ================================---------- */
.sidebar {
    width: var(--sidebar-width);
    background-color: #FFFFFF;
    padding: 20px;
    border-right: 1px solid #E2E8F0;
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;      /* <--- ADICIONAR ESTA LINHA */
    left: 0;     /* <--- ADICIONAR ESTA LINHA */
    height: 100%;
    z-index: 100;
    transition: transform 0.3s ease;
}

.sidebar-logo {
    margin-bottom: 30px;
    height: 40px;
    display: flex;
    align-items: center;
    font-weight: bold;
    color: var(--primary-color);
    font-size: 1.2rem;
    gap: 10px;
    text-decoration: none;
}

.sidebar-logo img {
    max-height: 35px;
    max-width: 140px;
    object-fit: contain;
    display: inline-flex;
    align-items: center;
}

.nav-links {
    list-style: none;
    flex: 1;
}

.nav-links li a {
    text-decoration: none;
    color: #475569; /* Cinzento corporativo sóbrio */
    padding: 10px 14px;
    display: flex;
    align-items: center;
    border-radius: 6px;
    transition: all 0.2s ease;
    font-weight: 500;
    margin-bottom: 4px;
    font-size: 0.9rem;
    gap: 10px;
}

.nav-links li a:hover {
    background-color: #F8FAFC;
    color: var(--primary-color);
}

.sidebar-admin-footer {
    margin-top: auto;
    padding-top: 15px;
    border-top: 1px solid #E2E8F0;
}

.btn-admin-config {
    background-color: #F8FAFC;
    color: var(--primary-color);
    border: 1px solid #CBD5E1;
    padding: 10px 14px;
    border-radius: 6px;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 600;
    font-size: 0.85rem;
}

.btn-admin-config:hover {
    background-color: #F1F5F9;
}

/* ==========================================
   2. BOTÃO HAMBÚRGUER E OVERLAY (MOBILE)
   ================================---------- */
.mobile-menu-btn {
    display: none;
    position: fixed;
    top: 15px;
    left: 15px;
    z-index: 1001;
    background: var(--primary-color);
    color: white;
    border: none;
    min-width: 46px;
    min-height: 46px;
    padding: 8px 12px;
    border-radius: 10px;
    font-size: 1.2rem;
    cursor: pointer;
}

.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.4);
    z-index: 99;
}

/* ==========================================
   3. LAYOUT INSTITUCIONAL E CONTEÚDO
   ================================---------- */
.page-header-institucional {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #FFFFFF;
    padding: 20px 40px;
    border-bottom: 1px solid #E2E8F0;
    margin-left: var(--sidebar-width);
}

.main-content-area {
    margin-left: var(--sidebar-width);
    flex: 1;
    padding: 40px;
    background-color: var(--bg-body);
}

footer.app-footer {
    margin-left: var(--sidebar-width);
    text-align: center;
    padding: 20px;
    font-size: 0.85rem;
    color: #64748B;
    border-top: 1px solid #E2E8F0;
    background: #FFFFFF;
}

.grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 25px;
    margin-top: 25px;
}

/* ==========================================
   4. CARTÕES, FORMULÁRIOS E TABELAS
   ================================---------- */
.card-box {
    background: #FFFFFF;
    padding: 24px;
    border-radius: 8px;
    border: 1px solid #E2E8F0;
    box-shadow: 0 1px 3px rgba(0,0,0,0.02);
    margin-bottom: 20px;
}

h1, h2 {
    color: var(--primary-color);
    font-weight: 600;
}

h1 { font-size: 1.6rem; margin-bottom: 5px; }
h2 { font-size: 1.1rem; margin-bottom: 15px; border-bottom: 1px solid #E2E8F0; padding-bottom: 8px; }

.form-group {
    margin-bottom: 18px;
}

label {
    display: block;
    margin-bottom: 7px;
    font-weight: 600;
    font-size: 0.875rem;
    color: #475569;
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="date"],
input[type="tel"],
input[type="search"],
input[type="file"],
select,
textarea {
    width: 100%;
    min-height: var(--touch-target);
    padding: 11px 13px;
    border: 1px solid #CBD5E1;
    border-radius: 9px;
    font-size: 16px; /* Evita o zoom automático no iPhone. */
    line-height: 1.35;
    background-color: #FFFFFF;
    color: #1E293B;
    transition: border-color .18s ease, box-shadow .18s ease, background-color .18s ease;
}

textarea { min-height: 116px; resize: vertical; }
input[type="file"] { cursor: pointer; padding: 9px 11px; }
input[type="file"]::file-selector-button {
    min-height: 30px;
    margin-right: 10px;
    padding: 5px 10px;
    border: 0;
    border-radius: 6px;
    background: #E2E8F0;
    color: var(--primary-color);
    font: inherit;
    font-weight: 700;
    cursor: pointer;
}

input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(10, 37, 64, 0.16);
}

.btn-submit {
    background-color: var(--primary-color);
    color: white;
    border: none;
    min-height: var(--touch-target);
    padding: 11px 18px;
    border-radius: 9px;
    font-size: 0.95rem;
    font-weight: 700;
    cursor: pointer;
    transition: background .2s ease, transform .15s ease, box-shadow .2s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-align: center;
}

.btn-submit:hover {
    background-color: #133E6B;
    box-shadow: 0 4px 10px rgba(10, 37, 64, .18);
}
.btn-submit:active { transform: translateY(1px); box-shadow: none; }
.btn-submit:focus-visible, .btn-voltar:focus-visible, .mobile-menu-btn:focus-visible { outline: 3px solid rgba(198, 168, 125, .75); outline-offset: 2px; }

.btn-voltar {
    background: #64748B;
    color: white;
    min-height: var(--touch-target);
    padding: 10px 16px;
    text-decoration: none;
    border-radius: 9px;
    font-size: 0.9rem;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.btn-voltar:hover { background: #475569; }

.notification-header-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.notification-header-actions form { margin: 0; }

table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 15px;
    background: #FFFFFF;
    border: 1px solid #E2E8F0;
    border-radius: 6px;
    overflow: hidden;
}

th, td {
    padding: 10px 14px;
    text-align: left;
    border-bottom: 1px solid #E2E8F0;
    font-size: 0.85rem;
}

th {
    background: #F8FAFC;
    color: var(--primary-color);
    font-weight: 600;
}

tr:last-child td {
    border-bottom: none;
}

/* ==========================================
   5. RESPONSIVIDADE (TELEMÓVEIS E TABLETS)
   ================================---------- */
@media (max-width: 1024px) {
    .sidebar {
        transform: translateX(-100%);
    }
    
    .sidebar.active {
        transform: translateX(0);
    }

    .sidebar-overlay.active {
        display: block;
    }

    .mobile-menu-btn {
        display: block;
    }

    .page-header-institucional, 
    .main-content-area, 
    .app-footer {
        margin-left: 0;
        padding: 20px;
    }

    .grid-2 {
        grid-template-columns: 1fr;
    }

    .card-box { padding: 22px; border-radius: 12px; }
}

@media (max-width: 600px) {
    .page-header-institucional {
        align-items: stretch;
        flex-direction: column;
        gap: 14px;
        padding: 68px 16px 16px;
    }

    .page-header-institucional .btn-voltar { width: 100%; }
    .notification-header-actions { flex-direction: column; align-items: stretch; }
    .main-content-area { padding: 16px; }
    .app-footer { padding: 18px 16px; }
    .card-box { padding: 16px; }
    h1 { font-size: 1.35rem; }
    .btn-submit { width: 100%; }
}
/* ==========================================
   6. KANBAN DE ORDENS DE TRABALHO
   ================================---------- */
.kanban-board {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
    margin-top: 10px;
    align-items: start;
}

.kanban-column {
    background: #F8FAFC;
    border-radius: 8px;
    border: 1px solid #E2E8F0;
    padding: 15px;
    min-height: 500px;
}

.kanban-header {
    text-align: center;
    font-weight: 700;
    color: white;
    padding: 12px;
    border-radius: 6px;
    margin-bottom: 10px;
    text-transform: uppercase;
    font-size: 0.85rem;
    letter-spacing: 0.5px;
}

/* Cores Profissionais e Sóbrias para o Kanban */
.header-aberto { background: #64748B; } /* Cinzento ardósia (A aguardar) */
.header-emcurso { background: var(--primary-color); } /* Azul Marinho (Ativo/Foco) */
.header-concluido { background: #C6A87D; } /* Verde Sóbrio/Escuro (Fechado) */

.kanban-count {
    text-align: center;
    font-size: 0.9rem;
    font-weight: 700;
    color: #475569;
    margin-bottom: 15px;
}

.kanban-card {
    background: #FFFFFF;
    border-radius: 6px;
    border: 1px solid #E2E8F0;
    padding: 15px;
    margin-bottom: 15px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
    border-left: 4px solid #CBD5E1;
    transition: transform 0.2s, box-shadow 0.2s;
}

.kanban-card:hover {
    box-shadow: 0 4px 6px rgba(0,0,0,0.08);
    transform: translateY(-2px);
}

/* As barras laterais dos cartões recebem detalhes premium */
.card-aberto { border-left-color: #64748B; }
.card-emcurso { border-left-color: var(--accent-color); } /* O Dourado da marca para o que está em curso */
.card-concluido { border-left-color: #0F766E; }

.card-ref {
    color: var(--primary-color);
    font-size: 0.8rem;
    font-weight: 700;
    margin-bottom: 5px;
}

.card-title {
    color: #8b95a5;
    font-size: 0.95rem;
    font-weight: 600;
    margin-bottom: 8px;
    line-height: 1.3;
}

.card-meta {
    font-size: 0.75rem;
    color: #64748B;
    margin-bottom: 12px;
    line-height: 1.5;
}

.select-estado {
    width: 100%;
    padding: 6px 10px;
    font-size: 0.8rem;
    color: #475569;
    border: 1px solid #CBD5E1;
    border-radius: 4px;
    background-color: #F8FAFC;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.2s;
}

.select-estado:focus {
    outline: none;
    border-color: var(--primary-color);
    background-color: #FFFFFF;
}

/* Empilha em Mobile */
@media (max-width: 1024px) {
    .kanban-board {
        grid-template-columns: 1fr;
    }
    .kanban-column {
        min-height: auto;
        margin-bottom: 20px;
    }
}
/* ==========================================================
   SISTEMA DE TABS E LAYOUT FLEXBOX PARA DETALHE DE PARÓQUIA
   ================================================---------- */
html, body {
    height: 100%;
    margin: 0;
    background-color: #F1F5F9;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}
.wrapper-principal {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    margin-left: 270px;
}
.tabs-nav {
    display: flex;
    gap: 5px;
    border-bottom: 2px solid #E2E8F0;
    background: #FFFFFF;
    padding: 0 30px;
}
.tab-btn {
    background: transparent;
    border: none;
    padding: 14px 20px;
    font-size: 0.95rem;
    font-weight: 600;
    color: #64748B;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    border-bottom: 3px solid transparent;
    margin-bottom: -2px;
    transition: all 0.2s ease;
    text-decoration: none;
}
.tab-btn:hover {
    color: #0B1D3A;
}
.tab-btn.active {
    color: #0B1D3A;
    border-bottom-color: #D4AF37;
    background: rgba(212, 175, 55, 0.04);
}
.tab-pane {
    display: none;
}
.tab-pane.active {
    display: block;
}
@media (max-width: 768px) {
    .wrapper-principal, .tabs-nav { margin-left: 0 !important; }
}
