:root {
    --bg-color: #0f172a;
    --glass-bg: rgba(30, 41, 59, 0.7);
    --glass-border: rgba(255, 255, 255, 0.1);
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --accent-1: #3b82f6;
    --accent-2: #8b5cf6;
    --error: #ef4444;
    --success: #10b981;
    --radius: 16px;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

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

body {
    background-color: var(--bg-color);
    background-image: 
        radial-gradient(circle at 15% 50%, rgba(59, 130, 246, 0.15), transparent 25%),
        radial-gradient(circle at 85% 30%, rgba(139, 92, 246, 0.15), transparent 25%);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
}

/* Utils */
.hidden { display: none !important; }
.text-gradient {
    background: linear-gradient(135deg, var(--accent-1), var(--accent-2));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}
.pink-gradient {
    background: linear-gradient(135deg, #ec4899, #be185d);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}
.mt-4 { margin-top: 1.5rem; }
.mt-2 { margin-top: 0.5rem; }

/* Glassmorphism */
.glass {
    background: var(--glass-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius);
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.1);
}

/* Toast */
.toast {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 16px 24px;
    border-radius: 8px;
    color: white;
    font-weight: 500;
    z-index: 9999;
    transform: translateY(-100px);
    opacity: 0;
    transition: var(--transition);
}
.toast.show {
    transform: translateY(0);
    opacity: 1;
}

/* --- Tabela Moderna --- */
.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.95rem;
}
.data-table th, .data-table td {
    padding: 1rem;
    text-align: left;
    border-bottom: 1px solid var(--glass-border);
}
.data-table th {
    background: rgba(255,255,255, 0.05);
    font-weight: 600;
}
.data-table tr:hover {
    background: rgba(255,255,255, 0.02);
}
.actions-cell {
    display: flex;
    gap: 0.5rem;
}
.btn-small {
    padding: 0.4rem 0.6rem;
    font-size: 0.85rem;
    border-radius: 4px;
    border: none;
    cursor: pointer;
    background: rgba(255,255,255, 0.1);
    color: white;
    transition: background 0.3s;
}
.btn-small:hover {
    background: var(--accent-1);
}
.btn-danger:hover {
    background: #e74c3c;
}
.toast.success { background: var(--success); }
.toast.error { background: var(--error); }

/* Screens */
.screen {
    width: 100%;
    min-height: 100vh;
    display: flex;
}

/* Login */
#login-screen {
    justify-content: center;
    align-items: center;
}
.login-card {
    width: 100%;
    max-width: 400px;
    padding: 2.5rem;
    animation: fadeUp 0.6s ease-out;
}
.login-header {
    text-align: center;
    margin-bottom: 2rem;
}
.login-header h2 { font-size: 2rem; font-weight: 700; }
.login-header p { color: var(--text-secondary); margin-top: 0.5rem; }

/* App Layout */
.sidebar {
    width: 260px;
    margin: 1rem;
    display: flex;
    flex-direction: column;
    padding: 1.5rem;
    position: sticky;
    top: 1rem;
    height: calc(100vh - 2rem);
}
.sidebar .logo { margin-bottom: 3rem; }
.sidebar .logo h2 { font-size: 1.5rem; font-weight: 700; }

.menu { flex: 1; display: flex; flex-direction: column; gap: 0.5rem; }
.menu-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.875rem 1rem;
    border-radius: 8px;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
}
.menu-item:hover {
    background: rgba(255,255,255,0.05);
    color: var(--text-primary);
}
.menu-item.active {
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.2), rgba(139, 92, 246, 0.2));
    color: var(--accent-1);
    border-left: 3px solid var(--accent-1);
}

.topbar {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 1.5rem;
    margin-bottom: 2rem;
    width: 100%;
}
.user-info { display: flex; align-items: center; gap: 0.5rem; font-weight: 500;}
.avatar { width: 32px; height: 32px; background: var(--accent-1); border-radius: 50%; }

.main-content {
    flex: 1;
    padding: 1rem 2rem 1rem 0;
    max-width: 1200px;
}

/* Views */
.view { display: none; animation: fadeIn 0.4s ease; }
.view.active { display: block; }
.view-header { margin-bottom: 2rem; }
.view-header h1 { font-size: 2rem; }
.view-header p { color: var(--text-secondary); margin-top: 0.25rem; }

