@import url('https://fonts.googleapis.com/css2?family=Archivo:wght@400;700&family=Zilla+Slab:ital,wght@1,400&family=Roboto+Mono&display=swap');

:root {
    --primary: #17181C;
    --accent: #B84A22;
    --bg: #E3E4E6;
    --dark: #242529;
    --text: #17181C;
    --white: #FFFFFF;
    --danger: #E53E3E;
    --success: #10B981;
}

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

body {
    font-family: 'Archivo', sans-serif;
    background-color: var(--bg);
    color: var(--text);
    height: 100vh;
    padding: 0;
    margin: 0;
    position: relative;
    overflow: hidden;
}

body::before {
    content: "";
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noiseFilter'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.65' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noiseFilter)'/%3E%3C/svg%3E");
    opacity: 0.05;
    pointer-events: none;
    z-index: 9999;
}

.container {
    max-width: 500px;
    margin: 0 auto;
    background: var(--white);
    padding: 2.5rem;
    border-radius: 2.5rem;
    box-shadow: 0 30px 60px rgba(0, 0, 0, 0.12);
}

header {
    margin-bottom: 2.5rem;
}

.header-top {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
}

h1 {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--primary);
    text-transform: uppercase;
    letter-spacing: -0.04em;
    line-height: 0.9;
}

.subtitle {
    font-family: 'Zilla Slab', serif;
    font-style: italic;
    color: var(--accent);
    font-size: 1.2rem;
    margin-top: 0.5rem;
}

form {
    display: flex;
    flex-direction: column;
    gap: 1.2rem;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

label {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--dark);
    opacity: 0.6;
}

input,
select {
    width: 100%;
    padding: 1rem 1.2rem;
    border: 2px solid #EEE;
    border-radius: 1.2rem;
    font-family: 'Roboto Mono', monospace;
    font-size: 0.9rem;
    color: var(--primary);
    background: #F9F9F9;
    transition: all 0.3s ease;
}

input:focus,
select:focus {
    outline: none;
    border-color: var(--accent);
    background: var(--white);
    box-shadow: 0 0 0 4px rgba(184, 74, 34, 0.1);
}

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

button {
    background-color: var(--primary);
    color: var(--white);
    padding: 1.3rem;
    border: none;
    border-radius: 3rem;
    font-family: 'Archivo', sans-serif;
    font-weight: 700;
    font-size: 1rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    cursor: pointer;
    transition: all 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    margin-top: 1rem;
    overflow: hidden;
    position: relative;
}

button:hover {
    transform: scale(1.03);
    background-color: var(--accent);
}

button:active {
    transform: scale(0.98);
}

button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.status-indicator {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 1rem 2rem;
    font-size: 0.7rem;
    font-weight: 700;
    color: var(--dark);
    opacity: 0.5;
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

.dot {
    width: 8px;
    height: 8px;
    background-color: var(--success);
    border-radius: 50%;
    position: relative;
}

.dot::after {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: inherit;
    border-radius: 50%;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% {
        transform: scale(1);
        opacity: 0.8;
    }

    100% {
        transform: scale(3);
        opacity: 0;
    }
}

/* LOGIN OVERLAY */
.login-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--bg);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10001;
    padding: 1rem;
    animation: fadeIn 0.4s ease;
}

.login-overlay.hidden {
    display: none;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.login-card {
    width: 100%;
    max-width: 420px;
    background: var(--white);
    border-radius: 2.5rem;
    padding: 3rem 2.5rem;
    box-shadow: 0 30px 60px rgba(0, 0, 0, 0.15);
    animation: slideUp 0.5s ease;
}

.login-header {
    margin-bottom: 2.5rem;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.login-logo {
    width: 80px;
    height: auto;
    margin-bottom: 1rem;
}

.login-header h1 {
    font-size: 3rem;
}

.login-header .subtitle {
    font-size: 1rem;
}

.login-erro {
    background: rgba(229, 62, 62, 0.08);
    border: 1.5px solid rgba(229, 62, 62, 0.25);
    color: var(--danger);
    padding: 0.8rem 1.2rem;
    border-radius: 1rem;
    font-size: 0.85rem;
    font-weight: 600;
    text-align: center;
    animation: shake 0.4s ease;
}

@keyframes shake {

    0%,
    100% {
        transform: translateX(0);
    }

    20%,
    60% {
        transform: translateX(-6px);
    }

    40%,
    80% {
        transform: translateX(6px);
    }
}

.login-hint {
    text-align: center;
    margin-top: 1.5rem;
    font-size: 0.72rem;
    color: var(--dark);
    opacity: 0.35;
    font-family: 'Roboto Mono', monospace;
}

/* USER INFO HEADER */
.user-info {
    display: flex;
    align-items: center;
    gap: 0.7rem;
    flex-shrink: 0;
}

.user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--accent);
    color: var(--white);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1rem;
    text-transform: uppercase;
    flex-shrink: 0;
}

