/* ── Variáveis ────────────────────────────────────────────────────────── */
:root {
    --gm-primary: #1a1a2e;
    --gm-secondary: #16213e;
    --gm-accent: #c9a84c;
    --gm-accent-light: #e8c97a;
    --gm-sidebar-width: 260px;
    --gm-header-height: 64px;
    --gm-text-light: #f8f9fa;
    --gm-border: rgba(201, 168, 76, 0.2);
    --gm-card-shadow: 0 2px 12px rgba(0,0,0,0.08);
}

/* ── Reset e Base ─────────────────────────────────────────────────────── */
* { box-sizing: border-box; }

body {
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    background-color: #f5f6fa;
    color: #2d3748;
}

/* ── Layout Principal ─────────────────────────────────────────────────── */
.gm-layout {
    display: flex;
    min-height: 100vh;
}

/* ── Sidebar ──────────────────────────────────────────────────────────── */
.gm-sidebar {
    width: var(--gm-sidebar-width);
    background: linear-gradient(180deg, var(--gm-primary) 0%, var(--gm-secondary) 100%);
    color: var(--gm-text-light);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    z-index: 1000;
    transition: transform 0.3s ease;
    overflow-y: auto;
}

.gm-sidebar-brand {
    padding: 1.5rem 1.25rem;
    border-bottom: 1px solid var(--gm-border);
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.gm-sidebar-brand .brand-icon {
    position: relative;
    width: 52px;
    height: 52px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.gm-sidebar-brand .brand-icon::before {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: 50%;
    background: radial-gradient(circle at 35% 30%, #f4dd96 0%, var(--gm-accent-light) 35%, var(--gm-accent) 100%);
    border: 1px solid rgba(255, 233, 169, 0.95);
    box-shadow:
        0 0 0 4px rgba(201, 168, 76, 0.16),
        0 8px 18px rgba(0, 0, 0, 0.18);
}

.gm-sidebar-brand .brand-icon img {
    position: relative;
    z-index: 1;
    width: 46px;
    height: 46px;
    object-fit: contain;
    display: block;
}

.gm-sidebar-brand .brand-text {
    line-height: 1.2;
}

.gm-sidebar-brand .brand-title {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--gm-accent);
}

.gm-sidebar-brand .brand-subtitle {
    font-size: 0.7rem;
    opacity: 0.7;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 170px;
}

.gm-sidebar-brand .brand-version {
    display: inline-block;
    margin-top: 0.18rem;
    font-size: 0.64rem;
    line-height: 1;
    font-weight: 600;
    letter-spacing: 0.04em;
    color: rgba(255, 255, 255, 0.58);
}

/* Navegação */
.gm-nav { padding: 0.75rem 0; flex: 1; }

.gm-nav-section {
    padding: 0.5rem 1rem 0.25rem;
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    opacity: 0.5;
    font-weight: 600;
    margin-top: 0.5rem;
}

.gm-nav-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.6rem 1.25rem;
    color: rgba(255,255,255,0.75);
    text-decoration: none;
    font-size: 0.875rem;
    transition: all 0.15s;
    border-left: 3px solid transparent;
    cursor: pointer;
}

.gm-nav-item:hover {
    color: var(--gm-text-light);
    background: rgba(255,255,255,0.06);
}

.gm-nav-item.active {
    color: var(--gm-accent);
    background: rgba(201, 168, 76, 0.1);
    border-left-color: var(--gm-accent);
}

.gm-nav-item i { font-size: 1rem; width: 20px; text-align: center; }

/* Sidebar footer */
.gm-sidebar-footer {
    padding: 1rem 1.25rem;
    border-top: 1px solid var(--gm-border);
}

.gm-user-info {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.gm-avatar {
    width: 36px;
    height: 36px;
    background: var(--gm-accent);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--gm-primary);
    flex-shrink: 0;
}

.gm-user-name { font-size: 0.8rem; font-weight: 600; color: var(--gm-text-light); }
.gm-user-role { font-size: 0.7rem; opacity: 0.6; }

/* ── Main Content ─────────────────────────────────────────────────────── */
.gm-main {
    margin-left: var(--gm-sidebar-width);
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* ── Header ───────────────────────────────────────────────────────────── */
.gm-header {
    height: var(--gm-header-height);
    background: white;
    border-bottom: 1px solid #e2e8f0;
    display: flex;
    align-items: center;
    padding: 0 1.5rem;
    position: sticky;
    top: 0;
    z-index: 100;
    gap: 1rem;
}

.gm-header-title { font-size: 1.1rem; font-weight: 600; color: var(--gm-primary); flex: 1; }

.gm-toggle-btn {
    display: none;
    background: none;
    border: none;
    font-size: 1.25rem;
    color: var(--gm-primary);
    cursor: pointer;
    padding: 0.25rem;
}

/* ── Page Content ─────────────────────────────────────────────────────── */
.gm-content {
    padding: 1.5rem;
    flex: 1;
}

/* ── Cards ────────────────────────────────────────────────────────────── */
.gm-card {
    background: white;
    border-radius: 12px;
    box-shadow: var(--gm-card-shadow);
    border: 1px solid #e2e8f0;
    overflow: hidden;
}

.gm-card-header {
    padding: 1rem 1.25rem;
    border-bottom: 1px solid #e2e8f0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.gm-card-title { font-size: 0.95rem; font-weight: 600; color: var(--gm-primary); margin: 0; }
.gm-card-body { padding: 1.25rem; }

/* ── Stats Cards ──────────────────────────────────────────────────────── */
.gm-stat-card {
    background: white;
    border-radius: 12px;
    padding: 1.25rem;
    box-shadow: var(--gm-card-shadow);
    border: 1px solid #e2e8f0;
    display: flex;
    align-items: center;
    gap: 1rem;
}

.gm-stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    flex-shrink: 0;
}

.gm-stat-icon.primary   { background: rgba(26,26,46,0.08); color: var(--gm-primary); }
.gm-stat-icon.accent    { background: rgba(201,168,76,0.12); color: #b8941f; }
.gm-stat-icon.success   { background: rgba(34,197,94,0.1); color: #16a34a; }
.gm-stat-icon.danger    { background: rgba(239,68,68,0.1); color: #dc2626; }
.gm-stat-icon.warning   { background: rgba(245,158,11,0.1); color: #d97706; }
.gm-stat-icon.info      { background: rgba(59,130,246,0.1); color: #2563eb; }

.gm-stat-value { font-size: 1.75rem; font-weight: 700; color: var(--gm-primary); line-height: 1; }
.gm-stat-value-money { font-size: 1.45rem; line-height: 1.05; letter-spacing: -0.02em; }
.gm-stat-label { font-size: 0.8rem; color: #64748b; margin-top: 0.2rem; }

/* ── Badges de Status ─────────────────────────────────────────────────── */
.badge-grau-0 { background: #e2e8f0; color: #64748b; }
.badge-grau-1 { background: #dbeafe; color: #1d4ed8; }
.badge-grau-2 { background: #dcfce7; color: #15803d; }
.badge-grau-3 { background: #fef3c7; color: #92400e; }

.badge-situacao-ativo      { background: #dcfce7; color: #15803d; }
.badge-situacao-inativo    { background: #fee2e2; color: #dc2626; }
.badge-situacao-licenciado { background: #fef3c7; color: #92400e; }
.badge-situacao-transferido{ background: #e0e7ff; color: #3730a3; }

.badge-fin-adimplente  { background: #dcfce7; color: #15803d; }
.badge-fin-inadimplente{ background: #fee2e2; color: #dc2626; }
.badge-fin-atraso      { background: #fef3c7; color: #92400e; }
.badge-fin-isento      { background: #e0e7ff; color: #3730a3; }

.status-badge {
    font-size: 0.72rem;
    font-weight: 600;
    padding: 0.25rem 0.6rem;
    border-radius: 20px;
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
}

/* ── Tabela ───────────────────────────────────────────────────────────── */
.gm-table { width: 100%; border-collapse: collapse; }
.gm-table th {
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #64748b;
    font-weight: 600;
    padding: 0.75rem 1rem;
    background: #f8fafc;
    border-bottom: 1px solid #e2e8f0;
    white-space: nowrap;
}
.gm-table td {
    padding: 0.875rem 1rem;
    border-bottom: 1px solid #f1f5f9;
    font-size: 0.875rem;
    vertical-align: middle;
}
.gm-table tbody tr:hover { background: #f8fafc; }
.gm-table tbody tr:last-child td { border-bottom: none; }

/* ── Botões ───────────────────────────────────────────────────────────── */
.btn-gm-primary {
    background: var(--gm-primary);
    color: white;
    border: none;
    padding: 0.5rem 1.1rem;
    border-radius: 8px;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    transition: all 0.15s;
    text-decoration: none;
}
.btn-gm-primary:hover { background: #0f0f1e; color: white; }

.btn-gm-accent {
    background: var(--gm-accent);
    color: var(--gm-primary);
    border: none;
    padding: 0.5rem 1.1rem;
    border-radius: 8px;
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    transition: all 0.15s;
}
.btn-gm-accent:hover { background: var(--gm-accent-light); }

.btn-gm-outline {
    background: transparent;
    color: var(--gm-primary);
    border: 1px solid #d1d5db;
    padding: 0.5rem 1rem;
    border-radius: 8px;
    font-size: 0.875rem;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    transition: all 0.15s;
    text-decoration: none;
}
.btn-gm-outline:hover { border-color: var(--gm-primary); background: #f8fafc; }

.btn-icon {
    width: 32px; height: 32px;
    border-radius: 6px;
    border: 1px solid #e2e8f0;
    background: white;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.15s;
    color: #64748b;
    font-size: 0.9rem;
    text-decoration: none;
}
.btn-icon:hover { border-color: var(--gm-primary); color: var(--gm-primary); background: #f8fafc; }
.btn-icon.danger:hover { border-color: #dc2626; color: #dc2626; }

/* ── Formulários ──────────────────────────────────────────────────────── */
.gm-form-group { margin-bottom: 1rem; }
.gm-label { font-size: 0.8rem; font-weight: 600; color: #374151; margin-bottom: 0.35rem; display: block; }
.gm-label.required::after { content: " *"; color: #dc2626; }
.gm-input {
    width: 100%;
    padding: 0.55rem 0.85rem;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    font-size: 0.875rem;
    transition: all 0.15s;
    background: white;
    color: #1f2937;
}
.gm-input:focus { outline: none; border-color: var(--gm-accent); box-shadow: 0 0 0 3px rgba(201,168,76,0.15); }
.gm-input.invalid { border-color: #dc2626; }
.gm-input:disabled { background: #f9fafb; color: #9ca3af; }

.gm-select {
    width: 100%;
    padding: 0.55rem 2rem 0.55rem 0.85rem;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    font-size: 0.875rem;
    background: white url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%23343a40' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='m2 5 6 6 6-6'/%3e%3c/svg%3e") no-repeat right 0.75rem center/16px 12px;
    appearance: none;
    transition: all 0.15s;
}
.gm-select:focus { outline: none; border-color: var(--gm-accent); box-shadow: 0 0 0 3px rgba(201,168,76,0.15); }

/* ── Search Bar ───────────────────────────────────────────────────────── */
.gm-search {
    position: relative;
    flex: 1;
    max-width: 320px;
}
.gm-search i {
    position: absolute;
    left: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    color: #9ca3af;
    font-size: 0.9rem;
}
.gm-search .gm-input { padding-left: 2.25rem; }

/* ── Paginação ────────────────────────────────────────────────────────── */
.gm-pagination { display: flex; align-items: center; gap: 0.25rem; }
.gm-page-btn {
    width: 32px; height: 32px;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    background: white;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 0.8rem;
    color: #374151;
    transition: all 0.15s;
}
.gm-page-btn:hover, .gm-page-btn.active {
    background: var(--gm-primary);
    border-color: var(--gm-primary);
    color: white;
}
.gm-page-btn:disabled { opacity: 0.4; cursor: default; }

/* ── Modal ────────────────────────────────────────────────────────────── */
.gm-modal-backdrop {
    position: fixed; inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 1050;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    animation: fadeIn 0.15s ease;
}
.gm-modal {
    background: white;
    border-radius: 14px;
    width: 100%;
    max-width: 580px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
    animation: slideUp 0.2s ease;
}
.gm-modal.modal-lg { max-width: 800px; }
.gm-modal-header {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid #e2e8f0;
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.gm-modal-title { font-size: 1rem; font-weight: 600; color: var(--gm-primary); margin: 0; }
.gm-modal-body { padding: 1.5rem; }
.gm-modal-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid #e2e8f0;
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
}
.btn-close-gm {
    background: none; border: none; font-size: 1.25rem;
    color: #9ca3af; cursor: pointer; padding: 0.25rem;
    line-height: 1; transition: color 0.15s;
}
.btn-close-gm:hover { color: #374151; }

/* ── Alerts ───────────────────────────────────────────────────────────── */
.gm-alert { padding: 0.875rem 1rem; border-radius: 8px; font-size: 0.875rem; display: flex; align-items: flex-start; gap: 0.5rem; }
.gm-alert-danger { background: #fef2f2; color: #991b1b; border: 1px solid #fecaca; }
.gm-alert-success { background: #f0fdf4; color: #166534; border: 1px solid #bbf7d0; }
.gm-alert-warning { background: #fffbeb; color: #92400e; border: 1px solid #fde68a; }
.gm-alert-info { background: #eff6ff; color: #1e40af; border: 1px solid #bfdbfe; }

/* ── Empty State ──────────────────────────────────────────────────────── */
.gm-empty {
    text-align: center;
    padding: 3rem 1rem;
    color: #9ca3af;
}
.gm-empty i { font-size: 2.5rem; margin-bottom: 0.75rem; display: block; opacity: 0.5; }
.gm-empty p { font-size: 0.9rem; margin: 0; }

/* ── Loading ──────────────────────────────────────────────────────────── */
.gm-loading { display: flex; justify-content: center; padding: 2rem; }
.gm-spinner {
    width: 28px; height: 28px;
    border: 3px solid #e2e8f0;
    border-top-color: var(--gm-accent);
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

/* ── Página de login ──────────────────────────────────────────────────── */
.gm-login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--gm-primary) 0%, #0f3460 100%);
    padding: 1rem;
}
.gm-login-card {
    background: white;
    border-radius: 16px;
    padding: 2.5rem;
    width: 100%;
    max-width: 400px;
    box-shadow: 0 25px 60px rgba(0,0,0,0.4);
}
.gm-login-logo {
    text-align: center;
    margin-bottom: 2rem;
}
.gm-login-symbol {
    font-size: 3rem;
    display: block;
    margin-bottom: 0.5rem;
}
.gm-login-symbol img {
    width: 88px;
    height: 88px;
    object-fit: contain;
}
.gm-login-title { font-size: 1.3rem; font-weight: 700; color: var(--gm-primary); margin: 0; }
.gm-login-sub { font-size: 0.8rem; color: #9ca3af; margin-top: 0.25rem; }

.gm-login-loading-panel,
.gm-login-error-panel {
    text-align: center;
    padding: 0.5rem 0 0.25rem;
    animation: fadeIn 0.25s ease-in-out;
}
.gm-login-loading-panel h2,
.gm-login-error-panel h2 {
    color: var(--gm-primary);
    font-size: 1.05rem;
    font-weight: 700;
    margin: 0.85rem 0 0.35rem;
}
.gm-login-loading-panel p,
.gm-login-error-panel p {
    color: #6b7280;
    font-size: 0.88rem;
    line-height: 1.45;
    margin: 0;
}
.gm-login-spinner {
    width: 42px;
    height: 42px;
    border-width: 4px;
    display: inline-block;
}
.gm-login-error-icon {
    width: 52px;
    height: 52px;
    margin: 0 auto;
    border-radius: 999px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #fef2f2;
    color: #dc2626;
    font-size: 1.45rem;
}
.gm-login-error-help {
    margin-top: 0.85rem !important;
    font-size: 0.75rem !important;
    color: #9ca3af !important;
}

/* ── Animações ────────────────────────────────────────────────────────── */
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideUp { from { transform: translateY(20px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Responsivo ───────────────────────────────────────────────────────── */
@media (max-width: 768px) {
    .gm-sidebar {
        transform: translateX(-100%);
    }
    .gm-sidebar.open {
        transform: translateX(0);
    }
    .gm-main {
        margin-left: 0;
    }
    .gm-toggle-btn {
        display: flex;
    }
    .gm-content {
        padding: 1rem;
    }
    .gm-stat-card {
        padding: 1rem;
    }
    .gm-table { font-size: 0.8rem; }
    .gm-table th, .gm-table td { padding: 0.6rem 0.75rem; }
}

@media (max-width: 576px) {
    .gm-modal { margin: 0.5rem; }
    .gm-login-card { padding: 1.75rem; }
}

/* ── Configurações ─────────────────────────────────────────────────────── */
.gm-config-card {
    display: block;
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 14px;
    padding: 1.1rem;
    min-height: 178px;
    box-shadow: var(--gm-card-shadow);
    color: inherit;
    text-decoration: none;
    transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}

.gm-config-card-link:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 22px rgba(15, 23, 42, 0.12);
    border-color: rgba(201, 168, 76, 0.55);
    color: inherit;
    text-decoration: none;
}

.gm-config-card-locked { opacity: 0.88; }

.gm-config-icon {
    width: 46px;
    height: 46px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    flex-shrink: 0;
}

.gm-config-icon.primary { background: rgba(26,26,46,0.08); color: var(--gm-primary); }
.gm-config-icon.success { background: rgba(34,197,94,0.1); color: #16a34a; }
.gm-config-icon.warning { background: rgba(245,158,11,0.1); color: #d97706; }
.gm-config-icon.danger  { background: rgba(239,68,68,0.1); color: #dc2626; }
.gm-config-icon.info    { background: rgba(59,130,246,0.1); color: #2563eb; }

.gm-config-title {
    font-size: 0.98rem;
    font-weight: 700;
    color: var(--gm-primary);
    margin: 0;
}

.gm-config-desc {
    font-size: 0.8rem;
    color: #64748b;
    margin: 0.5rem 0 0;
    line-height: 1.45;
}

.gm-config-footer {
    border-top: 1px solid #f1f5f9;
    margin-top: 1rem;
    padding-top: 0.75rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 0.75rem;
    color: #64748b;
}

/* Sprint 2.3 - Modal administrativo reutilizável */
.modal-backdrop-gm {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.55);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1050;
    padding: 1rem;
}

.modal-gm {
    width: min(620px, 100%);
    background: #fff;
    border-radius: 1rem;
    box-shadow: 0 24px 80px rgba(15, 23, 42, 0.25);
    overflow: hidden;
}

.modal-gm-header,
.modal-gm-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid #e2e8f0;
}

.modal-gm-footer {
    border-bottom: 0;
    border-top: 1px solid #e2e8f0;
    justify-content: flex-end;
}

.modal-gm-header h3 {
    margin: 0;
    font-size: 1.05rem;
    font-weight: 700;
    color: #1a1a2e;
}

.modal-gm-body {
    padding: 1.25rem;
}

.btn-icon {
    border: 0;
    background: transparent;
    color: #64748b;
    width: 36px;
    height: 36px;
    border-radius: 999px;
}

.btn-icon:hover {
    background: #f1f5f9;
    color: #1a1a2e;
}

/* ═══════════════════════════════════════════════════════════════════
   RELATÓRIOS PARA IMPRESSÃO (abordagem HTML + window.print)
   ═══════════════════════════════════════════════════════════════════ */
.rel-container {
    max-width: 900px;
    margin: 0 auto;
    padding: 24px;
    background: #fff;
    color: #1a1a2e;
    font-size: 13px;
}
.rel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 2px solid #1a1a2e;
    padding-bottom: 12px;
    margin-bottom: 4px;
}
.rel-header-left { display: flex; align-items: center; gap: 12px; }
.rel-simbolo { font-size: 1.8rem; color: #b8860b; font-weight: bold; }
.rel-titulo { font-size: 1.15rem; font-weight: 700; margin: 0; }
.rel-loja { font-size: 0.8rem; color: #64748b; margin: 0; }
.rel-meta { font-size: 0.72rem; color: #64748b; margin: 2px 0 16px; }
.rel-tabela { width: 100%; border-collapse: collapse; font-size: 12px; }
.rel-tabela th {
    background: #1a1a2e; color: #fff; text-align: left;
    padding: 6px 8px; font-weight: 600; font-size: 11px;
    text-transform: uppercase; letter-spacing: 0.3px;
}
.rel-tabela td { padding: 5px 8px; border-bottom: 1px solid #e2e8f0; }
.rel-tabela tr:nth-child(even) td { background: #f8fafc; }
.rel-tabela tfoot td {
    background: #f1f5f9; font-weight: 700; border-top: 2px solid #1a1a2e;
}
.rel-badge {
    display: inline-block; padding: 1px 7px; border-radius: 10px;
    font-size: 10px; font-weight: 600;
}
.rel-toolbar {
    max-width: 900px; margin: 0 auto 16px; display: flex; gap: 8px;
    justify-content: flex-end;
}
.rel-vazio { text-align: center; padding: 40px; color: #94a3b8; }

/* Na impressão: esconde tudo que não é o relatório */
@media print {
    .gm-sidebar, .gm-topbar, .gm-header, .rel-toolbar,
    .gm-nav, nav, .no-print { display: none !important; }
    body, .gm-main, .gm-content, main { margin: 0 !important; padding: 0 !important; background: #fff !important; }
    .rel-container { max-width: 100%; padding: 0; box-shadow: none; }
    .rel-tabela th { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
    .rel-tabela tr { page-break-inside: avoid; }
    @page { margin: 1.5cm; }
}

.gm-readonly-box {
    width: 100%;
    border: 1px solid #e2e8f0;
    border-radius: 0.65rem;
    background: #f8fafc;
    padding: 0.65rem 0.85rem;
    min-height: 42px;
    display: flex;
    align-items: center;
    gap: 0.25rem;
    color: #475569;
}

/* Chancelaria - card de anexo vinculado */
.gm-anexo-card {
    border: 1px solid #dbe3ef;
    border-radius: 0.65rem;
    padding: 0.65rem 0.75rem;
    background: #f8fafc;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    min-height: 42px;
}

.gm-anexo-card strong {
    color: #334155;
    font-size: 0.84rem;
    word-break: break-word;
}

/* Chancelaria - seletor rápido de período */
.gm-period-selector {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    min-height: 40px;
    padding: 0.35rem 0.45rem;
    border: 1px solid #d8dee9;
    border-radius: 0.75rem;
    background: #ffffff;
    box-shadow: 0 8px 18px rgba(15, 23, 42, 0.05);
}

.gm-period-selector i {
    color: #64748b;
    margin-left: 0.25rem;
}

.gm-period-month,
.gm-period-year {
    border: 0;
    outline: none;
    background: transparent;
    color: #1e293b;
    font-weight: 600;
}

.gm-period-month {
    min-width: 112px;
    text-transform: capitalize;
}

.gm-period-year {
    width: 76px;
}

.gm-period-separator {
    color: #94a3b8;
    font-weight: 700;
}

.gm-period-go {
    border: 0;
    border-radius: 0.55rem;
    padding: 0.35rem 0.65rem;
    background: #f1f5f9;
    color: #1e293b;
    font-weight: 700;
}

.gm-period-go:hover:not(:disabled) {
    background: #e2e8f0;
}

.gm-period-go:disabled,
.gm-period-month:disabled,
.gm-period-year:disabled {
    opacity: 0.65;
}

/* Setup inicial */
.gm-setup-page {
    min-height: 100vh;
    background: linear-gradient(135deg, #0f172a 0%, #1e293b 55%, #334155 100%);
    padding: 2rem 1rem;
    display: flex;
    justify-content: center;
    align-items: flex-start;
}

.gm-setup-card {
    width: min(1100px, 100%);
    background: #ffffff;
    border-radius: 22px;
    box-shadow: 0 24px 80px rgba(0,0,0,.28);
    padding: 2rem;
}

.gm-setup-header {
    display: flex;
    gap: 1rem;
    align-items: center;
    border-bottom: 1px solid #e5e7eb;
    padding-bottom: 1.25rem;
    margin-bottom: 1.5rem;
}

.gm-setup-header img {
    width: 64px;
    height: 64px;
}

.gm-setup-header h1 {
    margin: 0;
    font-size: 1.75rem;
    color: #111827;
}

.gm-setup-header p {
    margin: .25rem 0 0;
    color: #6b7280;
}

.gm-setup-section {
    margin-top: 1.5rem;
    padding: 1.25rem;
    border: 1px solid #e5e7eb;
    border-radius: 16px;
    background: #f9fafb;
}

.gm-setup-section h2 {
    font-size: 1.05rem;
    margin: 0 0 1rem;
    color: #111827;
}

.gm-form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem;
}

.gm-form-grid .span-2 {
    grid-column: span 2;
}

.gm-setup-actions {
    display: flex;
    justify-content: flex-end;
    gap: .75rem;
    margin-top: 1.5rem;
}

@media (max-width: 760px) {
    .gm-setup-card { padding: 1.25rem; }
    .gm-setup-header { align-items: flex-start; }
    .gm-form-grid { grid-template-columns: 1fr; }
    .gm-form-grid .span-2 { grid-column: span 1; }
    .gm-setup-actions { flex-direction: column-reverse; }
    .gm-setup-actions button { width: 100%; justify-content: center; }
}


/* ── FIX v57-alpha2.1 UI Desktop/VPS ───────────────────────────────────
   O ambiente publicado pode falhar ao servir Bootstrap por cache/deploy
   parcial. Este bloco deixa a aplicação com grid desktop completo mesmo
   que o Bootstrap não seja carregado no primeiro acesso.
*/
.row {
    --bs-gutter-x: 1rem;
    --bs-gutter-y: 0;
    display: flex;
    flex-wrap: wrap;
    margin-top: calc(-1 * var(--bs-gutter-y));
    margin-right: calc(-0.5 * var(--bs-gutter-x));
    margin-left: calc(-0.5 * var(--bs-gutter-x));
}
.row > * {
    flex-shrink: 0;
    width: 100%;
    max-width: 100%;
    padding-right: calc(var(--bs-gutter-x) * 0.5);
    padding-left: calc(var(--bs-gutter-x) * 0.5);
    margin-top: var(--bs-gutter-y);
}
.g-3 { --bs-gutter-x: 1rem; --bs-gutter-y: 1rem; }
.g-4 { --bs-gutter-x: 1.5rem; --bs-gutter-y: 1.5rem; }

.col-12 { flex: 0 0 auto; width: 100%; }
.col-6 { flex: 0 0 auto; width: 50%; }

.d-flex { display: flex !important; }
.d-none { display: none !important; }
.align-items-center { align-items: center !important; }
.align-items-start { align-items: flex-start !important; }
.align-items-end { align-items: flex-end !important; }
.align-middle { vertical-align: middle !important; }
.justify-content-between { justify-content: space-between !important; }
.justify-content-end { justify-content: flex-end !important; }
.justify-content-center { justify-content: center !important; }
.flex-wrap { flex-wrap: wrap !important; }
.flex-1 { flex: 1 1 0%; }
.gap-1 { gap: .25rem !important; }
.gap-2 { gap: .5rem !important; }
.gap-3 { gap: 1rem !important; }
.gap-4 { gap: 1.5rem !important; }
.w-100 { width: 100% !important; }
.h-100 { height: 100% !important; }
.ms-auto { margin-left: auto !important; }
.ms-1 { margin-left: .25rem !important; }
.ms-2 { margin-left: .5rem !important; }
.me-1 { margin-right: .25rem !important; }
.me-2 { margin-right: .5rem !important; }
.mt-1 { margin-top: .25rem !important; }
.mt-2 { margin-top: .5rem !important; }
.mt-3 { margin-top: 1rem !important; }
.mt-4 { margin-top: 1.5rem !important; }
.mb-0 { margin-bottom: 0 !important; }
.mb-1 { margin-bottom: .25rem !important; }
.mb-2 { margin-bottom: .5rem !important; }
.mb-3 { margin-bottom: 1rem !important; }
.mb-4 { margin-bottom: 1.5rem !important; }
.p-0 { padding: 0 !important; }
.p-3 { padding: 1rem !important; }
.pt-3 { padding-top: 1rem !important; }
.px-4 { padding-left: 1.5rem !important; padding-right: 1.5rem !important; }
.py-2 { padding-top: .5rem !important; padding-bottom: .5rem !important; }
.py-3 { padding-top: 1rem !important; padding-bottom: 1rem !important; }
.py-4 { padding-top: 1.5rem !important; padding-bottom: 1.5rem !important; }
.py-5 { padding-top: 3rem !important; padding-bottom: 3rem !important; }

.table-responsive { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.table { width: 100%; margin-bottom: 1rem; vertical-align: top; border-collapse: collapse; }
.text-primary { color: #0d6efd !important; }
.text-danger { color: #dc3545 !important; }
.text-warning { color: #b45309 !important; }
.text-success { color: #16a34a !important; }
.text-muted { color: #64748b !important; }
.text-center { text-align: center !important; }
.text-end { text-align: right !important; }
.fw-semibold { font-weight: 600 !important; }
.small { font-size: .875em !important; }

.form-check { display: block; min-height: 1.5rem; padding-left: 1.5em; margin-bottom: .125rem; }
.form-check-input { width: 1em; height: 1em; margin-top: .25em; margin-left: -1.5em; vertical-align: top; }
.form-check-label { cursor: pointer; }
.form-label { margin-bottom: .35rem; font-weight: 600; color: #374151; }
.form-control,
.form-select {
    display: block;
    width: 100%;
    padding: .55rem .85rem;
    font-size: .875rem;
    line-height: 1.5;
    color: #1f2937;
    background-color: #fff;
    border: 1px solid #d1d5db;
    border-radius: .5rem;
}

@media (min-width: 768px) {
    .col-md-2 { flex: 0 0 auto; width: 16.66666667%; }
    .col-md-3 { flex: 0 0 auto; width: 25%; }
    .col-md-4 { flex: 0 0 auto; width: 33.33333333%; }
    .col-md-5 { flex: 0 0 auto; width: 41.66666667%; }
    .col-md-6 { flex: 0 0 auto; width: 50%; }
    .col-md-8 { flex: 0 0 auto; width: 66.66666667%; }
    .d-md-table-cell { display: table-cell !important; }
}

@media (min-width: 992px) {
    .col-lg-3 { flex: 0 0 auto; width: 25%; }
    .col-lg-4 { flex: 0 0 auto; width: 33.33333333%; }
    .col-lg-6 { flex: 0 0 auto; width: 50%; }
    .col-lg-8 { flex: 0 0 auto; width: 66.66666667%; }
    .d-lg-table-cell { display: table-cell !important; }
}

@media (min-width: 1200px) {
    .col-xl-4 { flex: 0 0 auto; width: 33.33333333%; }
    .col-xl-8 { flex: 0 0 auto; width: 66.66666667%; }
    .gm-content { padding: 1.75rem 2rem; }
}

/* Mantém o rodapé da sidebar legível no tema escuro e recupera o botão sair. */
.gm-sidebar-footer .btn-icon,
.gm-sidebar-logout {
    color: rgba(255,255,255,0.78) !important;
    background: rgba(255,255,255,0.06) !important;
    border: 1px solid rgba(255,255,255,0.10) !important;
    flex-shrink: 0;
}
.gm-sidebar-footer .btn-icon:hover,
.gm-sidebar-logout:hover {
    color: #fff !important;
    background: rgba(255,255,255,0.14) !important;
    border-color: rgba(201,168,76,0.45) !important;
}

/* v58-alpha2 — Configurações > Usuários */
.modal-gm-lg {
    width: min(920px, calc(100vw - 2rem));
}

.gm-permission-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 0.75rem;
}

.gm-permission-item {
    display: flex;
    gap: 0.75rem;
    align-items: flex-start;
    padding: 0.85rem;
    border: 1px solid #e2e8f0;
    border-radius: 0.75rem;
    background: #f8fafc;
    cursor: pointer;
}

.gm-permission-item:hover {
    background: #f1f5f9;
    border-color: #cbd5e1;
}

.gm-permission-item input {
    margin-top: 0.2rem;
}

.gm-permission-item strong {
    display: block;
    color: #1a1a2e;
    font-size: 0.9rem;
}

.gm-permission-item small {
    display: block;
    color: #64748b;
    font-size: 0.75rem;
    line-height: 1.25;
    margin-top: 0.2rem;
}

/* Auditoria */
.gm-audit-json {
    min-height: 150px;
    max-height: 360px;
    overflow: auto;
    background: #0f172a;
    color: #e2e8f0;
    border-radius: 0.75rem;
    padding: 1rem;
    font-size: 0.78rem;
    white-space: pre-wrap;
    word-break: break-word;
}

/* v59-alpha2 — Frequência centralizada */
.gm-rank-number {
    width: 30px;
    height: 30px;
    border-radius: 999px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    color: #475569;
    font-weight: 800;
    font-size: .8rem;
    flex: 0 0 auto;
}

/* v60-alpha3 · Imagens institucionais da Loja */
.gm-image-card {
    border: 1px solid #e2e8f0;
    border-radius: 16px;
    overflow: hidden;
    background: #fff;
    height: 100%;
    display: flex;
    flex-direction: column;
}

.gm-image-preview {
    height: 180px;
    background: linear-gradient(135deg, #f8fafc 0%, #eef2ff 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    border-bottom: 1px solid #e2e8f0;
}

.gm-image-preview img {
    max-width: 100%;
    max-height: 180px;
    object-fit: contain;
    display: block;
}

.gm-image-empty {
    color: #94a3b8;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.45rem;
    font-size: 0.85rem;
}

.gm-image-empty i {
    font-size: 2.4rem;
}

.gm-image-actions {
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.9rem;
    flex: 1;
}

/* ── v66-alpha3: restauração de sessão persistente ───────────────────── */
.gm-session-loading-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
    background: linear-gradient(135deg, var(--gm-primary) 0%, var(--gm-secondary) 100%);
}

.gm-session-loading-card {
    width: min(360px, 100%);
    background: rgba(255, 255, 255, 0.96);
    border-radius: 18px;
    padding: 2rem;
    text-align: center;
    box-shadow: 0 22px 60px rgba(0, 0, 0, 0.28);
    border: 1px solid rgba(201, 168, 76, 0.22);
}

.gm-session-loading-card h2 {
    margin: 1rem 0 0.35rem;
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--gm-primary);
}

.gm-session-loading-card p {
    margin: 0;
    font-size: 0.82rem;
    color: #6b7280;
}
