/* ============================================================
   PORTAL SINDICAL CGA — CSS Global
   Tema: Azul Corporativo
   ============================================================ */

:root {
    --primary:      #1e40af;
    --primary-dk:   #1e3a8a;
    --primary-lt:   #dbeafe;
    --primary-mid:  #3b82f6;
    --success:      #059669;
    --success-lt:   #d1fae5;
    --warning:      #d97706;
    --warning-lt:   #fef3c7;
    --danger:       #dc2626;
    --danger-lt:    #fee2e2;
    --info:         #0284c7;
    --info-lt:      #e0f2fe;
    --gray-50:      #f8fafc;
    --gray-100:     #f1f5f9;
    --gray-200:     #e2e8f0;
    --gray-300:     #cbd5e1;
    --gray-400:     #94a3b8;
    --gray-500:     #64748b;
    --gray-600:     #475569;
    --gray-700:     #334155;
    --gray-800:     #1e293b;
    --gray-900:     #0f172a;
    --navbar-h:     56px;
    --radius:       8px;
    --radius-lg:    12px;
    --shadow-sm:    0 1px 3px rgba(0,0,0,.08);
    --shadow:       0 2px 8px rgba(0,0,0,.1);
    --shadow-lg:    0 8px 24px rgba(0,0,0,.12);
    --text:         var(--gray-800);
    --text-muted:   var(--gray-500);
    --border:       var(--gray-200);
    --bg:           var(--gray-50);
    --card-bg:      #ffffff;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    font-size: 14px;
    line-height: 1.6;
    color: var(--text);
    background: var(--bg);
    padding-top: var(--navbar-h); /* compensa navbar fixed */
}
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; }

/* ── Navbar ── */
.navbar {
    position: fixed;          /* fixed ao invés de sticky */
    top: 0; left: 0; right: 0;
    z-index: 1000;
    height: var(--navbar-h);
    background: var(--primary-dk);
    color: #fff;
    display: flex;
    align-items: center;
    padding: 0 20px;
    box-shadow: var(--shadow);
    /* SEM overflow hidden — deixa dropdowns aparecerem */
}
.navbar-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 16px;
    font-weight: 700;
    color: #fff;
    text-decoration: none;
    white-space: nowrap;
    margin-right: 24px;
    flex-shrink: 0;
}
.navbar-brand:hover { text-decoration: none; color: #fff; }
.navbar-brand .icon { font-size: 22px; }

.navbar-nav {
    display: flex;
    align-items: center;
    gap: 2px;
    flex: 1;
    /* SEM overflow — deixa dropdowns aparecerem */
}

.nav-item { position: relative; }

.nav-link {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 6px 9px;
    color: rgba(255,255,255,.85);
    font-size: 12px;
    font-weight: 500;
    border-radius: 6px;
    white-space: nowrap;
    cursor: pointer;
    transition: background .15s, color .15s;
    border: none;
    background: none;
    font-family: inherit;
}
.nav-link:hover, .nav-link.active {
    background: rgba(255,255,255,.15);
    color: #fff;
    text-decoration: none;
}
.nav-link .chevron { font-size: 10px; opacity: .7; }

/* Dropdown — aparece ao hover no .nav-item */
.nav-dropdown {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    max-height: calc(100vh - 70px);
    overflow-y: auto;
    min-width: 210px;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: 0 8px 24px rgba(0,0,0,.15);
    z-index: 1001;
    display: none;
    padding: 4px 0;
}
.nav-item:hover .nav-dropdown { display: block; }

.nav-dropdown a {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 9px 16px;
    color: var(--text);
    font-size: 13px;
    transition: background .12s;
    white-space: nowrap;
}
.nav-dropdown a:hover {
    background: var(--primary-lt);
    color: var(--primary);
    text-decoration: none;
}
.nav-dropdown-divider {
    height: 1px;
    background: var(--border);
    margin: 4px 0;
}


.navbar-right {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-left: auto;
    flex-shrink: 0;
}
.navbar-user {
    display: flex;
    align-items: center;
    gap: 8px;
    color: rgba(255,255,255,.85);
    font-size: 13px;
}
.navbar-user strong { color: #fff; }
.navbar-user a {
    color: rgba(255,255,255,.7);
    font-size: 12px;
    padding: 4px 10px;
    border: 1px solid rgba(255,255,255,.3);
    border-radius: 4px;
    transition: all .15s;
}
.navbar-user a:hover {
    color: #fff;
    border-color: rgba(255,255,255,.6);
    text-decoration: none;
}
.badge-sind {
    background: rgba(255,255,255,.15);
    color: rgba(255,255,255,.9);
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 20px;
    white-space: nowrap;
}

/* ── Layout ── */
.main-content {
    padding: 24px 20px;
    max-width: 1400px;
    margin: 0 auto;
}

.page-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
    margin-bottom: 24px;
}
.page-title    { font-size: 20px; font-weight: 700; color: var(--gray-800); }
.page-subtitle { font-size: 13px; color: var(--text-muted); margin-top: 2px; }
.page-actions  { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

.breadcrumb {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: 16px;
}
.breadcrumb a { color: var(--primary); }
.breadcrumb-sep { color: var(--gray-300); }

/* ── Cards ── */
.card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    padding: 20px;
}
.card-sm { padding: 14px 16px; }
.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border);
    flex-wrap: wrap;
    gap: 8px;
}
.card-title { font-size: 15px; font-weight: 600; }