.user-details {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.15rem;
}

.user-name {
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 120px;
}

.btn-logout {
    background: none !important;
    border: none;
    color: var(--accent);
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    cursor: pointer;
    padding: 0 !important;
    margin: 0 !important;
    transition: opacity 0.2s ease;
}

.btn-logout:hover {
    opacity: 0.7;
    transform: none;
    background: none !important;
}

/* ==========================================================================
   NOVO LAYOUT: DASHBOARD & SIDEBAR
   ========================================================================== */

.app-container {
    display: flex;
    height: 100vh;
    overflow: hidden;
    background-color: var(--bg);
}

/* SIDEBAR */
.sidebar {
    width: 280px;
    background-color: var(--primary);
    color: var(--white);
    display: flex;
    flex-direction: column;
    transition: all 0.3s ease;
    z-index: 1000;
    height: 100vh;
    overflow-y: auto;
}

.sidebar-header {
    padding: 1.5rem 2rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.sidebar-header h2 {
    font-size: 1.8rem;
    letter-spacing: -0.05em;
    color: var(--white);
}

.sidebar-subtitle {
    font-family: 'Zilla Slab', serif;
    font-style: italic;
    color: var(--bg);
    font-size: 0.9rem;
    opacity: 0.8;
}

.sidebar-nav {
    flex: 1;
    padding: 2rem 0;
}

.sidebar-nav ul {
    list-style: none;
}

.nav-link {
    display: block;
    padding: 1rem 2rem;
    color: rgba(255, 255, 255, 0.6);
    text-decoration: none;
    font-weight: 700;
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    transition: all 0.3s ease;
    border-left: 4px solid transparent;
}

.nav-link:hover,
.nav-link.active {
    color: var(--white);
    background: rgba(255, 255, 255, 0.05);
    border-left-color: var(--accent);
}

.sidebar-footer {
    padding: 2rem;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.btn-perfil-sidebar {
    width: 100%;
    background: rgba(255, 255, 255, 0.05);
    color: var(--white);
    border: 1px solid rgba(255, 255, 255, 0.1);
    padding: 0.6rem;
    border-radius: 0.8rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-bottom: 0.6rem;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.btn-perfil-sidebar:hover {
    background: var(--accent);
    border-color: var(--accent);
}

.btn-logout-sidebar {
    width: 100%;
    background: rgba(229, 62, 62, 0.1);
    color: #FF5C5C;
    border: 1px solid rgba(229, 62, 62, 0.2);
    padding: 0.8rem;
    border-radius: 0.8rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-logout-sidebar:hover {
    background: var(--danger);
    color: var(--white);
}

/* MAIN CONTENT */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    height: 100vh;
    overflow: hidden;
}

.top-bar {
    height: 70px;
    background: var(--white);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 2rem;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}

.top-bar-left {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.menu-toggle {
    display: none;
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--primary);
}

.top-bar h1 {
    font-size: 1.2rem;
    margin: 0;
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 1rem;
    position: relative;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 1rem;
    transition: background 0.2s ease;
}

.user-profile:hover {
    background: rgba(0, 0, 0, 0.03);
}

.avatar-container {
    position: relative;
    display: flex;
    align-items: center;
}

/* PROFILE DROPDOWN */
.profile-dropdown {
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    width: 220px;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 1.2rem;
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.12);
    padding: 0.8rem;
    display: none;
    flex-direction: column;
    z-index: 1001;
    transform-origin: top right;
    animation: dropdownShow 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.profile-dropdown.active {
    display: flex;
}

@keyframes dropdownShow {
    from {
        opacity: 0;
        transform: scale(0.9) translateY(-10px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.dropdown-header {
    padding: 0.5rem 0.8rem;
    margin-bottom: 0.5rem;
}

.dropdown-header #dropdownUserName {
    display: block;
    font-weight: 700;
    font-size: 0.9rem;
    color: var(--primary);
}

.dropdown-divider {
    height: 1px;
    background: rgba(0, 0, 0, 0.05);
    margin: 0.5rem 0;
}

.dropdown-item {
    background: none;
    border: none;
    padding: 0.8rem;
    text-align: left;
    width: 100%;
    margin-top: 0;
    border-radius: 0.8rem;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--dark);
    display: flex;
    align-items: center;
    gap: 0.8rem;
    transition: all 0.2s ease;
    cursor: pointer;
    text-transform: none;
    letter-spacing: normal;
}

.dropdown-item:hover {
    background: rgba(184, 74, 34, 0.08);
    color: var(--accent);
    transform: none;
}

.dropdown-item.logout {
    color: var(--danger);
}

.dropdown-item.logout:hover {
    background: rgba(229, 62, 62, 0.08);
    color: var(--danger);
}

.content-area {
    flex: 1;
    padding: 2rem;
    overflow-y: auto;
}

/* DASHBOARD CARDS */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.card-stat {
    background: var(--white);
    padding: 1.5rem;
    border-radius: 1.5rem;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.05);
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.card-stat .label {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--dark);
    opacity: 0.5;
}

.card-stat .value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary);
}

.card-stat .trend {
    font-size: 0.8rem;
    font-weight: 600;
}

.trend.up {
    color: var(--success);
}

.trend.down {
    color: var(--danger);
}

/* TABELAS E LISTAS */
.card-table {
    background: var(--white);
    padding: 1.5rem;
    border-radius: 1.5rem;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.05);
}

