* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Arial, sans-serif;
}

body {
    background: #f3f4f6;
    color: #111827;
}

.topbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 56px;
    background: #fff;
    border-bottom: 1px solid #e5e7eb;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    z-index: 200;
}

.topbar-left {
    display: flex;
    align-items: center;
    gap: 10px;
}

.logo-badge {
    width: 36px;
    height: 36px;
    border-radius: 9px;
    background: #166534;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 14px;
    letter-spacing: -0.5px;
}

.brand-name {
    font-weight: 700;
    font-size: 15px;
    color: #111827;
    line-height: 1.2;
}

.brand-sub {
    font-size: 11px;
    color: #6b7280;
}

.topbar-right {
    position: relative;
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    padding: 6px 10px;
    border-radius: 8px;
}

.topbar-right:hover {
    background: #f3f4f6;
}

.user-avatar,
.avatar {
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    color: #fff;
    flex-shrink: 0;
}

.user-avatar {
    width: 36px;
    height: 36px;
    font-size: 13px;
}

.user-name {
    font-size: 13px;
    font-weight: 600;
    color: #111827;
}

.user-siape,
.user-role {
    font-size: 11px;
    color: #6b7280;
}

.dropdown-arrow {
    font-size: 10px;
    color: #9ca3af;
    margin-top: 2px;
}

.dropdown-menu {
    display: none;
    position: absolute;
    top: calc(100% + 4px);
    right: 0;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.1);
    min-width: 160px;
    z-index: 300;
}

.dropdown-menu a {
    display: block;
    padding: 10px 16px;
    font-size: 13px;
    color: #374151;
    text-decoration: none;
    border-radius: 10px;
}

.dropdown-menu a:hover {
    background: #f3f4f6;
}

.topbar-right.open .dropdown-menu {
    display: block;
}

.layout,
.page-body {
    display: flex;
    min-height: 100vh;
    padding-top: 56px;
}

.sidebar {
    width: 210px;
    background: #fff;
    border-right: 1px solid #e5e7eb;
    padding: 16px 12px;
    position: fixed;
    top: 56px;
    left: 0;
    bottom: 0;
    overflow-y: auto;
}

.logo {
    display: none;
}

.menu,
.sidebar-menu {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 2px;
    margin: 0;
    padding: 0;
}

.menu li,
.sidebar-menu li {
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    color: #374151;
}

.menu li a,
.sidebar-menu li a,
.menu-group-toggle {
    background: transparent;
    border: 0;
    color: inherit;
    cursor: pointer;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    min-height: 38px;
    padding: 9px 12px;
    border-radius: 8px;
    font: inherit;
    text-align: left;
}

.menu > li:not(.menu-group):hover,
.submenu li:hover,
.sidebar-menu li a:hover,
.menu-group-toggle:hover {
    background: #f3f4f6;
}

.menu > li.active:not(.menu-group),
.sidebar-menu li a.active {
    background: #166534;
    color: #fff;
    font-weight: 600;
}