/* Forms */
.form-container { padding: 2rem; }
.tabs {
    display: flex;
    gap: 1rem;
    border-bottom: 1px solid var(--glass-border);
    margin-bottom: 4rem;
    padding-bottom: 1rem;
    overflow-x: auto;
}
.tab-btn {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: 1rem;
    font-weight: 600;
    padding: 0.5rem 1rem;
    cursor: pointer;
    border-radius: 8px;
    transition: var(--transition);
}
.tab-btn:hover { color: var(--text-primary); background: rgba(255,255,255,0.05); }
.tab-btn.active {
    background: var(--accent-1);
    color: white;
}

.tab-content { display: none; animation: slideUp 0.3s ease; }
.tab-content.active { display: block; }
.tab-content h3 { margin-bottom: 1.5rem; color: var(--accent-1); font-weight: 600; border-bottom: 1px solid rgba(255,255,255,0.1); padding-bottom: 0.5rem; }

/* Grids */
.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1.5rem; }
.grid-3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 1.5rem; }
.grid-4 { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 1.5rem; }

/* Inputs */
.input-group { display: flex; flex-direction: column; gap: 0.5rem; margin-bottom: 1rem; }
.input-group label { font-size: 0.875rem; font-weight: 500; color: var(--text-secondary); }
.input-group input[type="text"],
.input-group input[type="password"],
.input-group input[type="number"],
.input-group input[type="date"],
.input-group input[type="datetime-local"],
.input-group select {
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    padding: 0.75rem 1rem;
    color: var(--text-primary);
    font-size: 1rem;
    transition: var(--transition);
    outline: none;
}
.input-group input:focus, .input-group select:focus {
    border-color: var(--accent-1);
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2);
}
.input-readonly { opacity: 0.7; cursor: not-allowed; }

.box-check { flex-direction: row; align-items: center; gap: 0.75rem; background: rgba(255,255,255,0.02); padding: 1rem; border-radius: 8px; border: 1px solid rgba(255,255,255,0.05); }
.box-check input[type="checkbox"] { width: 1.25rem; height: 1.25rem; accent-color: var(--accent-1); }
.box-check label { cursor: pointer; color: var(--text-primary); font-size: 1rem; }

/* Zone Box */
.zone-box { background: rgba(0,0,0,0.2); border: 1px solid var(--glass-border); padding: 1.25rem; border-radius: 8px; }
.zone-box h4 { margin-bottom: 1rem; font-size: 1rem; color: var(--text-primary); }

/* Buttons */
.btn-primary {
    background: linear-gradient(135deg, var(--accent-1), var(--accent-2));
    color: white;
    border: none;
    border-radius: 8px;
    padding: 0.875rem 1.5rem;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    width: 100%;
}
.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.4);
}
.btn-ghost {
    background: transparent;
    color: var(--text-secondary);
    border: 1px solid var(--glass-border);
    padding: 0.5rem 1rem;
    border-radius: 6px;
    cursor: pointer;
    transition: var(--transition);
}
.btn-ghost:hover { background: rgba(255,255,255,0.1); color: white; }

/* Dashboard */
.kpi-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 1.5rem; margin-bottom: 2rem; }
.kpi-card { padding: 1.5rem; text-align: center; }
.kpi-card h3 { color: var(--text-secondary); font-size: 0.875rem; font-weight: 500; text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 0.5rem;}
.kpi-value { font-size: 2.5rem; font-weight: 700; color: var(--accent-1); }

.dashboard-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1.5rem; }
.chart-card { padding: 1.5rem; }
.chart-card h3 { font-size: 1rem; font-weight: 600; margin-bottom: 1rem; color: var(--text-secondary); }

/* Animations */
@keyframes fadeUp {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}
@keyframes slideUp {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@media (max-width: 768px) {
    .screen { flex-direction: column; }
    .sidebar { width: auto; height: auto; position: static; margin-bottom: 0; border-bottom-left-radius: 0; border-bottom-right-radius: 0; }
    .main-content { padding: 1rem; }
    .dashboard-grid { grid-template-columns: 1fr; }
    .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
}

/* Modals */
.modal {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10000;
    backdrop-filter: blur(4px);
    animation: fadeIn 0.3s ease;
}
.modal-content {
    width: 100%;
    max-width: 500px;
    padding: 2rem;
    position: relative;
    animation: slideUp 0.3s ease;
}
.wrapper-group {
    display: flex; gap: 0.5rem; width: 100%; align-items: center; flex-wrap: wrap;
}
.wrapper-group input {
    flex: 1 1 120px;
    min-width: 0;
}