.card-table h3 {
    margin-bottom: 1.5rem;
    font-size: 1.1rem;
}

/* Tabela padrão (ex.: Relatórios) */
.table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.table thead {
    background: #F7F7F8;
}

.table th {
    padding: 1rem 1.2rem;
    text-align: left;
    font-size: 0.7rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--dark);
    opacity: 0.6;
    border-bottom: 2px solid #EEE;
    white-space: nowrap;
}

.table td {
    padding: 0.95rem 1.2rem;
    border-bottom: 1px solid #F0F0F0;
    color: var(--text);
    vertical-align: middle;
}

.table tbody tr:nth-child(even) {
    background: rgba(0, 0, 0, 0.035);
}

.table tbody tr {
    transition: background 0.2s ease;
}

.table tbody tr:hover {
    background: rgba(184, 74, 34, 0.08) !important;
}

/* Detalhes de Visualização */
.view-details-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
    margin-top: 1rem;
}

.view-group {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
}

.view-label {
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    opacity: 0.5;
    letter-spacing: 0.05em;
}

.view-value {
    font-size: 0.95rem;
    color: var(--primary);
    word-break: break-word;
}

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

.recent-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.recent-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 1rem;
    border-bottom: 1px solid #F0F0F0;
}

.recent-item:last-child {
    border-bottom: none;
}

.item-info h4 {
    font-size: 0.9rem;
    margin-bottom: 0.2rem;
}

.item-info p {
    font-size: 0.75rem;
    opacity: 0.6;
}

.item-amount {
    font-weight: 700;
    color: var(--accent);
}

/* LOADER */
.loader-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 200px;
}

.loader {
    width: 40px;
    height: 40px;
    border: 4px solid rgba(184, 74, 34, 0.1);
    border-top: 4px solid var(--accent);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 1rem;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

/* RESPONSIVO */
@media (max-width: 992px) {
    .sidebar {
        position: fixed;
        left: -280px;
        top: 0;
        bottom: 0;
    }

    .sidebar.active {
        left: 0;
    }

    .menu-toggle {
        display: block;
    }

    .content-area {
        padding: 1rem;
    }
}

@media (max-width: 480px) {
    .dashboard-grid {
        grid-template-columns: 1fr;
    }

    .top-bar {
        padding: 0 1rem;
    }
}

/* ==========================================================================
   FASE 7: CADASTROS DINÂMICOS
   ========================================================================== */

/* Grid de Cards de Cadastro */
.cadastros-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.cadastro-card {
    background: var(--white);
    padding: 2rem;
    border-radius: 1.5rem;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.05);
    cursor: pointer;
    transition: all 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    border: 2px solid transparent;
    position: relative;
    overflow: hidden;
}

.cadastro-card::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    background: var(--accent);
    transform: scaleY(0);
    transition: transform 0.3s ease;
    transform-origin: top;
}

.cadastro-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.1);
    border-color: rgba(184, 74, 34, 0.15);
}

.cadastro-card:hover::before {
    transform: scaleY(1);
}

