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

:root {
    --brand-cyan: #1AC0C4;
    --brand-purple: #47368C;
    --brand-purple-dark: #35266A;
    --primary-color: #47368C;
    --primary-dark: #35266A;
    --secondary-color: #1AC0C4;
    --danger-color: #ef4444;
    --warning-color: #f59e0b;
    --bg-color: #f4f7f8;
    --card-color: #ffffff;
    --text-color: #241f33;
    --text-muted: #5c5670;
    --border-color: #e4e1ee;
}

body {
    font-family: 'Montserrat', 'Segoe UI', sans-serif;
    font-weight: 400;
    background: var(--bg-color);
    color: var(--text-color);
}

/* Login Page */
.login-page {
    min-height: 100vh;
    background: #ffffff;
}

.login-shell {
    display: flex;
    min-height: 100vh;
}

.login-brand {
    flex: 1.15;
    background: var(--brand-purple);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 56px 40px;
    text-align: center;
}

.login-brand .brand-logo {
    width: min(280px, 78%);
    height: auto;
}

.login-brand p {
    margin-top: 36px;
    color: #ffffff;
    font-family: 'Montserrat', sans-serif;
    font-weight: 300;
    font-size: 18px;
    letter-spacing: 0.02em;
}

.login-panel {
    flex: 0.85;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px 32px;
    background: #ffffff;
    border-left: 8px solid var(--brand-cyan);
}

.login-container {
    background: white;
    width: 100%;
    max-width: 400px;
    box-shadow: none;
    padding: 8px;
}

.login-header {
    text-align: left;
    margin-bottom: 28px;
}

.login-header h1 {
    font-family: 'Comfortaa', sans-serif;
    font-weight: 700;
    font-size: 28px;
    color: var(--brand-purple);
}

.login-header p {
    margin-top: 6px;
    color: var(--text-muted);
    font-weight: 400;
}

.language-selector {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-bottom: 20px;
}

.lang-btn {
    padding: 5px 15px;
    border: 2px solid var(--border-color);
    background: transparent;
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.3s;
}

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

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

.form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: 500;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 10px;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-size: 14px;
    transition: border-color 0.3s;
}

.form-group input:focus {
    border-color: var(--primary-color);
    outline: none;
}

.btn-primary {
    width: auto;
    padding: 12px 18px;
    background: var(--brand-purple);
    color: white;
    border: none;
    border-radius: 8px;
    font-family: inherit;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.3s;
}

.login-form .btn-primary {
    width: 100%;
}

.btn-primary:hover {
    background: var(--primary-dark);
}

.error-message {
    color: var(--danger-color);
    text-align: center;
    margin-top: 15px;
    padding: 10px;
    background: #fee;
    border-radius: 8px;
}

.hidden {
    display: none;
}

/* Dashboard */
.dashboard-container {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: 250px;
    background: white;
    padding: 20px;
    box-shadow: 2px 0 5px rgba(0,0,0,0.1);
}

.sidebar h2 {
    color: var(--primary-color);
    margin-bottom: 30px;
}

.sidebar nav ul {
    list-style: none;
}

.sidebar nav ul li {
    margin-bottom: 10px;
}

.sidebar nav ul li a {
    display: block;
    padding: 10px 15px;
    color: var(--text-color);
    text-decoration: none;
    border-radius: 8px;
    transition: all 0.3s;
}

.sidebar nav ul li a:hover {
    background: var(--bg-color);
}

.sidebar nav ul li a.active {
    background: var(--primary-color);
    color: white;
}

.main-content {
    flex: 1;
    padding: 20px;
}

.top-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    background: white;
    border-radius: 12px;
    margin-bottom: 20px;
}

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

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

.card {
    background: white;
    padding: 20px;
    border-radius: 12px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
}

.card h3 {
    font-size: 14px;
    color: #6b7280;
    margin-bottom: 10px;
}

.card .value {
    font-size: 28px;
    font-weight: 700;
    color: var(--text-color);
}

/* Tables */
.table-container {
    background: white;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
    overflow-x: auto;
}

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

table th {
    text-align: left;
    padding: 12px;
    background: var(--bg-color);
    font-weight: 600;
}

table td {
    padding: 12px;
    border-bottom: 1px solid var(--border-color);
}

.status-badge {
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
}

