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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: #f1f5f9;
    color: #1e293b;
    line-height: 1.6;
}

/* Login */
.login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: linear-gradient(135deg, #0f172a, #1e293b);
}

.login-container { width: 100%; max-width: 400px; padding: 1rem; }

.login-card {
    background: #fff;
    border-radius: 12px;
    padding: 2.5rem;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}

.login-card h1 { font-size: 1.75rem; color: #0f172a; text-align: center; }
.login-subtitle { text-align: center; color: #64748b; margin-bottom: 1.5rem; font-size: 0.9rem; }

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

/* Sidebar */
.sidebar {
    width: 250px;
    background: #0f172a;
    color: #fff;
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
}

.sidebar-header { padding: 1.5rem; border-bottom: 1px solid #1e293b; }
.sidebar-header h1 { font-size: 1.25rem; font-weight: 700; }

.sidebar-nav { flex: 1; padding: 1rem 0; }

.nav-link {
    display: block;
    padding: 0.75rem 1.5rem;
    color: #94a3b8;
    text-decoration: none;
    transition: all 0.2s;
    font-size: 0.9rem;
}

.nav-link:hover { background: #1e293b; color: #fff; }
.nav-link.logout { margin-top: 2rem; color: #f87171; }
.nav-link.logout:hover { background: #7f1d1d; color: #fca5a5; }

.sidebar-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid #1e293b;
    font-size: 0.8rem;
}

.sidebar-footer span { display: block; color: #e2e8f0; }
.sidebar-footer small { color: #64748b; text-transform: capitalize; }

/* Main */
.main-content {
    flex: 1;
    margin-left: 250px;
    padding: 2rem;
}

.main-content h2 { font-size: 1.5rem; margin-bottom: 0.25rem; }
.welcome { color: #64748b; margin-bottom: 1.5rem; }

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

.stat-card {
    background: #fff;
    border-radius: 10px;
    padding: 1.5rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
    text-align: center;
}

.stat-value { display: block; font-size: 2rem; font-weight: 700; color: #0f172a; }
.stat-label { font-size: 0.85rem; color: #64748b; text-transform: uppercase; letter-spacing: 0.05em; }

/* Table */
.section { background: #fff; border-radius: 10px; padding: 1.5rem; box-shadow: 0 1px 3px rgba(0,0,0,0.08); }
.section h3 { margin-bottom: 1rem; font-size: 1.1rem; }

.table { width: 100%; border-collapse: collapse; }
.table th, .table td { padding: 0.75rem; text-align: left; border-bottom: 1px solid #e2e8f0; font-size: 0.9rem; }
.table th { font-weight: 600; color: #64748b; text-transform: uppercase; font-size: 0.75rem; letter-spacing: 0.05em; }
.table tr:hover { background: #f8fafc; }

/* Alerts */
.alert { padding: 0.75rem 1rem; border-radius: 8px; margin-bottom: 1rem; font-size: 0.9rem; }
.alert-error { background: #fef2f2; color: #b91c1c; border: 1px solid #fecaca; }
.alert-success { background: #f0fdf4; color: #15803d; border: 1px solid #bbf7d0; }

/* Forms */
.form-group { margin-bottom: 1.25rem; }
.form-group label { display: block; margin-bottom: 0.4rem; font-weight: 500; font-size: 0.9rem; color: #334155; }
.form-group input { width: 100%; padding: 0.65rem 0.75rem; border: 1px solid #cbd5e1; border-radius: 8px; font-size: 0.95rem; }
.form-group input:focus { outline: none; border-color: #6366f1; box-shadow: 0 0 0 3px rgba(99,102,241,0.15); }

/* Buttons */
.btn { display: inline-block; padding: 0.65rem 1.25rem; border: none; border-radius: 8px; cursor: pointer; font-size: 0.9rem; font-weight: 500; text-decoration: none; }
.btn-primary { background: #6366f1; color: #fff; }
.btn-primary:hover { background: #4f46e5; }
.btn-block { width: 100%; }

.text-center { text-align: center; color: #94a3b8; }

/* Module pages */
.module { background: #fff; border-radius: 10px; padding: 1.5rem; box-shadow: 0 1px 3px rgba(0,0,0,0.08); }
.module-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1rem; }
.module-header h2 { font-size: 1.25rem; margin: 0; }
.count { font-weight: 400; color: #94a3b8; font-size: 1rem; }

.filters { display: flex; gap: 0.5rem; margin-bottom: 1rem; align-items: center; flex-wrap: wrap; }
.filters input[type="text"], .filters select { padding: 0.45rem 0.65rem; border: 1px solid #cbd5e1; border-radius: 6px; font-size: 0.85rem; }
.filters input[type="text"] { width: 280px; }

.badge { background: #e2e8f0; color: #475569; padding: 0.15rem 0.5rem; border-radius: 4px; font-size: 0.75rem; font-weight: 500; text-transform: lowercase; }

.status { display: inline-block; padding: 0.15rem 0.5rem; border-radius: 4px; font-size: 0.75rem; font-weight: 600; }
.status.active { background: #dcfce7; color: #166534; }
.status.inactive { background: #fee2e2; color: #991b1b; }
.status.pendiente { background: #fef9c3; color: #854d0e; }
.status.leido { background: #dbeafe; color: #1e40af; }
.status.atendido { background: #dcfce7; color: #166534; }
.message-box { background: #f8fafc; border: 1px solid #e2e8f0; border-radius: 8px; padding: 0.75rem 1rem; white-space: pre-wrap; }
.text-truncate { max-width: 260px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.inactive td { opacity: 0.6; }

.btn-outline { background: #fff; border: 1px solid #cbd5e1; color: #334155; }
.btn-outline:hover { background: #f1f5f9; }
.btn-sm { padding: 0.35rem 0.75rem; font-size: 0.8rem; }
.btn-success { background: #16a34a; color: #fff; }
.btn-success:hover { background: #15803d; }
.btn-danger { background: #dc2626; color: #fff; }
.btn-danger:hover { background: #b91c1c; }
.btn-edit { background: #f59e0b; color: #fff; }
.btn-edit:hover { background: #d97706; }
.btn-delete { background: #991b1b; color: #fff; }
.btn-delete:hover { background: #7f1d1d; }

.actions { white-space: nowrap; }
.actions > * + * { margin-left: 0.35rem; }
.inline-form { display: inline; }

.nav-link.active { background: #1e293b; color: #fff; border-left: 3px solid #6366f1; }

.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 0 1rem; }
.form-group textarea { width: 100%; padding: 0.65rem 0.75rem; border: 1px solid #cbd5e1; border-radius: 8px; font-size: 0.95rem; font-family: inherit; resize: vertical; }
.form-group textarea:focus { outline: none; border-color: #6366f1; box-shadow: 0 0 0 3px rgba(99,102,241,0.15); }
.form-group select { width: 100%; padding: 0.65rem 0.75rem; border: 1px solid #cbd5e1; border-radius: 8px; font-size: 0.95rem; background: #fff; }
.form-group select:focus { outline: none; border-color: #6366f1; box-shadow: 0 0 0 3px rgba(99,102,241,0.15); }
.form-actions { display: flex; gap: 0.75rem; margin-top: 1.5rem; }

.pagination { display: flex; justify-content: center; align-items: center; gap: 0.75rem; margin-top: 1rem; font-size: 0.85rem; color: #64748b; }
.pagination .btn { text-decoration: none; }

.tabs { display: flex; gap: 0; border-bottom: 2px solid #e2e8f0; margin-bottom: 1.5rem; }
.tab-btn { padding: 0.65rem 1.25rem; border: none; background: transparent; color: #64748b; font-size: 0.9rem; font-weight: 500; cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -2px; transition: all 0.2s; }
.tab-btn:hover { color: #334155; }
.tab-btn.active { color: #6366f1; border-bottom-color: #6366f1; }
.tab-content { display: none; }
.tab-content.active { display: block; }
.help-text { color: #64748b; font-size: 0.85rem; margin-bottom: 0.5rem; }
.map-container { width: 100%; height: 400px; border-radius: 8px; border: 1px solid #cbd5e1; margin-top: 0.5rem; }
.map-section { margin-bottom: 1.5rem; }
.map-section .map-container { margin-top: 0; }