.cadastro-card .card-icon {
    width: 48px;
    height: 48px;
    border-radius: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    margin-bottom: 1rem;
    background: rgba(184, 74, 34, 0.08);
}

.cadastro-card h3 {
    font-size: 1.1rem;
    margin-bottom: 0.4rem;
    color: var(--primary);
}

.cadastro-card p {
    font-size: 0.8rem;
    opacity: 0.55;
    line-height: 1.5;
}

.cadastro-card .card-count {
    display: inline-block;
    margin-top: 1rem;
    padding: 0.3rem 0.8rem;
    background: rgba(16, 185, 129, 0.08);
    color: var(--success);
    font-size: 0.72rem;
    font-weight: 700;
    border-radius: 2rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* Tabela CRUD */
.crud-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.crud-header h3 {
    font-size: 1.2rem;
    color: var(--primary);
}

.btn-novo {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background: var(--accent);
    color: var(--white);
    padding: 0.7rem 1.5rem;
    border-radius: 2rem;
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    cursor: pointer;
    transition: all 0.3s ease;
    border: none;
    margin-top: 0;
}

.btn-novo:hover {
    background: var(--primary);
    transform: scale(1.03);
}

.btn-voltar {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    background: none;
    color: var(--dark);
    padding: 0.5rem 1rem;
    border: 2px solid #EEE;
    border-radius: 2rem;
    font-size: 0.78rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-top: 0;
}

.btn-voltar:hover {
    border-color: var(--accent);
    color: var(--accent);
    background: none;
}

.crud-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.88rem;
}

.crud-table thead {
    background: #F7F7F8;
}

.crud-table th {
    padding: 1rem 1.2rem;
    text-align: left;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--dark);
    opacity: 0.5;
    border-bottom: 2px solid #EEE;
}

.crud-table td {
    padding: 1rem 1.2rem;
    border-bottom: 1px solid #F0F0F0;
    color: var(--text);
    vertical-align: middle;
}

.crud-table tbody tr {
    transition: background 0.2s ease;
}

.crud-table tbody tr:hover {
    background: rgba(184, 74, 34, 0.03);
}

.crud-table tbody tr:last-child td {
    border-bottom: none;
}

/* Botões de ação na tabela */
.action-btns {
    display: flex;
    gap: 0.5rem;
}

.btn-action {
    padding: 0.4rem 0.8rem;
    border-radius: 0.6rem;
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    cursor: pointer;
    transition: all 0.2s ease;
    border: none;
    margin-top: 0;
}

.btn-editar {
    background: rgba(59, 130, 246, 0.08);
    color: #3B82F6;
}

.btn-editar:hover {
    background: #3B82F6;
    color: white;
    transform: none;
}

.btn-ativar {
    background: rgba(76, 175, 80, 0.15);
    color: #2e7d32;
}

.btn-ativar:hover {
    background: #4caf50;
    color: white;
    transform: none;
}

.btn-excluir {
    background: rgba(229, 62, 62, 0.08);
    color: black;
    /* color: var(--danger); */
}

.btn-excluir:hover {
    background: var(--danger);
    color: white;
    transform: none;
}

/* Badge ativo/inativo */
.badge {
    display: inline-block;
    padding: 0.2rem 0.6rem;
    border-radius: 2rem;
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.badge-ativo {
    background: rgba(16, 185, 129, 0.1);
    color: var(--success);
}

.badge-inativo {
    background: rgba(229, 62, 62, 0.08);
    color: var(--danger);
}

.badge-warning {
    background: rgba(255, 152, 0, 0.1);
    color: #FF9800;
}

/* Formulário CRUD */
.crud-form-container {
    max-width: 550px;
    margin: 0 auto;
    background: var(--white);
    padding: 2rem;
    border-radius: 1.5rem;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.05);
    animation: slideUp 0.4s ease;
}

.crud-form-container h3 {
    margin-bottom: 1.5rem;
    font-size: 1.15rem;
    color: var(--primary);
}

.crud-form-container form {
    display: flex;
    flex-direction: column;
    gap: 1.2rem;
}

.crud-form-actions {
    display: flex;
    gap: 0.8rem;
    margin-top: 0.5rem;
}

.crud-form-actions button {
    flex: 1;
}

.btn-cancelar {
    background: #F0F0F0 !important;
    color: var(--dark) !important;
}

.btn-cancelar:hover {
    background: #E0E0E0 !important;
}

