:root {
    --primary: #b59b5a;
    --primary-dark: #9e8750;
    --primary-light: #fdfaf3;
    --bg: #f8f9fa;
    --sidebar-bg: #ffffff;
    --white: #ffffff;
    --text: #1a1a1a;
    --text-sec: #64748b;
    --border: #e2e8f0;
    --border-light: #f1f5f9;
    --success: #10b981;
    --error: #ef4444;
    --sidebar-width: 260px;
    --header-height: 70px;
    --border-radius: 12px;
    --shadow: 0 4px 20px rgba(0, 0, 0, 0.05);
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

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

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg);
    color: var(--text);
    line-height: 1.5;
    min-height: 100vh;
}

/* Layout Wrapper */
.layout-wrapper {
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    width: var(--sidebar-width);
    background: var(--sidebar-bg);
    border-right: 1px solid var(--border);
    position: fixed;
    height: 100vh;
    left: 0;
    top: 0;
    z-index: 1000;
    transition: var(--transition);
    display: flex;
    flex-direction: column;
}

.sidebar-header {
    height: var(--header-height);
    display: flex;
    align-items: center;
    padding: 0 25px;
    border-bottom: 1px solid var(--border-light);
}

.sidebar-brand {
    font-size: 18px;
    font-weight: 800;
    text-decoration: none;
    color: var(--text);
    letter-spacing: -0.5px;
}

.sidebar-brand span {
    color: var(--primary);
}

.sidebar-menu {
    flex: 1;
    padding: 20px 15px;
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.menu-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 15px;
    text-decoration: none;
    color: var(--text-sec);
    font-size: 14px;
    font-weight: 500;
    border-radius: 8px;
    transition: var(--transition);
}

.menu-item i {
    width: 20px;
    height: 20px;
}

.menu-item:hover {
    background: var(--primary-light);
    color: var(--primary);
}

.menu-item.active {
    background: var(--primary);
    color: var(--white);
}

.sidebar-footer {
    padding: 20px 15px;
    border-top: 1px solid var(--border-light);
}

/* Main Content */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    display: flex;
    flex-direction: column;
    width: calc(100% - var(--sidebar-width));
    transition: var(--transition);
}

/* Page Header */
.page-header {
    height: var(--header-height);
    background: var(--white);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 30px;
    position: sticky;
    top: 0;
    z-index: 900;
}

.page-title h1 {
    font-size: 18px;
    font-weight: 700;
}

.page-body {
    padding: 30px;
    max-width: 1400px;
    width: 100%;
    margin: 0 auto;
}

/* Cards Modernizados */
.card {
    background: var(--white);
    border-radius: var(--border-radius);
    border: 1px solid var(--border-light);
    box-shadow: var(--shadow);
    padding: 25px;
    margin-bottom: 25px;
}

.card-title {
    font-size: 16px;
    font-weight: 700;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
}

/* Grid de Estatísticas */
.stats-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.stat-box {
    background: var(--white);
    padding: 25px;
    border-radius: var(--border-radius);
    border: 1px solid var(--border-light);
    display: flex;
    align-items: center;
    gap: 20px;
    transition: var(--transition);
}

.stat-box:hover {
    transform: translateY(-4px);
    box-shadow: 0 10px 25px rgba(0,0,0,0.05);
}

.stat-icon {
    width: 50px;
    height: 50px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--primary-light);
    color: var(--primary);
}

.stat-data h3 {
    font-size: 24px;
    font-weight: 800;
}

.stat-data p {
    font-size: 13px;
    color: var(--text-sec);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 600;
}

/* Tabelas Premium */
.table-container {
    width: 100%;
    overflow-x: auto;
}

.table-custom {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
}

.table-custom th {
    background: #fcfcfc;
    padding: 15px 20px;
    text-align: left;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--text-sec);
    border-bottom: 1px solid var(--border-light);
}

.table-custom td {
    padding: 18px 20px;
    font-size: 14px;
    border-bottom: 1px solid var(--border-light);
    color: var(--text);
}

.table-custom tbody tr:hover td {
    background-color: #fafbfc;
}

/* Botões */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    border-radius: 8px;
    font-weight: 600;
    font-size: 14px;
    text-decoration: none;
    cursor: pointer;
    transition: var(--transition);
    border: none;
}

.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-outline { border: 1px solid var(--border); background: transparent; color: var(--text-sec); }
.btn-outline:hover { border-color: var(--primary); color: var(--primary); }

/* Badges */
.badge {
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
}

.badge-success { background: #d1fae5; color: #065f46; }
.badge-info { background: #dbeafe; color: #1e40af; }
.badge-warning { background: #fef3c7; color: #92400e; }

/* Forms */
.form-group { margin-bottom: 25px; }
label { 
    display: block; 
    margin-bottom: 8px; 
    font-size: 11px; 
    font-weight: 700; 
    text-transform: uppercase; 
    letter-spacing: 0.8px; 
    color: var(--text-sec); 
}

.form-control { 
    width: 100%; 
    padding: 12px 16px; 
    border: 1px solid var(--border); 
    border-radius: 10px; 
    font-size: 14px; 
    font-weight: 400;
    color: var(--text);
    transition: var(--transition); 
    background: #fcfcfc; 
}

.form-control:hover {
    border-color: #cbd5e1;
    background: #ffffff;
}

.form-control:focus { 
    border-color: var(--primary); 
    outline: none; 
    box-shadow: 0 0 0 4px rgba(181, 155, 90, 0.12); 
    background: #ffffff;
}

.form-control::placeholder {
    color: #94a3b8;
    opacity: 0.7;
}

textarea.form-control { resize: vertical; min-height: 120px; }

/* Form Utilities */
.form-row { display: flex; gap: 20px; flex-wrap: wrap; margin-bottom: 25px; }
.form-row .form-group { margin-bottom: 0; flex: 1; min-width: 200px; }
.form-row .half { flex: 0 0 calc(50% - 10px); }
.form-row .third { flex: 0 0 calc(33.333% - 13.4px); }

/* Mobile Menu Toggle */
.mobile-toggle {
    display: none;
    background: none;
    border: none;
    color: var(--text);
    cursor: pointer;
}

/* Responsividade */
@media (max-width: 1024px) {
    :root { --sidebar-width: 0px; }
    .sidebar { left: -260px; width: 260px; }
    .sidebar.active { left: 0; }
    .main-content { margin-left: 0; width: 100%; }
    .mobile-toggle { display: block; }
}

@media (max-width: 640px) {
    .page-header { padding: 0 15px; }
    .page-body { padding: 15px; }
    .stats-row { grid-template-columns: 1fr; }
}

/* Flash Messages */
.alert {
    padding: 15px 20px;
    border-radius: 10px;
    margin-bottom: 25px;
    font-size: 14px;
    font-weight: 500;
    animation: fadeIn 0.3s ease;
}

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

/* Reader Styles Override (To keep reader full screen) */
body.reading-mode .sidebar,
body.reading-mode .page-header {
    display: none;
}
body.reading-mode .main-content {
    margin-left: 0;
    width: 100%;
}
body.reading-mode .page-body {
    padding: 0;
    max-width: none;
}