.sidebar-menu li a .icon,
.menu .icon {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

.menu-group {
    color: #374151;
}

.menu-group.active > .menu-group-toggle {
    color: #166534;
    font-weight: 700;
}

.submenu-arrow {
    color: #9ca3af;
    font-size: 11px;
    margin-left: auto;
    transition: transform 0.15s ease;
}

.menu-group.open .submenu-arrow {
    transform: rotate(180deg);
}

.submenu {
    display: none;
    list-style: none;
    margin: 2px 0 4px 0;
    padding: 0 0 0 18px;
}

.menu-group.open .submenu {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.submenu .submenu-item a {
    color: #374151;
    font-size: 13px;
    min-height: 34px;
    padding: 8px 10px;
}

.submenu .submenu-item:hover a {
    color: #111827;
}

.submenu .submenu-item.active a {
    background: #166534;
    color: #fff;
    font-weight: 600;
}

.submenu .submenu-item .notif-badge {
    background: #dc2626;
    color: #fff;
}

.submenu .submenu-item.active .notif-badge {
    background: rgba(255,255,255,0.28);
    color: #fff;
}

.notif-badge {
    margin-left: auto;
    background: #ef4444;
    color: #fff;
    border-radius: 9999px;
    font-size: 11px;
    padding: 1px 6px;
    font-weight: 600;
}

.menu li.active .notif-badge,
.sidebar-menu li a.active .notif-badge {
    background: rgba(255,255,255,0.3);
}

.menu .submenu .submenu-item:not(.active) .notif-badge {
    background: #dc2626;
    color: #fff;
}

.menu-group.active > .menu-group-toggle > .notif-badge {
    background: #dc2626;
    color: #fff;
}

.menu-toggle {
    display: none;
    position: fixed;
    top: 64px;
    left: 16px;
    z-index: 999;
    background: #166534;
    color: #fff;
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 8px;
    font-size: 20px;
    cursor: pointer;
}

.content,
.main {
    flex: 1;
    margin-left: 210px;
    padding: 32px;
}

.page-header {
    margin-bottom: 24px;
}

.page-title,
.page-header h1 {
    font-size: 24px;
    font-weight: 700;
    color: #111827;
    border-bottom: none;
    padding-bottom: 0;
    margin-bottom: 24px;
}

.page-header .page-title,
.page-header h1 {
    margin-bottom: 0;
}

.page-subtitle,
.page-header p {
    font-size: 14px;
    color: #6b7280;
    margin-top: 4px;
}

.card,
.section-card,
.stat-card {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
}

.card,
.section-card {
    padding: 20px 24px;
}

.card-header {
    background: transparent;
    border-bottom: 1px solid #f3f4f6;
    color: #111827;
    font-size: 15px;
    font-weight: 600;
    padding: 0 0 16px;
}

.card-body {
    padding: 20px 0 0;
}

.form-section {
    margin-bottom: 24px;
}

.form-section-title {
    font-weight: 600;
    font-size: 13px;
    margin-bottom: 12px;
    color: #111827;
}

.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 16px;
    margin-bottom: 16px;
}

.form-row.cols-4 {
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.form-group label,
label {
    font-size: 12px;
    font-weight: 600;
    color: #374151;
}

select,
input[type="text"],
input[type="email"],
input[type="date"],
input[type="time"],
input[type="password"] {
    min-height: 34px;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 6px 10px;
    font-size: 13px;
    color: #374151;
    background: #fff;
}

select:focus,
input[type="text"]:focus,
input[type="email"]:focus,
input[type="date"]:focus,
input[type="time"]:focus,
input[type="password"]:focus {
    outline: none;
    border-color: #166534;
}

.form-actions,
.actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.form-actions {
    margin-top: 24px;
    padding-top: 16px;
    border-top: 1px solid #f3f4f6;
}

.actions {
    margin-top: 16px;
    justify-content: flex-end;
}

button,
.btn-primary,
.btn-secondary,
.btn-success,
.btn-danger,
.btn-filter,
.btn-green,
.btn-outline {
    min-height: 32px;
    border-radius: 8px;
    padding: 7px 14px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.15s, border-color 0.15s;
}

.btn-primary,
.actions .btn-primary,
.form-actions .btn-primary,
.btn-outline {
    background: transparent;
    color: #166534;
    border: 1px solid #166534;
}

.btn-primary:hover,
.actions .btn-primary:hover,
.form-actions .btn-primary:hover,
.btn-outline:hover {
    background: #f0fdf4;
}

.btn-success,
.actions .btn-success,
.form-actions .btn-success,
.btn-green {
    background: #166534;
    color: #fff;
    border: 1px solid #166534;
}

.btn-success:hover,
.actions .btn-success:hover,
.form-actions .btn-success:hover,
.btn-green:hover {
    background: #14532d;
}

.actions .btn-filter,
.form-actions .btn-filter,
.btn-filter {
    background: #111827;
    color: #fff;
    border: 1px solid #111827;
}

.actions .btn-filter:hover,
.form-actions .btn-filter:hover,
.btn-filter:hover {
    background: #374151;
    border-color: #374151;
}

.actions .btn-secondary,
.form-actions .btn-secondary,
.btn-secondary {
    background: #fff;
    color: #374151;
    border: 1px solid #e5e7eb;
}

.actions .btn-secondary:hover,
.form-actions .btn-secondary:hover,
.btn-secondary:hover {
    background: #f3f4f6;
}

.actions .btn-danger,
.form-actions .btn-danger,
.btn-danger {
    background: #fee2e2;
    color: #b91c1c;
    border: 1px solid #fecaca;
}

.actions .btn-danger:hover,
.form-actions .btn-danger:hover,
.btn-danger:hover {
    background: #fecaca;
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
    background: #fff;
}

thead tr {
    border-bottom: 1px solid #e5e7eb;
}

th {
    padding: 10px 14px;
    text-align: left;
    font-size: 11px;
    font-weight: 600;
    color: #9ca3af;
    letter-spacing: 0.07em;
    text-transform: uppercase;
}

td {
    padding: 13px 14px;
    border-bottom: 1px solid #f3f4f6;
    color: #374151;
    vertical-align: middle;
}

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

.acoes {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.status-badge,
.badge-status {
    display: inline-flex;
    align-items: center;
    border-radius: 9999px;
    padding: 3px 12px;
    font-size: 12px;
    font-weight: 500;
    white-space: nowrap;
}

.status-active,
.badge-validado {
    background: #f0fdf4;
    color: #16a34a;
    border: 1px solid #bbf7d0;
}

.status-inactive,
.badge-semDados {
    background: #f9fafb;
    color: #6b7280;
    border: 1px solid #e5e7eb;
}

.status-pending {
    background: #fffbeb;
    color: #d97706;
    border: 1px solid #fde68a;
}

.badge-preenche {
    background: #fffbeb;
    color: #d97706;
    border: 1px solid #fde68a;
}

.badge-aguard {
    background: #eff6ff;
    color: #2563eb;
    border: 1px solid #bfdbfe;
}

.badge-processado {
    background: #faf5ff;
    color: #7c3aed;
    border: 1px solid #ddd6fe;
}

.empty-row,
.empty-state {
    color: #9ca3af;
    font-size: 13px;
    padding: 20px 14px;
    text-align: center;
}

@media (max-width: 768px) {
    .menu-toggle {
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .sidebar {
        display: block;
        left: -220px;
        z-index: 998;
        transition: left 0.3s ease;
    }

    .sidebar.open {
        left: 0;
    }

    .content,
    .main {
        margin-left: 0;
        padding: 64px 16px 20px;
    }

    .form-row,
    .form-row.cols-4 {
        grid-template-columns: 1fr;
    }

    table {
        display: block;
        overflow-x: auto;
    }
}

@media (max-width: 1100px) {
    .form-row.cols-4 {
        grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    }
}