/* ESTILOS DE ABAS (TABS) */
.tabs-container {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
    background: rgba(0, 0, 0, 0.03);
    padding: 0.4rem;
    border-radius: 1.2rem;
    max-width: fit-content;
    margin-left: auto;
    margin-right: auto;
}

.tab-btn {
    padding: 0.8rem 1.8rem;
    border-radius: 1rem;
    font-size: 0.85rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    cursor: pointer;
    transition: all 0.3s ease;
    border: none;
    background: transparent;
    color: var(--dark);
    opacity: 0.6;
    margin-top: 0;
}

.tab-btn:hover {
    opacity: 1;
    background: rgba(255, 255, 255, 0.5);
    transform: none;
}

.tab-btn.active {
    background: var(--white);
    color: var(--accent);
    opacity: 1;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
}

.tab-content {
    display: none;
    animation: fadeIn 0.4s ease;
}

.tab-content.active {
    display: block;
}

.card-stat.clickable {
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
}

.card-stat.clickable:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.1);
}

.card-stat.clickable::after {
    content: "Ver detalhes →";
    position: absolute;
    bottom: 1rem;
    right: 1.2rem;
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--accent);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.card-stat.clickable:hover::after {
    opacity: 1;
}

.search-bar-container {
    margin-bottom: 1.5rem;
    position: relative;
}

.search-input-icon {
    position: absolute;
    left: 1.2rem;
    top: 50%;
    transform: translateY(-50%);
    opacity: 0.4;
}

.search-input {
    padding-left: 3rem !important;
}


/* ==========================================================================
   MODAIS E BOTÕES RÁPIDOS (FASE 8)
   ========================================================================== */

.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 20000;
    padding: 1rem;
    backdrop-filter: blur(4px);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.modal-card {
    background: var(--white);
    width: 100%;
    max-width: 450px;
    max-height: 90vh;
    border-radius: 2rem;
    padding: 2.5rem;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.2);
    position: relative;
    animation: slideUp 0.3s ease;
    overflow-y: auto;
    overscroll-behavior: contain;
}

.modal-close {
    position: absolute;
    top: 1.5rem;
    right: 1.5rem;
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--dark);
    opacity: 0.3;
    padding: 0;
    margin: 0;
}

.input-with-action {
    display: flex;
    gap: 0.5rem;
    align-items: flex-end;
}

.btn-quick-add {
    background: var(--primary);
    color: var(--white);
    width: 45px;
    height: 45px;
    border-radius: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    cursor: pointer;
    transition: all 0.2s ease;
    flex-shrink: 0;
    margin-bottom: 0;
    padding: 0;
    border: none;
}

.btn-quick-add:hover {
    background: var(--accent);
    transform: scale(1.05);
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.search-input {
    padding: 0.8rem 1rem;
    border: 1px solid var(--gray);
    border-radius: 8px;
    font-family: inherit;
    font-size: 0.9rem;
    width: 300px;
    max-width: 100%;
}

.search-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(255, 152, 0, 0.1);
}


@media (max-width: 480px) {
    .form-row {
        grid-template-columns: 1fr;
    }
}

.empty-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
}

.empty-state p {
    font-size: 0.9rem;
    font-weight: 600;
}

/* Toast notification */
.toast {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    background: var(--primary);
    color: var(--white);
    padding: 1rem 1.5rem;
    border-radius: 1rem;
    font-size: 0.85rem;
    font-weight: 600;
    z-index: 25000;
    animation: slideUp 0.4s ease, fadeOut 0.4s ease 2.6s forwards;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}

.toast.success {
    background: var(--success);
}

.toast.error {
    background: var(--danger);
}

@keyframes fadeOut {
    to {
        opacity: 0;
        transform: translateY(10px);
    }
}

/* Responsivo CRUD */
@media (max-width: 768px) {
    .crud-table {
        font-size: 0.8rem;
    }

    .crud-table th,
    .crud-table td {
        padding: 0.7rem 0.6rem;
    }

    .action-btns {
        flex-direction: column;
        gap: 0.3rem;
    }

    .crud-header {
        flex-direction: column;
        align-items: stretch;
    }
}

/* Estilos adicionais para Gestão de Usuários */
.btn-adicionar {
    background: var(--accent);
    color: white;
    padding: 0.6rem 1.2rem;
    border-radius: 2rem;
    font-weight: 700;
    border: none;
    cursor: pointer;
    font-size: 0.8rem;
    text-transform: uppercase;
}

.btn-adicionar:hover {
    background: var(--primary);
}

