:root {
    --primary: #d60058;
    --primary-alt: #e50058;
    --secondary: #2e2d7e;
    --sidebar-bg: #22264f;
    --accent: #d60058;
    --bg-light: #ffffff;
    --bg-card: #f9f9f9;
    --text-dark: #222831;
    --text-muted: #495057;
    --text-white: #ffffff;
    --blue-dark: #002b5c;
    --blue-pale: #e3f0fc;
    --shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
    --border-radius: 8px;
}

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

body {
    background-color: var(--bg-light);
    color: var(--text-dark);
}

/* --- Login Page --- */
.login-container {
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    background: linear-gradient(135deg, var(--sidebar-bg) 0%, #3a3f7a 100%);
}

.login-card {
    background: var(--bg-card);
    padding: 2.5rem;
    border-radius: var(--border-radius);
    box-shadow: 0 10px 40px rgba(0,0,0,0.3);
    width: 100%;
    max-width: 400px;
    text-align: center;
}

.login-card h1 {
    color: var(--sidebar-bg);
    margin-bottom: 1.5rem;
    font-size: 1.8rem;
}

.login-card label {
    display: block;
    text-align: left;
    margin-top: 1rem;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-muted);
}

.login-card input {
    width: 100%;
    padding: 0.8rem;
    margin-top: 0.3rem;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 1rem;
    outline: none;
    transition: border-color 0.3s;
}

.login-card input:focus {
    border-color: var(--primary);
}

.btn {
    width: 100%;
    padding: 0.8rem;
    margin-top: 1.5rem;
    border: none;
    border-radius: 6px;
    background: var(--primary);
    color: white;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.3s, transform 0.2s;
}

.btn:hover {
    background: var(--primary-hover);
    transform: translateY(-2px);
}

/* --- Dashboard Layout --- */
.dashboard-layout {
    display: flex;
    height: 100vh;
}

.sidebar {
    width: 260px;
    background: var(--sidebar-bg);
    color: white;
    padding: 1.5rem 0;
    display: flex;
    flex-direction: column;
}

.sidebar-header {
    padding: 0 1.5rem 2rem;
    text-align: center;
}

.sidebar-header img {
    max-width: 180px;
}

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

.menu-item {
    padding: 0.8rem 1.5rem;
    cursor: pointer;
    transition: background 0.3s;
    display: flex;
    align-items: center;
    gap: 12px;
}

.menu-item:hover, .menu-item.active {
    background: var(--sidebar-hover);
}

.menu-item.active {
    border-left: 4px solid var(--primary);
}

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

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

.welcome-msg {
    font-size: 1.5rem;
    color: var(--sidebar-bg);
    font-weight: 700;
}

.card {
    background: white;
    padding: 2rem;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    margin-bottom: 2rem;
}

/* --- Tables --- */
.table-container {
    width: 100%;
    overflow-x: auto;
    margin-top: 1rem;
}

table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 10px;
}

th {
    background-color: var(--blue-pale);
    color: var(--blue-dark);
    text-align: left;
    padding: 12px 15px;
    font-weight: 700;
    border-bottom: 3px solid var(--accent);
}

td {
    padding: 12px 15px;
    border-bottom: 1px solid #eee;
    font-size: 0.95rem;
}

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

/* --- Forms --- */
.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}

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

.form-group label {
    font-size: 0.85rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--text-muted);
}

.form-group input, .form-group select, .form-group textarea {
    padding: 0.7rem;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 1rem;
    outline: none;
    transition: border-color 0.3s;
}

.form-group input:focus, .form-group select:focus {
    border-color: var(--secondary);
}

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

.dashboard-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: white;
    padding: 1rem 2rem;
    border-radius: var(--border-radius);
    box-shadow: 0 2px 10px rgba(0,0,0,0.03);
    margin-bottom: 1.5rem;
    flex-wrap: nowrap;
    gap: 1rem;
}

.period-selector-container {
    margin: 0;
    padding: 0;
}

.period-select {
    padding: 0.6rem 1.2rem;
    border-radius: 8px;
    border: 1.5px solid #eee;
    background: #f8f9fa;
    font-size: 0.9rem;
    font-weight: 600;
    color: #2e2d7e;
    cursor: pointer;
    outline: none;
    transition: all 0.2s;
}

.period-select:hover {
    border-color: #2e2d7e;
}

.stat-card {
    background: transparent;
    padding: 0.5rem;
    text-align: center;
    border: none;
    display: flex;
    flex-direction: column;
    align-items: center;
    min-width: 150px;
}

.stat-card .value {
    font-size: 1.4rem;
    font-weight: 700;
    color: #2e2d7e;
    margin-bottom: 0.1rem;
    white-space: nowrap;
}

.stat-card.cost .value, .stat-card .value.negative {
    color: #d60058 !important; /* El rojo/rosa de la marca */
}

.stat-card h3 {
    font-size: 0.75rem;
    color: #888;
    font-weight: 500;
    margin: 0;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.chart-container {
    background: white;
    padding: 2rem;
    border-radius: var(--border-radius);
    box-shadow: 0 4px 20px rgba(0,0,0,0.05);
    margin-top: 0;
    min-height: 500px;
}
