:root {
    --sidebar-w: 260px;
    --primary: #0b3d91;
    --primary-dark: #082a64;
    --primary-light: #1d5cc7;
    --accent: #00a3a3;
    --bg: #f4f6fa;
    --card: #ffffff;
    --border: #e3e7ef;
    --text: #1f2a44;
    --text-muted: #6b7280;
}

* { box-sizing: border-box; }
body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    font-size: 14px;
}

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

/* Sidebar */
.sidebar {
    width: var(--sidebar-w);
    background: linear-gradient(180deg, var(--primary-dark) 0%, var(--primary) 100%);
    color: #fff;
    display: flex;
    flex-direction: column;
    position: fixed;
    height: 100vh;
    overflow-y: auto;
}
.sidebar-brand {
    padding: 20px 18px;
    display: flex;
    align-items: center;
    gap: 12px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}
.sidebar-brand i { font-size: 28px; color: var(--accent); }
.brand-title { font-weight: 700; font-size: 17px; line-height: 1; }
.brand-sub { font-size: 11px; opacity: 0.7; margin-top: 3px; }

.sidebar-nav { flex: 1; padding: 12px 0; }
.sidebar-nav a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 18px;
    color: #c9d4ec;
    text-decoration: none;
    font-size: 13.5px;
    border-left: 3px solid transparent;
    transition: all 0.15s;
}
.sidebar-nav a i { font-size: 16px; width: 20px; }
.sidebar-nav a:hover { background: rgba(255,255,255,0.08); color: #fff; }
.sidebar-nav a.active {
    background: rgba(255,255,255,0.1);
    color: #fff;
    border-left-color: var(--accent);
    font-weight: 600;
}
.nav-section {
    padding: 14px 18px 6px;
    font-size: 10.5px;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: rgba(255,255,255,0.45);
    font-weight: 600;
}
.sidebar-foot {
    padding: 12px 18px;
    border-top: 1px solid rgba(255,255,255,0.1);
    color: rgba(255,255,255,0.5);
}

/* Main */
.main {
    margin-left: var(--sidebar-w);
    flex: 1;
    display: flex;
    flex-direction: column;
}
.topbar {
    background: #fff;
    padding: 14px 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border);
    box-shadow: 0 1px 2px rgba(0,0,0,0.03);
}
.topbar-title { font-size: 18px; font-weight: 600; color: var(--text); }
.topbar-right { display: flex; align-items: center; gap: 14px; }
.user-chip {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--bg);
    padding: 6px 12px;
    border-radius: 100px;
    font-size: 13px;
}
.user-chip i { font-size: 22px; color: var(--primary); }
.user-chip span { display: flex; flex-direction: column; line-height: 1.1; }
.user-chip small { font-size: 10.5px; color: var(--text-muted); }

.content { padding: 24px; flex: 1; }

/* Cards */
.card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.03);
}
.card-header {
    background: #fff;
    border-bottom: 1px solid var(--border);
    padding: 14px 18px;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.card-body { padding: 18px; }

/* Stat cards */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; margin-bottom: 24px; }
.stat-card {
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 18px;
    display: flex;
    gap: 14px;
    align-items: center;
}
.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    color: #fff;
    flex-shrink: 0;
}
.stat-icon.primary { background: var(--primary); }
.stat-icon.success { background: #16a34a; }
.stat-icon.warning { background: #f59e0b; }
.stat-icon.danger { background: #dc2626; }
.stat-icon.info { background: var(--accent); }
.stat-value { font-size: 24px; font-weight: 700; line-height: 1; }
.stat-label { font-size: 12px; color: var(--text-muted); margin-top: 4px; }

/* Page header */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 18px;
    flex-wrap: wrap;
    gap: 12px;
}
.page-header h1 { font-size: 22px; font-weight: 700; margin: 0; }
.page-header .subtitle { color: var(--text-muted); font-size: 13px; margin-top: 4px; }

/* Forms */
.form-section {
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 16px;
    margin-bottom: 18px;
    background: #fafbfd;
}
.form-section-title {
    font-weight: 600;
    color: var(--primary);
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border);
}
.required-mark { color: #dc2626; }

/* Login */
.login-page {
    background: linear-gradient(135deg, #0b3d91 0%, #00a3a3 100%);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}
.login-card {
    background: #fff;
    border-radius: 12px;
    padding: 36px;
    max-width: 420px;
    width: 100%;
    box-shadow: 0 20px 60px rgba(0,0,0,0.2);
}
.login-brand { text-align: center; margin-bottom: 24px; }
.login-brand i { font-size: 48px; color: var(--primary); }
.login-brand h1 { font-size: 22px; margin: 8px 0 4px; }
.login-brand p { color: var(--text-muted); font-size: 13px; margin: 0; }

/* Tabs */
.nav-tabs .nav-link.active { color: var(--primary); border-bottom-color: var(--primary); }

/* Tabla compacta */
table.dataTable { font-size: 13px; }
.table-actions { white-space: nowrap; }

/* Timeline */
.timeline { position: relative; padding-left: 24px; }
.timeline::before {
    content: '';
    position: absolute;
    left: 7px;
    top: 0;
    bottom: 0;
    width: 2px;
    background: var(--border);
}
.timeline-item { position: relative; padding-bottom: 16px; }
.timeline-item::before {
    content: '';
    position: absolute;
    left: -22px;
    top: 4px;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: var(--primary);
    border: 3px solid #fff;
    box-shadow: 0 0 0 2px var(--primary);
}
.timeline-date { font-size: 11px; color: var(--text-muted); }
.timeline-title { font-weight: 600; }

@media (max-width: 768px) {
    .sidebar { width: 70px; }
    .sidebar-brand div, .sidebar-nav a span:not(.badge), .nav-section { display: none; }
    .main { margin-left: 70px; }
}