.btn-save {
    background: var(--accent);
    color: white;
    padding: 0.8rem 1.5rem;
    border-radius: 2rem;
    font-weight: 700;
    border: none;
    cursor: pointer;
    flex: 1;
}

.btn-save:hover {
    background: var(--primary);
}

.btn-cancel {
    background: #eee;
    color: var(--dark);
    padding: 0.8rem 1.5rem;
    border-radius: 2rem;
    font-weight: 700;
    border: none;
    cursor: pointer;
    flex: 1;
}

.btn-cancel:hover {
    background: #ddd;
}
/* ==========================================================================
   FASE 5: PORTAL XML E NOTA FISCAL
   ========================================================================== */

.badge {
    padding: 0.2rem 0.5rem;
    border-radius: 0.5rem;
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
}

.badge.xml { background: #EBF8FF; color: #3182CE; border: 1px solid #BEE3F8; }
.badge.nenhuma { background: #F7FAFC; color: #4A5568; border: 1px solid #E2E8F0; }
.badge.ciencia { background: #FEF3C7; color: #92400E; border: 1px solid #FDE68A; }
.badge.confirmada { background: #D1FAE5; color: #065F46; border: 1px solid #A7F3D0; }

.toggle-btn {
    transition: all 0.3s ease;
}

.toggle-btn.active {
    background: var(--accent) !important;
    color: var(--white) !important;
}

.table-responsive {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

#tableItensCompra input {
    border: 1px solid #eee;
    background: #fff;
    padding: 0.3rem 0.6rem;
}

#tableItensCompra input:focus {
    border-color: var(--accent);
    box-shadow: none;
}

.fiscal-mode-toggle button {
    box-shadow: none !important;
}

.modal-card.modal-lg {
    max-width: 800px;
}

/* Fornecedores - Form Expans�vel */
.expanded-form {
    max-width: 1000px !important;
    margin: 0 auto;
}

.form-section {
    background: #fdfdfd;
    border: 1px solid #eee;
    border-radius: 1rem;
    padding: 1.5rem;
    margin-bottom: 2rem;
}

.form-section h4 {
    margin-bottom: 1.2rem;
    color: var(--primary);
    font-size: 0.9rem;
    text-transform: uppercase;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    border-bottom: 1px solid #eee;
    padding-bottom: 0.5rem;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 1.2rem;
}

.span-1 { grid-column: span 1; }
.span-2 { grid-column: span 2; }
.span-3 { grid-column: span 3; }
.span-4 { grid-column: span 4; }
.span-5 { grid-column: span 5; }
.span-6 { grid-column: span 6; }

.mini-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.8rem;
    background: white;
    border: 1px solid #eee;
    border-radius: 0.5rem;
    overflow: hidden;
}

.mini-table th {
    background: #f9f9f9;
    padding: 0.5rem;
    text-align: left;
    font-weight: 700;
    border-bottom: 1px solid #eee;
}

.mini-table td {
    padding: 0.5rem;
    border-bottom: 1px solid #eee;
}

.text-muted {
    color: #888;
}

@media (max-width: 768px) {
    .form-grid {
        grid-template-columns: 1fr;
    }
    .span-1, .span-2, .span-3, .span-4, .span-5, .span-6 {
        grid-column: span 1;
    }
}

/* Estilos para Modal de Visualizao */
.view-details-grid {
    margin-top: 1rem;
}
.view-group {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    margin-bottom: 0.5rem;
}
.view-label {
    font-size: 0.75rem;
    text-transform: uppercase;
    color: var(--text-muted);
    font-weight: 600;
}
.view-value {
    font-size: 0.95rem;
    color: var(--text-color);
}
.qsa-view .mini-table {
    margin-top: 0;
    border: 1px solid #eee;
}


/* Responsividade do Modal de Detalhes */
@media (max-width: 768px) {
    .view-details-grid {
        grid-template-columns: 1fr !important;
        gap: 0.8rem !important;
    }
    .view-group {
        grid-column: span 1 !important;
    }
    #modalCard {
        padding: 1.5rem !important;
        width: 95% !important;
        border-radius: 1.5rem !important;
    }
}


/* Fix Mobile Modal Fornecedor */
@media (max-width: 768px) {
    #modalCard {
        width: 98% !important;
        max-width: 98% !important;
        max-height: 95vh !important;
        padding: 1rem !important;
        border-radius: 1rem !important;
        margin: 0.5rem !important;
        overflow-y: auto !important;
        overscroll-behavior: contain !important;
        touch-action: pan-y !important;
    }
    .modal-header {
        flex-direction: row !important;
        align-items: center !important;
        justify-content: space-between !important;
        margin-bottom: 1rem !important;
    }
    .modal-header h3 {
        font-size: 1.1rem !important;
    }
    .close-modal {
        position: static !important;
        width: 32px !important;
        height: 32px !important;
        font-size: 1.2rem !important;
        padding: 0 !important;
    }
    .view-group .view-value {
        font-size: 0.85rem !important;
    }
    .view-group .view-label {
        font-size: 0.7rem !important;
    }
    .crud-header {
        flex-direction: column !important;
        align-items: stretch !important;
    }
    .search-container {
        margin: 0 !important;
        order: 3;
    }
}

