/* Reset y variables */
:root {
    --bg-dark: #0f172a;
    --bg-card: #1e293b;
    --bg-sidebar: #1e293b;
    --border: #334155;
    --text: #f8fafc;
    --text-muted: #94a3b8;
    --primary: #3b82f6;
    --danger: #ef4444;
    --sidebar-width: 260px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--bg-dark);
    color: var(--text);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Header */
.top-header {
    height: 60px;
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1.5rem;
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.sidebar-toggle {
    background: none;
    border: none;
    color: var(--text);
    font-size: 1.4rem;
    cursor: pointer;
    display: none;
}

.brand {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.brand-name {
    font-weight: 700;
    font-size: 1.15rem;
}

.project-badge {
    background: var(--primary);
    color: white;
    font-size: 0.75rem;
    padding: 0.2rem 0.6rem;
    border-radius: 999px;
    font-weight: 600;
}

.header-right {
    display: flex;
    align-items: center;
}

.user-menu {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.username {
    color: var(--text-muted);
    font-size: 0.95rem;
}

.btn-logout {
    color: var(--danger);
    text-decoration: none;
    font-size: 0.9rem;
}

.btn-logout:hover {
    text-decoration: underline;
}

/* Sidebar */
.sidebar {
    width: var(--sidebar-width);
    background: var(--bg-sidebar);
    border-right: 1px solid var(--border);
    position: fixed;
    top: 60px;
    left: 0;
    bottom: 0;
    overflow-y: auto;
    z-index: 90;
    transition: transform 0.25s ease;
}

.sidebar-nav ul {
    list-style: none;
    padding: 1rem 0;
}

.sidebar-nav li a {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    padding: 0.85rem 1.5rem;
    color: var(--text-muted);
    text-decoration: none;
    transition: all 0.15s ease;
}

.sidebar-nav li a:hover {
    background: rgba(59, 130, 246, 0.1);
    color: var(--text);
}

.sidebar-nav li.active a {
    background: rgba(59, 130, 246, 0.15);
    color: var(--primary);
    border-right: 3px solid var(--primary);
}

.sidebar-nav .icon {
    font-size: 1.2rem;
}

/* Contenido principal */
.main-content {
    margin-left: var(--sidebar-width);
    padding: 2rem;
    flex: 1;
}

.page-header {
    margin-bottom: 1.75rem;
}

.page-header h1 {
    font-size: 1.6rem;
    font-weight: 600;
}

.content-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 1.75rem;
}

/* Footer */
.main-footer {
    margin-left: var(--sidebar-width);
    padding: 1.25rem 2rem;
    border-top: 1px solid var(--border);
    color: var(--text-muted);
    font-size: 0.85rem;
    text-align: center;
}

/* Responsive */
@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .sidebar-toggle {
        display: block;
    }

    .main-content,
    .main-footer {
        margin-left: 0;
    }
}

/* ===== Página header ===== */
.page-header-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    margin-bottom: 0.35rem;
}

.page-subtitle {
    color: var(--text-muted);
    font-size: 0.95rem;
}

/* ===== Alertas ===== */
.alert {
    padding: 0.9rem 1.2rem;
    border-radius: 8px;
    margin-bottom: 1.5rem;
    font-size: 0.95rem;
}

.alert-error {
    background: #7f1d1d;
    color: #fecaca;
    border: 1px solid #991b1b;
}

/* ===== Tabla ===== */
.table-responsive {
    overflow-x: auto;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.925rem;
}

.data-table th,
.data-table td {
    padding: 0.85rem 1rem;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

.data-table th {
    background: rgba(15, 23, 42, 0.5);
    color: var(--text-muted);
    font-weight: 600;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.data-table tbody tr:hover {
    background: rgba(59, 130, 246, 0.05);
}

.data-table .actions {
    display: flex;
    gap: 0.5rem;
    white-space: nowrap;
}

/* ===== Badges ===== */
.badge {
    display: inline-block;
    padding: 0.2rem 0.55rem;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 600;
}

.badge-plan {
    background: rgba(59, 130, 246, 0.15);
    color: #93c5fd;
}

.badge-success {
    background: rgba(34, 197, 94, 0.15);
    color: #86efac;
}

.badge-warning {
    background: rgba(234, 179, 8, 0.15);
    color: #fde047;
}

.badge-danger {
    background: rgba(239, 68, 68, 0.15);
    color: #fca5a5;
}

.badge-secondary {
    background: rgba(148, 163, 184, 0.15);
    color: #cbd5e1;
}

/* ===== Botones pequeños ===== */
.btn-sm {
    display: inline-block;
    padding: 0.3rem 0.65rem;
    font-size: 0.8rem;
    border-radius: 6px;
    text-decoration: none;
    font-weight: 500;
    transition: all 0.15s ease;
}

.btn-outline {
    border: 1px solid var(--border);
    color: var(--text-muted);
    background: transparent;
}

.btn-outline:hover {
    border-color: var(--primary);
    color: var(--primary);
}

/* ===== Empty state ===== */
.empty-state {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--text-muted);
}