.status-badge.pendiente { background: #fef3c7; color: #92400e; }
.status-badge.completado { background: #d1fae5; color: #065f46; }
.status-badge.cancelado { background: #fee2e2; color: #991b1b; }

/* Dashboard Styles */
.dashboard-container {
    display: flex;
    min-height: 100vh;
    background: #f5f7fa;
}

.sidebar {
    width: 250px;
    background: white;
    padding: 20px;
    box-shadow: 2px 0 5px rgba(0,0,0,0.1);
    display: flex;
    flex-direction: column;
    position: fixed;
    height: 100vh;
    overflow-y: auto;
}

.sidebar-header h2 {
    color: #47368C;
    margin: 0;
    font-size: 20px;
}

.sidebar-nav {
    flex: 1;
    margin: 30px 0;
}

.sidebar-nav ul {
    list-style: none;
    padding: 0;
}

.sidebar-nav ul li {
    margin-bottom: 5px;
}

.sidebar-nav ul li a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 15px;
    color: #4a5568;
    text-decoration: none;
    border-radius: 8px;
    transition: all 0.3s;
}

.sidebar-nav ul li a:hover {
    background: #E4F7F8;
    color: #47368C;
}

.sidebar-nav ul li a.active {
    background: #47368C;
    color: white;
}

.sidebar-nav ul li a i {
    width: 20px;
}

.sidebar-footer {
    border-top: 1px solid #e2e8f0;
    padding-top: 15px;
}

.btn-logout {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 10px 15px;
    background: none;
    border: none;
    color: #e53e3e;
    cursor: pointer;
    border-radius: 8px;
    transition: all 0.3s;
    font-size: 14px;
}

.btn-logout:hover {
    background: #fff5f5;
}

.main-content {
    flex: 1;
    margin-left: 250px;
    padding: 20px;
}

.top-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
    margin-bottom: 20px;
}

.page-title h1 {
    margin: 0;
    font-size: 24px;
    color: #1a202c;
}

.page-title p {
    margin: 5px 0 0;
    color: #718096;
}

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

.user-name {
    font-weight: 600;
    color: #2d3748;
}

.user-role {
    background: #e2e8f0;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    color: #4a5568;
}

.language-selector {
    display: flex;
    gap: 5px;
}

.lang-btn {
    padding: 4px 10px;
    border: 1px solid #e2e8f0;
    background: white;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    transition: all 0.3s;
}

.lang-btn.active {
    background: #47368C;
    color: white;
    border-color: #47368C;
}

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

.stat-card {
    background: white;
    padding: 20px;
    border-radius: 12px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
    display: flex;
    align-items: center;
    gap: 15px;
}

.stat-icon {
    width: 50px;
    height: 50px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
}

.stat-info h3 {
    margin: 0;
    font-size: 14px;
    color: #718096;
}

.stat-number {
    margin: 5px 0 0;
    font-size: 24px;
    font-weight: 700;
    color: #1a202c;
}

.stat-label {
    color: #a0aec0;
    font-size: 12px;
}

/* Activity Section */
.activity-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.btn-refresh {
    padding: 8px 16px;
    background: #47368C;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    transition: background 0.3s;
}

.btn-refresh:hover {
    background: #35266A;
}

/* Table Styles */
.table-section {
    background: white;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
}

.table-container {
    overflow-x: auto;
}

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

table th {
    text-align: left;
    padding: 12px;
    background: #f7fafc;
    font-weight: 600;
    color: #4a5568;
    border-bottom: 2px solid #e2e8f0;
}

table td {
    padding: 12px;
    border-bottom: 1px solid #e2e8f0;
}

table tr:hover {
    background: #f7fafc;
}

.status-badge {
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    text-transform: capitalize;
}

.status-badge.borrador { background: #fef3c7; color: #92400e; }
.status-badge.enviada { background: #E4F7F8; color: #3A2C78; }
.status-badge.aprobada { background: #d1fae5; color: #065f46; }
.status-badge.rechazada { background: #fee2e2; color: #991b1b; }
.status-badge.convertida { background: #e0e7ff; color: #3730a3; }
.status-badge.pendiente { background: #fef3c7; color: #92400e; }
.status-badge.en_produccion { background: #E4F7F8; color: #3A2C78; }
.status-badge.en_entrega { background: #e0e7ff; color: #3730a3; }
.status-badge.entregado { background: #d1fae5; color: #065f46; }
.status-badge.cancelado { background: #fee2e2; color: #991b1b; }
.status-badge.planeada { background: #fef3c7; color: #92400e; }
.status-badge.en_ejecucion { background: #E4F7F8; color: #3A2C78; }
.status-badge.completada { background: #d1fae5; color: #065f46; }

.btn-action {
    padding: 6px 10px;
    background: #e2e8f0;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    color: #4a5568;
    transition: all 0.3s;
    margin: 0 2px;
}

.btn-action:hover {
    background: #cbd5e0;
}

.btn-action.danger {
    color: #e53e3e;
}

.btn-action.danger:hover {
    background: #fee2e2;
}

/* Filters */
.filters-section {
    background: white;
    padding: 15px 20px;
    border-radius: 12px;
    margin-bottom: 20px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
}

.filters {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
}

.filters input,
.filters select {
    padding: 8px 12px;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    font-size: 14px;
}

.filters input:focus,
.filters select:focus {
    outline: none;
    border-color: #47368C;
}


/* Responsive */
@media (max-width: 768px) {
    .sidebar {
        width: 100%;
        height: auto;
        position: relative;
    }
    
    .main-content {
        margin-left: 0;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .filters {
        flex-direction: column;
    }
    
    .top-bar {
        flex-direction: column;
        gap: 15px;
    }
}
/* ===== Sidebar mejorado con secciones ===== */
.sidebar-section {
    margin-bottom: 20px;
}

.sidebar-section-title {
    display: block;
    padding: 8px 15px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    color: #94a3b8;
    letter-spacing: 0.5px;
}

.user-badge {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 15px;
    background: #f8fafc;
    border-radius: 8px;
    margin-bottom: 10px;
}

.user-badge i {
    font-size: 24px;
    color: #47368C;
}

.user-badge-name {
    display: block;
    font-weight: 600;
    color: #1e293b;
    font-size: 14px;
}

.user-badge-role {
    display: block;
    font-size: 11px;
    color: #64748b;
}

/* Botón solo admin - con estilo especial */
.btn-primary.btn-admin {
    background: var(--brand-purple);
}

.btn-primary.btn-admin:hover {
    background: var(--brand-purple-dark);
}

/* Identidad TeChrea: Comfortaa en títulos, Montserrat en texto, cian y púrpura */
h1, h2, .page-title h1, .login-header h1 {
    font-family: 'Comfortaa', sans-serif;
    font-weight: 700;
    color: var(--brand-purple);
}

.page-title p,
.login-header p {
    font-family: 'Montserrat', sans-serif;
    font-weight: 400;
}

.sidebar {
    width: 268px;
    background: #ffffff;
    border-right: 1px solid var(--border-color);
    box-shadow: none;
}

.sidebar::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: var(--brand-cyan);
}

.sidebar-header {
    padding: 22px 18px 6px;
}

.sidebar-header .brand-logo {
    display: block;
    width: 168px;
    max-width: 100%;
    height: auto;
    margin: 8px auto 4px;
}

.main-content {
    margin-left: 268px;
    background: var(--bg-color);
}

.sidebar-nav ul li a {
    font-weight: 500;
    color: var(--text-color);
}

.sidebar-nav ul li a:hover {
    background: #E4F7F8;
    color: var(--brand-purple);
}

.sidebar-nav ul li a.active {
    background: var(--brand-purple);
    color: #ffffff;
}

.sidebar-section-title {
    color: var(--brand-purple);
    font-family: 'Montserrat', sans-serif;
    letter-spacing: 0.08em;
}

.top-bar,
.stat-card,
.card,
.table-section,
.filters-section {
    border: 1px solid var(--border-color);
    box-shadow: none;
}

.stat-card {
    border-top: 3px solid var(--brand-cyan);
}

.page-title h1 {
    font-size: 26px;
}

table th {
    background: #E4F7F8;
    color: var(--brand-purple);
    font-weight: 600;
}

.form-group input,
.form-group select,
.form-group textarea,
.filters input,
.filters select {
    font-family: inherit;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus,
.filters input:focus,
.filters select:focus {
    border-color: var(--brand-cyan);
    outline: none;
    box-shadow: 0 0 0 3px rgba(26, 192, 196, 0.2);
}

.lang-btn.active {
    background: var(--brand-purple);
    border-color: var(--brand-purple);
    color: #ffffff;
}

.login-panel .language-selector {
    justify-content: flex-start;
    margin-bottom: 22px;
}

.user-role {
    background: #EEEAF6;
    color: var(--brand-purple);
    font-weight: 600;
}

@media (max-width: 800px) {
    .login-shell {
        flex-direction: column;
    }

    .login-brand {
        padding: 36px 24px 28px;
    }

    .login-brand .brand-logo {
        width: 180px;
    }

    .login-brand p {
        margin-top: 20px;
        font-size: 16px;
    }

    .login-panel {
        border-left: none;
        border-top: 8px solid var(--brand-cyan);
        padding: 32px 20px 48px;
    }

    .dashboard-container {
        flex-direction: column;
    }

    .sidebar {
        width: 100%;
        height: auto;
        max-height: 70vh;
        position: relative;
        flex: 0 0 auto;
    }

    .main-content {
        margin-left: 0;
        width: 100%;
    }
}