/* ==========================================================================
   DUAL LIST: DESTINAÇÃO DE ITENS POR CENTRO DE CUSTO
   ========================================================================== */

.dual-list-container {
    display: grid;
    grid-template-columns: 1fr 65px 1fr;
    gap: 1.2rem;
    margin-top: 1.5rem;
    height: 450px;
    animation: fadeIn 0.3s ease;
}

.dual-list-column {
    display: flex;
    flex-direction: column;
    background: rgba(255, 255, 255, 0.4);
    backdrop-filter: blur(8px);
    border: 1px solid rgba(0,0,0,0.05);
    border-radius: 1.2rem;
    overflow: hidden;
    box-shadow: inset 0 2px 10px rgba(0,0,0,0.02);
}

.dual-list-header {
    padding: 0.8rem 1.2rem;
    background: rgba(23, 24, 28, 0.03);
    border-bottom: 1px solid rgba(0,0,0,0.05);
    font-size: 0.72rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--dark);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.dual-list-body {
    flex: 1;
    overflow-y: auto;
    padding: 0.8rem;
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}

.dual-list-item {
    padding: 1rem;
    background: var(--white);
    border: 1.5px solid transparent;
    border-radius: 1rem;
    font-size: 0.82rem;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
    user-select: none;
    box-shadow: 0 2px 8px rgba(0,0,0,0.03);
}

.dual-list-item:hover {
    border-color: var(--accent);
    transform: translateY(-2px);
    box-shadow: 0 6px 15px rgba(184, 74, 34, 0.1);
}

.dual-list-item.selected {
    background: rgba(184, 74, 34, 0.05);
    border-color: var(--accent);
}

.dual-list-item .item-meta {
    font-size: 0.65rem;
    font-weight: 700;
    opacity: 0.5;
    text-transform: uppercase;
}

.dual-list-controls {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 0.8rem;
}

.btn-move {
    width: 44px;
    height: 44px;
    border-radius: 50% !important;
    padding: 0 !important;
    margin: 0 !important;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--white) !important;
    color: var(--primary) !important;
    border: 1.5px solid #eee !important;
    font-size: 1.1rem !important;
    box-shadow: 0 4px 10px rgba(0,0,0,0.05) !important;
}

.btn-move:hover {
    background: var(--accent) !important;
    color: var(--white) !important;
    border-color: var(--accent) !important;
}

.dual-list-column.right {
    border-left: 4px solid var(--accent);
}

.destinacao-footer {
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid #eee;
    display: flex;
    justify-content: flex-end;
    gap: 1rem;
}

.badge-count {
    background: var(--primary);
    color: var(--white);
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 0.65rem;
}

@media (max-width: 768px) {
    .dual-list-container {
        grid-template-columns: 1fr;
        height: auto;
    }
    .dual-list-controls {
        flex-direction: row;
        padding: 1rem 0;
    }
    .btn-move {
        transform: rotate(90deg);
    }
}

/* FILTROS DE CONSULTA MODERNOS */
.filters-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 1.25rem;
    align-items: flex-end;
    background: #F7F7F8;
    padding: 1.5rem;
    border-radius: 1.5rem;
    border: 1px solid rgba(0, 0, 0, 0.05);
    margin-bottom: 0.5rem;
}

.filters-grid .form-group {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.filters-grid label {
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--dark);
    opacity: 0.7;
}

.filters-grid input,
.filters-grid select {
    padding: 0.85rem 1rem;
    border: 1.5px solid #E2E8F0;
    border-radius: 0.8rem;
    background: var(--white);
    font-size: 0.85rem;
    color: var(--primary);
    transition: all 0.2s ease;
    box-shadow: 0 1px 3px rgba(0,0,0,0.02);
}

