:root {
    --primary-color: #4A148C; /* Roxo Profundo (Gestão Vitícola) */
    --secondary-color: #7B1FA2; /* Roxo Médio */
    --accent-color: #9C27B0; /* Roxo Claro / Highlight */
    --background-color: #F3F4F6; /* Cinza Claro Fundo */
    --surface-color: #FFFFFF; /* Branco Cards */
    --text-primary: #1F2937;
    --text-secondary: #6B7280;
    --success-color: #10B981;
    --danger-color: #EF4444;
    --warning-color: #F59E0B;
    --sidebar-width: 260px;
    --header-height: 70px;
    --border-radius: 12px;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
}

body {
    background-color: var(--background-color);
    color: var(--text-primary);
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    width: var(--sidebar-width);
    background: linear-gradient(180deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    color: white;
    height: 100vh;
    position: fixed;
    left: 0;
    top: 0;
    z-index: 50;
    display: flex;
    flex-direction: column;
    padding: 1.5rem;
    box-shadow: 4px 0 10px rgba(0,0,0,0.1);
}

.brand {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 3rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.brand img {
    height: 32px;
    filter: brightness(0) invert(1);
}

.nav-menu {
    list-style: none;
    flex: 1;
}

.nav-item {
    margin-bottom: 0.5rem;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.875rem 1rem;
    color: rgba(255, 255, 255, 0.8);
    text-decoration: none;
    border-radius: var(--border-radius);
    transition: all 0.2s;
    font-size: 0.95rem;
}

.nav-link:hover, .nav-link.active {
    background-color: rgba(255, 255, 255, 0.15);
    color: white;
    font-weight: 600;
}

.nav-link i {
    width: 20px;
    text-align: center;
}

.user-profile {
    border-top: 1px solid rgba(255,255,255,0.1);
    padding-top: 1.5rem;
    display: flex;
    align-items: center;
    gap: 1rem;
}

.user-avatar {
    width: 40px;
    height: 40px;
    background-color: rgba(255,255,255,0.2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
}

.user-info small {
    display: block;
    color: rgba(255,255,255,0.7);
    font-size: 0.8rem;
}

/* Main Content Wrapper */
.main-wrapper {
    flex: 1;
    margin-left: var(--sidebar-width);
    padding: 2rem;
    width: calc(100% - var(--sidebar-width));
}

/* Header (Top Bar) */
.top-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
}

.page-title {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--text-primary);
}

.header-actions {
    display: flex;
    gap: 1rem;
}

/* Cards */
.card {
    background: var(--surface-color);
    border-radius: var(--border-radius);
    padding: 1.5rem;
    box-shadow: var(--shadow-sm);
    margin-bottom: 1.5rem;
    border: 1px solid rgba(0,0,0,0.03);
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    border-bottom: 1px solid #f3f4f6;
    padding-bottom: 1rem;
}

.card-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
}

/* Metrics Grid */
.metrics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.metric-card {
    background: white;
    padding: 1.5rem;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-sm);
    position: relative;
    overflow: hidden;
}

.metric-card::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
}

.metric-purple::after { background: var(--primary-color); }
.metric-yellow::after { background: var(--warning-color); }
.metric-green::after { background: var(--success-color); }

.metric-label {
    font-size: 0.85rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.5rem;
}

.metric-value {
    font-size: 1.75rem;
    font-weight: 800;
    color: var(--text-primary);
}

.metric-icon {
    position: absolute;
    right: 1.5rem;
    top: 1.5rem;
    opacity: 0.1;
    font-size: 2.5rem;
    color: var(--primary-color);
}

/* Tables */
.table-container {
    overflow-x: auto;
}

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

th {
    text-align: left;
    padding: 1rem;
    font-size: 0.85rem;
    text-transform: uppercase;
    color: var(--text-secondary);
    font-weight: 600;
    background-color: #F9FAFB;
    border-bottom: 1px solid #E5E7EB;
}

td {
    padding: 1rem;
    color: var(--text-primary);
    border-bottom: 1px solid #E5E7EB;
    font-size: 0.95rem;
}

tr:hover {
    background-color: #F9FAFB;
}

/* Buttons */
.btn {
    padding: 0.625rem 1.25rem;
    border-radius: 8px;
    border: none;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
    text-decoration: none;
}

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

.btn-primary:hover {
    background-color: var(--secondary-color);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(74, 20, 140, 0.2);
}

.btn-secondary {
    background-color: white;
    color: var(--text-primary);
    border: 1px solid #E5E7EB;
}

.btn-secondary:hover {
    background-color: #F9FAFB;
    border-color: #D1D5DB;
}

.btn-danger {
    background-color: #FEE2E2;
    color: var(--danger-color);
}

.btn-danger:hover {
    background-color: #FECACA;
}

/* Badges */
.badge {
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 600;
}

.badge-admin { background: #E0E7FF; color: var(--primary-color); }
.badge-user { background: #E5E7EB; color: var(--text-secondary); }

/* Forms */
.form-group { margin-bottom: 1.5rem; }

label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: var(--text-primary);
    font-size: 0.9rem;
}

input, select, textarea {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid #D1D5DB;
    border-radius: 8px;
    font-size: 0.95rem;
    transition: border-color 0.2s;
}

input:focus, select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(74, 20, 140, 0.1);
}

/* Utilities */
.text-right { text-align: right; }
.text-center { text-align: center; }
.hidden { display: none !important; }
.mt-4 { margin-top: 1rem; }

/* Responsive */
@media (max-width: 768px) {
    .sidebar { display: none; } /* Mobile menu needed later */
    .main-wrapper { margin-left: 0; width: 100%; padding: 1rem; }
    .metrics-grid { grid-template-columns: 1fr; }
}
