/* Base: variáveis, tipografia, botões, layout, tabelas, modais (parte de style.css) */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --verde: #535735;
    --verde-escuro: #3d4028;
    --verde-claro: #8b8b5a;
    --fundo: #f4f5f1;
    --superficie: #ffffff;
    --superficie-2: #fafbf8;
    --borda: #e6e7e2;
    --texto: #1c1e19;
    --texto-2: #6b6f64;
    --sombra-sm: 0 1px 2px rgba(28, 30, 25, 0.05);
    --sombra: 0 1px 3px rgba(28, 30, 25, 0.06), 0 6px 18px rgba(28, 30, 25, 0.05);
    --raio: 10px;
}

body {
    font-family: 'Inter', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: var(--fundo);
    color: var(--texto);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    font-size: 14px;
    line-height: 1.5;
}

/* Login */
.page-login {
    min-height: 100vh;
    background: radial-gradient(1200px 800px at 50% 0%, rgba(139, 139, 90, 0.12), transparent),
                radial-gradient(1000px 800px at 80% 80%, rgba(83, 87, 53, 0.12), transparent),
                var(--fundo, #f6f7f2);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

.login-container {
    background: var(--superficie, #ffffff);
    border: 1px solid var(--borda, #e6e7e2);
    border-radius: 16px;
    box-shadow: 0 20px 60px -30px rgba(28, 30, 25, 0.9), 0 2px 8px rgba(28, 30, 25, 0.05);
    padding: 48px 40px;
    width: min(480px, 100%);
    text-align: center;
    max-width: 480px;
    margin: 0;
    display: flex;
    flex-direction: column;
    align-items: stretch;
}

.login-brand {
    margin-bottom: 8px;
    margin-top: -8px;
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
}

.login-brand .login-logo {
    width: auto;
    height: 140px;
    max-height: none;
    object-fit: contain;
    padding: 0;
    box-sizing: border-box;
}

.login-logo {
    height: 140px;
    max-height: none;
    margin-bottom: 0;
    object-fit: contain;
    filter: brightness(0) saturate(100%) invert(32%) sepia(18%) saturate(637%) hue-rotate(24deg) brightness(93%) contrast(91%);
    width: auto;
    max-width: 100%;
    padding: 0;
    box-sizing: border-box;
}

.login-container h1 {
    margin: 0;
    font-size: 24px;
    font-weight: 700;
    color: var(--texto, #1c1e19);
    letter-spacing: -0.02em;
    text-transform: none;
    margin-bottom: 0;
}

.login-container h2 {
    margin: 6px 0 0 0;
    font-size: 13px;
    font-weight: 500;
    color: var(--texto-2, #6b6f64);
    letter-spacing: 0.3em;
    text-transform: uppercase;
    font-variant-numeric: tabular-nums;
    margin-bottom: 0;
}

.login-form {
    margin-top: 0;
    text-align: left;
    padding: 0 40px;
}

.login-form .form-group { margin-bottom: 14px; }

.login-form .form-group input {
    height: 42px;
    font-size: 14px;
}

.btn-login { width: 100%; margin-top: 8px; }

.login-rodape {
    margin-top: 24px;
    font-size: 11.5px;
    color: var(--texto-2, #6b6f64);
    padding: 0 40px;
}

.form-group {
    margin-bottom: 20px;
    text-align: left;
}

.form-group label {
    display: block;
    margin-bottom: 7px;
    font-weight: 500;
    font-size: 12px;
    color: var(--texto-2);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.form-group input, .form-group select, .form-group textarea {
    width: 100%;
    padding: 11px 14px;
    border: 1px solid var(--borda);
    border-radius: 8px;
    font-size: 14px;
    font-family: inherit;
    background: var(--superficie);
    color: var(--texto);
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.form-group input:focus, .form-group select:focus, .form-group textarea:focus {
    outline: none;
    border-color: var(--verde-claro);
    box-shadow: 0 0 0 3px rgba(139,139,90,0.15);
}

.btn {
    padding: 11px 22px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 0.2px;
    font-family: inherit;
    transition: all 0.2s ease;
    box-shadow: var(--sombra-sm);
}

.btn:active {
    transform: translateY(1px);
}

.btn-primary {
    background-color: var(--verde);
    color: white;
}

.btn-primary:hover {
    background-color: var(--verde-escuro);
    box-shadow: 0 4px 12px rgba(83, 87, 53, 0.3);
}

.btn-secondary {
    background-color: #eceee8;
    color: #4a4d44;
    box-shadow: none;
}

.btn-secondary:hover {
    background-color: #dfe1da;
}

.btn-success {
    background-color: var(--verde);
    color: white;
}

.btn-success:hover {
    background-color: var(--verde-escuro);
    box-shadow: 0 4px 12px rgba(83, 87, 53, 0.3);
}

.btn-warning {
    background-color: var(--verde-claro);
    color: white;
}

.btn-warning:hover {
    background-color: #74744a;
    box-shadow: 0 4px 12px rgba(139, 139, 90, 0.35);
}

.btn-danger {
    background-color: #d9534f;
    color: white;
}

.btn-danger:hover {
    background-color: #c9302c;
    box-shadow: 0 4px 12px rgba(217, 83, 79, 0.3);
}

/* Botões com ícone */
.btn-icon {
    display: inline-flex;
    align-items: center;
    gap: 7px;
}

.btn-icon svg {
    width: 15px;
    height: 15px;
    stroke-width: 2.2;
    flex-shrink: 0;
}

/* Efeito shimmer (Watermelon UI - Shimmer Button) */
.btn-shimmer {
    position: relative;
    overflow: hidden;
    isolation: isolate;
}

.btn-shimmer::after {
    content: '';
    position: absolute;
    inset: 0;
    z-index: -1;
    background: linear-gradient(105deg,
        transparent 30%,
        rgba(255, 255, 255, 0.35) 50%,
        transparent 70%);
    transform: translateX(-120%);
    transition: transform 0.6s ease;
}

.btn-shimmer:hover::after {
    transform: translateX(120%);
}

/* Botão com morphing (Watermelon UI - Morphing Button) */
.btn-loading,
.btn-success-state {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    pointer-events: none;
}

.btn-loading {
    opacity: 0.85;
}

.btn-loading::before {
    content: '';
    width: 15px;
    height: 15px;
    border: 2px solid rgba(255,255,255,0.4);
    border-top-color: #fff;
    border-radius: 50%;
    animation: girar 0.6s linear infinite;
    flex-shrink: 0;
}

@keyframes girar {
    to { transform: rotate(360deg); }
}

.btn-success-state {
    background-color: #3d9950 !important;
}

.btn-success-state::before {
    content: '';
    width: 15px;
    height: 15px;
    background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 6 9 17l-5-5'/%3E%3C/svg%3E") center/contain no-repeat;
    flex-shrink: 0;
}

/* Ripple ao clicar */
.btn {
    position: relative;
    overflow: hidden;
}

.btn .ripple {
    position: absolute;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.45);
    transform: scale(0);
    animation: ripple 0.5s ease-out;
    pointer-events: none;
}

@keyframes ripple {
    to { transform: scale(3); opacity: 0; }
}

.error {
    color: #e74c3c;
    margin-top: 10px;
}

/* Botão hambúrguer — morphing + shimmer (Watermelon UI) */
.sidebar-toggle {
    width: 42px;
    height: 42px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    cursor: pointer;
    transition: background 0.2s ease, border-color 0.2s ease;
    flex-shrink: 0;
    position: relative;
    overflow: hidden;
    isolation: isolate;
}

.sidebar-toggle::after {
    content: '';
    position: absolute;
    inset: 0;
    z-index: -1;
    background: linear-gradient(105deg,
        transparent 30%,
        rgba(255, 255, 255, 0.15) 50%,
        transparent 70%);
    transform: translateX(-120%);
    transition: transform 0.6s ease;
}

.sidebar-toggle:hover::after {
    transform: translateX(120%);
}

.sidebar-toggle:hover {
    background: rgba(255, 255, 255, 0.12);
    border-color: rgba(255, 255, 255, 0.2);
}

.burger {
    display: flex;
    flex-direction: column;
    gap: 5px;
    width: 20px;
}

.burger-line {
    display: block;
    height: 2px;
    width: 100%;
    background: #d4d6cb;
    border-radius: 2px;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.2s ease, width 0.3s ease;
}

.sidebar-toggle.active .burger-line:nth-child(1) {
    transform: translateY(7px) rotate(45deg);
}

.sidebar-toggle.active .burger-line:nth-child(2) {
    opacity: 0;
    width: 0;
}

.sidebar-toggle.active .burger-line:nth-child(3) {
    transform: translateY(-7px) rotate(-45deg);
}

/* Header */
header {
    background: linear-gradient(180deg, #1b1e13 0%, #17190f 100%);
    color: white;
    padding: 0 24px;
    height: 104px;
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    border-bottom: 1px solid #2a2c20;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 16px;
    justify-self: start;
}

.header-title {
    font-size: 15px;
    font-weight: 500;
    letter-spacing: 0.8px;
    text-transform: uppercase;
    color: #d4d6cb;
    white-space: nowrap;
}

.header-logo {
    justify-self: center;
    display: flex;
    align-items: center;
    height: 104px;
}

.header-actions {
    justify-self: end;
}

.header-logo img,
.logo {
    height: 96px;
    width: auto;
    max-width: 480px;
    object-fit: contain;
    display: block;
    filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.25));
}

.user-info {
    display: flex;
    align-items: center;
    gap: 15px;
}

/* Layout com sidebar */
.layout {
    display: flex;
    height: calc(100vh - 104px);
    position: relative;
}

/* Sidebar */
.sidebar {
    width: 230px;
    background-color: #20221a;
    border-right: 1px solid #2a2c20;
    display: flex;
    flex-direction: column;
    padding: 12px 0;
    flex-shrink: 0;
    transition: width 0.25s ease, transform 0.25s ease;
    position: sticky;
    top: 104px;
    align-self: flex-start;
    height: calc(100vh - 104px);
    overflow-y: auto;
    overflow-x: hidden;
}

.sidebar .nav-btn,
.sidebar .tab-btn {
    background: none;
    border: none;
    border-left: 3px solid transparent;
    color: #b8bd96;
    margin: 3px 10px;
    padding: 11px 14px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    font-family: inherit;
    letter-spacing: 0.1px;
    text-align: left;
    display: flex;
    align-items: center;
    gap: 12px;
    transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
    white-space: nowrap;
    overflow: hidden;
    position: relative;
    width: calc(100% - 20px);
}

.sidebar .nav-btn:hover,
.sidebar .tab-btn:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.06);
}

.sidebar .nav-btn.active,
.sidebar .tab-btn.active {
    color: #fff;
    background: linear-gradient(90deg, rgba(139, 139, 90, 0.35), rgba(139, 139, 90, 0.12));
    border-left-color: #a3a678;
}

.sidebar .tab-icon {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0.9;
}

.sidebar .nav-btn .tab-icon svg,
.sidebar .tab-btn .tab-icon svg {
    width: 20px;
    height: 20px;
    stroke-width: 1.8;
}

.sidebar .nav-btn.active .tab-icon,
.sidebar .tab-btn.active .tab-icon {
    opacity: 1;
    color: #c8cda8;
}

.sidebar .nav-btn .tab-label,
.sidebar .tab-btn .tab-label {
    flex: 1;
    min-width: 0;
}

.sidebar-collapse {
    margin-top: auto;
    background: linear-gradient(180deg, transparent 0%, rgba(255, 255, 255, 0.02) 100%);
    border: none;
    border-top: 1px solid #3a3d2c;
    color: #a4a996;
    padding: 14px 16px;
    font-size: 11px;
    font-family: inherit;
    font-weight: 600;
    letter-spacing: 1px;
    text-transform: uppercase;
    cursor: pointer;
    transition: all 0.25s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    position: relative;
    overflow: hidden;
}
.sidebar-collapse::before {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at top, rgba(255, 255, 255, 0.04) 0%, transparent 70%);
    pointer-events: none;
}
.sidebar-collapse:hover {
    color: #fff;
    background: linear-gradient(180deg, transparent 0%, rgba(255, 255, 255, 0.06) 100%);
    border-top-color: #4f5537;
}
.sidebar-collapse:active {
    transform: scale(0.98);
}
.collapse-icon {
    width: 16px;
    height: 16px;
    transition: transform 0.25s ease;
    flex-shrink: 0;
    opacity: 0.8;
}
.collapse-compact {
    display: none;
    font-weight: 700;
    letter-spacing: 2px;
    font-size: 12px;
    z-index: 1;
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
}
.sidebar-collapse:hover .collapse-icon {
    opacity: 1;
}

/* Sidebar recolhida (desktop) */
.sidebar.collapsed { width: 64px; }
.sidebar.collapsed .tab-label { display: none; }
.sidebar.collapsed .nav-btn,
.sidebar.collapsed .tab-btn { justify-content: center; margin: 2px 8px; padding: 12px 0; width: calc(100% - 16px); }
.sidebar.collapsed .sidebar-collapse { padding: 13px 0; justify-content: center; gap: 0; }
.sidebar.collapsed .sidebar-collapse .collapse-text { display: none !important; }
.sidebar.collapsed .sidebar-collapse .collapse-compact { display: flex !important; align-items: center; justify-content: center; }
.sidebar-collapse .collapse-compact { display: none; align-items: center; justify-content: center; }
.sidebar.collapsed .collapse-icon { transform: rotate(180deg); }
.sidebar.collapsed .collapse-label { display: none !important; }

/* Overlay (mobile) */
.sidebar-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.55);
    z-index: 49;
}

/* Main */
main {
    padding: 30px;
    flex: 1;
    min-width: 0;
}

.tab-content {
    display: none;
}

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

/* Stats */
.stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card {
    background: var(--superficie);
    padding: 22px 24px;
    border: 1px solid var(--borda);
    border-radius: var(--raio);
    display: flex;
    align-items: center;
    gap: 18px;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    box-shadow: var(--sombra-sm);
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--sombra);
}

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.stat-icon svg {
    width: 22px;
    height: 22px;
    stroke-width: 1.8;
}

.stat-icon.blue { background: #eef1fb; color: #4f63c9; }
.stat-icon.red { background: #fdeeed; color: #d9534f; }
.stat-icon.green { background: #ebf5ee; color: #3d9950; }
.stat-icon.orange { background: #fdf3e7; color: #d9822b; }

.stat-info h3 {
    color: var(--texto-2);
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.8px;
    text-transform: uppercase;
    margin-bottom: 4px;
}

.stat-info p {
    font-size: 30px;
    font-weight: 700;
    color: var(--texto);
    line-height: 1;
    letter-spacing: -0.5px;
    font-variant-numeric: tabular-nums;
}

/* Dashboard grid + charts */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.card {
    background: var(--superficie);
    border: 1px solid var(--borda);
    border-radius: var(--raio);
    padding: 24px;
    box-shadow: var(--sombra-sm);
}

.card h2 {
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 0.6px;
    text-transform: uppercase;
    color: var(--texto-2);
    margin-bottom: 20px;
}

.chart-container {
    position: relative;
    height: 280px;
}

.empty-state {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #aaa;
    font-size: 14px;
}

/* Section Header */
.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.section-header h2 {
    font-size: 20px;
    font-weight: 700;
    letter-spacing: -0.3px;
    color: var(--texto);
}

.search-box {
    display: flex;
    gap: 10px;
    align-items: center;
}

.search-box input {
    padding: 10px 16px;
    border: 1px solid var(--borda);
    border-radius: 8px;
    width: 300px;
    font-family: inherit;
    font-size: 13px;
    background: var(--superficie);
    color: var(--texto);
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.search-box input:focus {
    outline: none;
    border-color: var(--verde-claro);
    box-shadow: 0 0 0 3px rgba(139,139,90,0.15);
}

/* Table */
.table-container {
    background: var(--superficie);
    border: 1px solid var(--borda);
    border-radius: var(--raio);
    overflow-x: auto;
    box-shadow: var(--sombra-sm);
}

table {
    width: 100%;
    border-collapse: collapse;
}

th, td {
    padding: 13px 18px;
    text-align: left;
    border-bottom: 1px solid var(--borda);
}

th {
    background-color: var(--superficie-2);
    font-weight: 600;
    font-size: 11px;
    letter-spacing: 0.6px;
    text-transform: uppercase;
    color: var(--texto-2);
    white-space: nowrap;
}

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

tbody tr {
    transition: background-color 0.15s ease;
}

tr:hover {
    background-color: var(--superficie-2);
}

/* Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(20, 22, 15, 0.6);
    backdrop-filter: blur(3px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    animation: modalFade 0.2s ease;
}

@keyframes modalFade {
    from { opacity: 0; }
    to { opacity: 1; }
}

.modal.hidden {
    display: none;
}

.modal-content {
    background: var(--superficie);
    padding: 36px 40px;
    max-width: 520px;
    width: 92%;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
    border-radius: 14px;
    box-shadow: 0 25px 60px rgba(0,0,0,0.3);
    animation: modalSlide 0.25s ease;
}

@keyframes modalSlide {
    from { transform: translateY(16px) scale(0.98); opacity: 0; }
    to { transform: translateY(0) scale(1); opacity: 1; }
}