/* Stat cards */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}
.stat-card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 18px 20px;
    position: relative;
    overflow: hidden;
}
.stat-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 3px;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}
.stat-blue::before   { background: var(--primary); }
.stat-green::before  { background: var(--success); }
.stat-yellow::before { background: var(--warning); }
.stat-red::before    { background: var(--danger); }
.stat-gray::before   { background: var(--gray-400); }
.stat-label {
    font-size: 12px;
    color: var(--text-muted);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: .04em;
    margin-bottom: 8px;
}
.stat-value {
    font-size: 30px;
    font-weight: 800;
    line-height: 1;
    color: var(--gray-800);
}
.stat-sub { font-size: 11px; color: var(--text-muted); margin-top: 4px; }
.stat-blue .stat-value   { color: var(--primary); }
.stat-green .stat-value  { color: var(--success); }
.stat-yellow .stat-value { color: var(--warning); }
.stat-red .stat-value    { color: var(--danger); }

/* ── Botões ── */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border-radius: var(--radius);
    border: none;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: filter .15s, transform .1s;
    text-decoration: none;
    white-space: nowrap;
    font-family: inherit;
}
.btn:hover { filter: brightness(.92); transform: translateY(-1px); text-decoration: none; }
.btn:active { transform: translateY(0); }
.btn-primary  { background: var(--primary);  color: #fff; }
.btn-success  { background: var(--success);  color: #fff; }
.btn-danger   { background: var(--danger);   color: #fff; }
.btn-warning  { background: var(--warning);  color: #fff; }
.btn-info     { background: var(--info);     color: #fff; }
.btn-gray     { background: var(--gray-500); color: #fff; }
.btn-outline  { background: transparent; color: var(--primary); border: 1.5px solid var(--primary); }
.btn-outline:hover { background: var(--primary-lt); }
.btn-light    { background: var(--gray-100); color: var(--text); border: 1px solid var(--border); }
.btn-light:hover { background: var(--gray-200); }
.btn-sm       { padding: 5px 10px; font-size: 12px; border-radius: 6px; }
.btn-lg       { padding: 11px 22px; font-size: 15px; }
.btn-block    { width: 100%; justify-content: center; }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none; }

/* ── Formulários ── */
.form-group { margin-bottom: 16px; }
.form-row {
    display: grid;
    gap: 16px;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
}
.form-row-2 { grid-template-columns: 1fr 1fr; }
.form-row-3 { grid-template-columns: 1fr 1fr 1fr; }
.form-row-4 { grid-template-columns: 1fr 1fr 1fr 1fr; }
label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: var(--gray-600);
    margin-bottom: 5px;
    text-transform: uppercase;
    letter-spacing: .03em;
}
.form-control {
    width: 100%;
    padding: 9px 12px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius);
    font-size: 13px;
    color: var(--text);
    background: #fff;
    transition: border-color .2s, box-shadow .2s;
    outline: none;
    font-family: inherit;
}
.form-control:focus {
    border-color: var(--primary-mid);
    box-shadow: 0 0 0 3px rgba(59,130,246,.12);
}
.form-control.error    { border-color: var(--danger); }
.form-control:disabled { background: var(--gray-100); color: var(--text-muted); }
textarea.form-control  { resize: vertical; min-height: 80px; }
select.form-control    { cursor: pointer; }
.form-hint  { font-size: 11px; color: var(--text-muted); margin-top: 4px; }
.form-error { font-size: 11px; color: var(--danger);     margin-top: 4px; }
.required::after { content: ' *'; color: var(--danger); }

/* ── Tabelas ── */
.table-wrap {
    overflow-x: auto;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    background: var(--card-bg);
}
table { width: 100%; border-collapse: collapse; }
thead th {
    background: var(--gray-50);
    padding: 11px 14px;
    font-size: 11px;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: .05em;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}
tbody td {
    padding: 11px 14px;
    font-size: 13px;
    border-bottom: 1px solid var(--gray-100);
    vertical-align: middle;
}
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: var(--gray-50); }
.td-actions { white-space: nowrap; }
.td-muted   { color: var(--text-muted); }

/* ── Badges ── */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 11px;
    font-weight: 600;
    padding: 3px 9px;
    border-radius: 20px;
}
.badge-blue    { background: var(--primary-lt); color: var(--primary-dk); }
.badge-green   { background: var(--success-lt); color: #065f46; }
.badge-yellow  { background: var(--warning-lt); color: #78350f; }
.badge-red     { background: var(--danger-lt);  color: #7f1d1d; }
.badge-gray    { background: var(--gray-100);   color: var(--gray-600); }
.badge-active  { background: var(--success-lt); color: #065f46; }
.badge-inactive{ background: var(--gray-100);   color: var(--gray-500); }

/* ── Alertas ── */
.alert {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 12px 16px;
    border-radius: var(--radius);
    font-size: 13px;
    margin-bottom: 16px;
    border: 1px solid transparent;
}
.alert-success { background: var(--success-lt); color: #065f46; border-color: #a7f3d0; }
.alert-error   { background: var(--danger-lt);  color: #7f1d1d; border-color: #fca5a5; }
.alert-warning { background: var(--warning-lt); color: #78350f; border-color: #fcd34d; }
.alert-info    { background: var(--info-lt);    color: #075985; border-color: #7dd3fc; }

/* ── Modal ── */
.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(15,23,42,.5);
    z-index: 2000;
    align-items: center;
    justify-content: center;
    padding: 20px;
}
.modal-overlay.open { display: flex; }
.modal-box {
    background: #fff;
    border-radius: var(--radius-lg);
    padding: 24px;
    width: 100%;
    max-width: 520px;
    box-shadow: var(--shadow-lg);
    position: relative;
    max-height: 90vh;
    overflow-y: auto;
}
.modal-box.modal-lg { max-width: 760px; }
.modal-title {
    font-size: 16px;
    font-weight: 700;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border);
}
.modal-close {
    position: absolute;
    top: 16px; right: 16px;
    background: none;
    border: none;
    font-size: 18px;
    cursor: pointer;
    color: var(--text-muted);
    line-height: 1;
    padding: 4px;
}
.modal-close:hover { color: var(--text); }
.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid var(--border);
}

/* ── Filtros ── */
.filter-bar {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 14px 16px;
    margin-bottom: 20px;
}
.filter-bar form {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    align-items: flex-end;
}
.filter-bar .form-group { margin-bottom: 0; flex: 1; min-width: 140px; }

/* ── Paginação ── */
.pagination {
    display: flex;
    gap: 4px;
    align-items: center;
    justify-content: center;
    margin-top: 20px;
}
.page-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 32px;
    height: 32px;
    padding: 0 8px;
    border-radius: 6px;
    border: 1px solid var(--border);
    background: #fff;
    font-size: 13px;
    color: var(--text);
    cursor: pointer;
    transition: all .15s;
    text-decoration: none;
}
.page-btn:hover  { background: var(--primary-lt); border-color: var(--primary-mid); color: var(--primary); text-decoration: none; }
.page-btn.active { background: var(--primary); border-color: var(--primary); color: #fff; }

/* ── Login ── */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--primary-dk) 0%, #1d4ed8 50%, #2563eb 100%);
    padding: 20px;
    padding-top: 0; /* login não tem navbar */
}
.login-card {
    background: #fff;
    border-radius: var(--radius-lg);
    padding: 40px 36px;
    width: 100%;
    max-width: 420px;
    box-shadow: var(--shadow-lg);
}
.login-logo { text-align: center; margin-bottom: 32px; }
.login-logo .logo-icon { font-size: 48px; display: block; margin-bottom: 12px; }
.login-logo h1 { font-size: 20px; font-weight: 700; color: var(--gray-800); }
.login-logo p  { font-size: 13px; color: var(--text-muted); margin-top: 4px; }

/* ── Tabs ── */
.tabs {
    display: flex;
    gap: 4px;
    border-bottom: 2px solid var(--border);
    margin-bottom: 20px;
    overflow-x: auto;
}
.tab {
    padding: 10px 18px;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-muted);
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    cursor: pointer;
    white-space: nowrap;
    text-decoration: none;
    transition: color .15s;
}
.tab:hover  { color: var(--primary); text-decoration: none; }
.tab.active { color: var(--primary); border-bottom-color: var(--primary); }

/* ── Info grid ── */
.info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px;
}
.info-item label {
    font-size: 11px;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    display: block;
    margin-bottom: 3px;
}
.info-item span { font-size: 14px; color: var(--text); }

/* ── Utilitários ── */
.d-flex          { display: flex; }
.d-grid          { display: grid; }
.align-center    { align-items: center; }
.justify-between { justify-content: space-between; }
.justify-end     { justify-content: flex-end; }
.flex-wrap       { flex-wrap: wrap; }
.gap-1  { gap: 4px; }
.gap-2  { gap: 8px; }
.gap-3  { gap: 16px; }
.gap-4  { gap: 24px; }
.mt-1   { margin-top: 4px; }
.mt-2   { margin-top: 8px; }
.mt-3   { margin-top: 16px; }
.mt-4   { margin-top: 24px; }
.mb-2   { margin-bottom: 8px; }
.mb-3   { margin-bottom: 16px; }
.mb-4   { margin-bottom: 24px; }
.text-center { text-align: center; }
.text-right  { text-align: right; }
.text-muted  { color: var(--text-muted); }
.text-sm     { font-size: 12px; }
.text-xs     { font-size: 11px; }
.fw-bold     { font-weight: 700; }
.fw-600      { font-weight: 600; }
.w-100       { width: 100%; }
.hidden      { display: none !important; }
.divider     { height: 1px; background: var(--border); margin: 16px 0; }

/* ── Spinner ── */
.spinner {
    display: inline-block;
    width: 18px; height: 18px;
    border: 2px solid rgba(255,255,255,.4);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Hambúrguer — oculto no desktop ── */
.navbar-toggle {
    display: none;
    background: none;
    border: none;
    color: rgba(255,255,255,.9);
    font-size: 22px;
    cursor: pointer;
    padding: 4px 10px;
    margin-left: 8px;
    line-height: 1;
    border-radius: 4px;
    flex-shrink: 0;
    transition: background .15s;
}
.navbar-toggle:hover { background: rgba(255,255,255,.15); }

/* ── Responsivo tablet (769px – 1100px) ── */
@media (max-width: 1100px) {
    .navbar-toggle { display: flex; align-items: center; }
    .navbar-nav {
        display: none;
        position: fixed;
        top: var(--navbar-h);
        left: 0; right: 0;
        background: var(--primary-dk);
        flex-direction: column;
        align-items: stretch;
        z-index: 9998;
        max-height: calc(100vh - var(--navbar-h));
        overflow-y: auto;
        padding: 4px 0 16px;
        box-shadow: 0 6px 20px rgba(0,0,0,.35);
    }
    .navbar-nav.mobile-open { display: flex; }
    .nav-item { width: 100%; border-bottom: 1px solid rgba(255,255,255,.07); }
    .nav-link {
        width: 100%;
        padding: 11px 20px;
        border-radius: 0;
        font-size: 14px;
        justify-content: space-between;
    }
    /* Dropdowns — inline (não movem para o body no mobile) */
    .nav-dropdown {
        position: static !important;
        top: auto !important; left: auto !important;
        display: none;
        background: rgba(0,0,0,.22) !important;
        border: none !important;
        border-radius: 0 !important;
        box-shadow: none !important;
        padding: 4px 0 !important;
        min-width: unset !important;
        width: 100% !important;
    }
    .nav-dropdown.mobile-open { display: block !important; }
    .nav-dropdown a {
        padding-left: 36px !important;
        font-size: 13px;
        color: rgba(255,255,255,.8) !important;
        border-bottom: 1px solid rgba(255,255,255,.04);
    }
    .nav-dropdown a:hover { background: rgba(255,255,255,.08) !important; color: #fff !important; }
    .nav-dropdown-divider { background: rgba(255,255,255,.1) !important; }
    /* Badge e usuário ficam visíveis mas compactos */
    .badge-sind { display: none; }
}

/* ── Responsivo mobile (≤ 768px) ── */
@media (max-width: 768px) {
    body { padding-top: var(--navbar-h); }
    .main-content { padding: 16px 12px; }
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
    .form-row-3, .form-row-4 { grid-template-columns: 1fr; }
    .form-row-2 { grid-template-columns: 1fr; }
    .page-header { flex-direction: column; }
    .login-card { padding: 28px 20px; }
    table { font-size: 12px; }
    thead th, tbody td { padding: 8px 10px; }
    .navbar-user span { display: none; }
}



/* Iframe/conteúdo principal deve ficar abaixo do menu */
iframe,
.main-frame,
iframe[name],
iframe[id] {
    position: relative;
    z-index: 1;
}

/* Se existir algum container envolvendo o iframe */
.main-content,
.page-content,
.content-wrapper {
    position: relative;
    z-index: 1;
}