.filters-grid input:focus,
.filters-grid select:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(184, 74, 34, 0.15);
    background: var(--white);
}

.filters-grid .btn-primary {
    padding: 0.85rem 1.5rem;
    border-radius: 0.8rem;
    font-size: 0.85rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    height: 100%;
    margin-top: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.filters-grid .btn-primary svg {
    transition: transform 0.2s ease;
}

.filters-grid .btn-primary:hover svg {
    transform: scale(1.1);
}

.filters-checkbox-container {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    cursor: pointer;
    user-select: none;
    margin: 0;
    padding: 0.85rem 1rem;
    border-radius: 0.8rem;
    background: rgba(184, 74, 34, 0.05);
    border: 1.5px dashed rgba(184, 74, 34, 0.2);
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.filters-checkbox-container:hover {
    background: rgba(184, 74, 34, 0.08);
    border-color: var(--accent);
}

.filters-checkbox-container input[type="checkbox"] {
    width: 18px !important;
    height: 18px !important;
    accent-color: var(--accent);
    cursor: pointer;
    margin: 0;
    padding: 0;
    box-shadow: none !important;
}

.filters-checkbox-container strong {
    font-size: 0.82rem;
    color: var(--accent);
    font-weight: 700;
    transition: color 0.2s ease;
}

@media (max-width: 1024px) {
    .filters-grid {
        grid-template-columns: 1fr 1fr;
    }
}

@media (max-width: 600px) {
    .filters-grid {
        grid-template-columns: 1fr;
    }
}

/* ESTILOS ADICIONADOS PARA SAAS FINANCEIRO */
.tenant-link {
    color: var(--primary);
    font-weight: 700;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.2s ease;
}
.tenant-link:hover {
    color: var(--accent);
    text-decoration: underline;
}
.badge-emdia {
    background: rgba(16, 185, 129, 0.1);
    color: var(--success);
}
.badge-atrasado {
    background: rgba(229, 62, 62, 0.08);
    color: var(--danger);
}
.badge-pendente {
    background: rgba(255, 152, 0, 0.15);
    color: #FF9800;
}

/* SUPERADMIN EXCLUSIVE FULL HEIGHT TABLE LAYOUT */
.content-area.superadmin-page {
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.content-area.superadmin-page .card-table {
    display: flex;
    flex-direction: column;
    flex: 1;
    overflow: hidden;
    min-height: 0;
}

.content-area.superadmin-page .table-responsive {
    flex: 1;
    overflow-y: auto;
    margin-top: 1rem;
    min-height: 0;
}

.content-area.superadmin-page .table th {
    position: sticky;
    top: 0;
    z-index: 10;
    background: #F7F7F8;
    opacity: 1;
    color: rgba(36, 37, 41, 0.6);
}

.table-striped tbody tr:nth-child(even) {
    background-color: #f8f9fa;
}

.table-striped tbody tr:hover {
    background-color: #f1f3f5;
}

/* ===========================
   TOM SELECT OVERRIDES
   =========================== */
.ts-control {
    border: 1px solid #ddd;
    border-radius: 0.8rem;
    background: #f9f9f9;
    padding: 0.6rem 1rem;
    box-shadow: none;
    font-family: inherit;
    font-size: 0.95rem;
    color: var(--text-dark);
    transition: all 0.2s ease;
}

.ts-control.focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(184, 74, 34, 0.1); /* Usando a cor de acento com opacidade */
    background: #fff;
}

.ts-wrapper.single .ts-control:after {
    border-color: #999 transparent transparent transparent;
    right: 1.2rem;
}

.ts-dropdown {
    border-radius: 0.8rem;
    border: 1px solid #ddd;
    box-shadow: 0 10px 25px rgba(0,0,0,0.1);
    margin-top: 4px;
    font-family: inherit;
    overflow: hidden;
    padding: 0;
}

.ts-dropdown .option {
    padding: 0.8rem 1rem;
    font-size: 0.95rem;
    color: var(--text-dark);
    transition: background 0.2s ease;
}

.ts-dropdown .option.active, 
.ts-dropdown .option:hover {
    background-color: var(--primary);
    color: #fff;
}

.ts-wrapper.single .ts-control input {
    font-size: 0.95rem;
    color: var(--text-dark);
    width: auto !important;
    padding: 0 !important;
    border: none !important;
    background: transparent !important;
    box-shadow: none !important;
    margin: 0 !important;
    border-radius: 0 !important;
}
