/* ── Compliance Tracker — App Styles ───────────────────────────────────────── */

:root {
    --ct-sidebar-width: 240px;
    --ct-sidebar-bg: #0f172a;
    --ct-sidebar-hover: #1e293b;
    --ct-sidebar-active: #1d4ed8;
    --ct-topbar-height: 56px;
    --ct-brand-color: #60a5fa;
}

*, *::before, *::after { box-sizing: border-box; }
body { font-family: 'Inter', system-ui, -apple-system, sans-serif; background: #f8fafc; }

/* ── Layout ─────────────────────────────────────────────────────────────────── */
.ct-wrapper { display: flex; min-height: 100vh; }

/* ── Sidebar ────────────────────────────────────────────────────────────────── */
.ct-sidebar {
    width: var(--ct-sidebar-width);
    background: var(--ct-sidebar-bg);
    color: #cbd5e1;
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    position: fixed;
    top: 0; left: 0; bottom: 0;
    z-index: 1000;
    transition: transform .25s ease;
    overflow-y: auto;
}

.ct-sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid #1e293b;
}

.ct-brand {
    display: flex;
    align-items: center;
    gap: .625rem;
}
.ct-brand-icon { font-size: 1.5rem; color: var(--ct-brand-color); }
.ct-brand-name { font-size: 1rem; font-weight: 700; color: #f1f5f9; letter-spacing: -.01em; }

.ct-sidebar-user {
    display: flex;
    align-items: center;
    gap: .75rem;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid #1e293b;
}
.ct-avatar {
    width: 36px; height: 36px;
    border-radius: 50%;
    background: #2563eb;
    color: #fff;
    font-size: .75rem;
    font-weight: 700;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
}
.ct-avatar-sm {
    width: 28px; height: 28px;
    border-radius: 50%;
    background: #3b82f6;
    color: #fff;
    font-size: .65rem;
    font-weight: 700;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
}
.ct-user-name { font-size: .875rem; font-weight: 600; color: #f1f5f9; line-height: 1.2; }

/* Role badges */
.ct-role-badge {
    display: inline-block;
    padding: .15em .55em;
    border-radius: .25rem;
    font-size: .7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .04em;
}
.ct-role-admin          { background: #7c3aed22; color: #7c3aed; }  /* violeta  */
.ct-role-supervisor     { background: #d9770022; color: #d97706; }  /* naranja  */
.ct-role-gerencia       { background: #dc262622; color: #dc2626; }  /* rojo     */
.ct-role-tecnico        { background: #0284c722; color: #0284c7; }  /* azul     */
.ct-role-disenador      { background: #db277722; color: #db2777; }  /* rosa     */
.ct-role-administrativo { background: #65a30d22; color: #65a30d; }  /* verde    */
.ct-role-user           { background: #64748b22; color: #64748b; }  /* gris     */

/* Nav */
.ct-nav { list-style: none; margin: 0; padding: .5rem 0; flex: 1; }
.ct-nav-section {
    padding: .75rem 1.25rem .25rem;
    font-size: .65rem;
    font-weight: 700;
    letter-spacing: .1em;
    color: #475569;
    text-transform: uppercase;
}
.ct-nav-link {
    display: flex;
    align-items: center;
    gap: .75rem;
    padding: .625rem 1.25rem;
    color: #94a3b8;
    text-decoration: none;
    font-size: .875rem;
    border-radius: 0;
    transition: background .15s, color .15s;
    cursor: pointer;
}
.ct-nav-link:hover { background: var(--ct-sidebar-hover); color: #f1f5f9; }
.ct-nav-link.active { background: var(--ct-sidebar-active); color: #fff; font-weight: 600; }
.ct-nav-link i { font-size: 1rem; width: 1.25rem; text-align: center; }

.ct-sidebar-footer {
    padding: .75rem;
    border-top: 1px solid #1e293b;
}
.ct-sidebar-footer .ct-nav-link { border-radius: .375rem; }

/* Mobile sidebar toggle */
.ct-sidebar-toggle {
    background: none; border: none;
    color: #94a3b8; cursor: pointer;
    padding: .25rem;
    font-size: 1rem;
    display: none;
}
@media (max-width: 991.98px) {
    .ct-sidebar-toggle { display: flex; align-items: center; }
    .ct-sidebar { transform: translateX(-100%); }
    .ct-sidebar.open { transform: translateX(0); }
    .ct-main { margin-left: 0 !important; }
}

/* Overlay */
.ct-overlay {
    display: none;
    position: fixed; inset: 0;
    background: rgba(0,0,0,.5);
    z-index: 999;
}
.ct-overlay.show { display: block; }

/* ── Main ───────────────────────────────────────────────────────────────────── */
.ct-main {
    flex: 1;
    margin-left: var(--ct-sidebar-width);
    display: flex;
    flex-direction: column;
    min-width: 0;
}

/* ── Topbar ─────────────────────────────────────────────────────────────────── */
.ct-topbar {
    height: var(--ct-topbar-height);
    background: #fff;
    border-bottom: 1px solid #e2e8f0;
    display: flex;
    align-items: center;
    padding: 0 1.5rem;
    gap: 1rem;
    position: sticky; top: 0; z-index: 100;
}
.ct-page-title {
    font-size: 1.125rem;
    font-weight: 700;
    color: #0f172a;
    margin: 0;
    flex: 1;
}
.ct-topbar-actions { display: flex; align-items: center; gap: .5rem; }

/* ── Content ────────────────────────────────────────────────────────────────── */
.ct-content { flex: 1; }
.ct-alerts { }

/* ── Cards ──────────────────────────────────────────────────────────────────── */
.card { border: 1px solid #e2e8f0; border-radius: .5rem; box-shadow: 0 1px 3px rgba(0,0,0,.04); }
.card-header { background: #f8fafc; border-bottom: 1px solid #e2e8f0; padding: .875rem 1.25rem; font-size: .9rem; }

/* ── Detail items ───────────────────────────────────────────────────────────── */
.ct-detail-item { display: flex; flex-direction: column; gap: .2rem; }
.ct-detail-label { font-size: .7rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: #94a3b8; }

/* ── Timeline (audit log) ───────────────────────────────────────────────────── */
.ct-timeline { padding: 1rem; display: flex; flex-direction: column; gap: 0; }
.ct-timeline-item {
    display: flex;
    gap: .75rem;
    padding-bottom: 1.25rem;
    position: relative;
}
.ct-timeline-item:not(:last-child)::before {
    content: '';
    position: absolute;
    left: 7px; top: 18px; bottom: 0;
    width: 2px;
    background: #e2e8f0;
}
.ct-timeline-dot {
    width: 16px; height: 16px;
    border-radius: 50%;
    flex-shrink: 0;
    margin-top: 2px;
}
.ct-timeline-content { flex: 1; min-width: 0; }

/* ── Login page ─────────────────────────────────────────────────────────────── */
.ct-login-body {
    min-height: 100vh;
    background: linear-gradient(135deg, #0f172a 0%, #1e3a5f 100%);
    display: flex; align-items: center; justify-content: center;
    padding: 2rem 1rem;
}
.ct-login-container { width: 100%; max-width: 420px; }
.ct-login-card {
    background: #fff;
    border-radius: .75rem;
    box-shadow: 0 25px 50px rgba(0,0,0,.3);
    overflow: hidden;
}
.ct-login-header {
    background: #0f172a;
    padding: 2rem 2rem 1.5rem;
    text-align: center;
}
.ct-login-brand {
    display: flex; align-items: center; justify-content: center;
    gap: .625rem;
    color: #f1f5f9;
    font-size: 1.25rem;
    font-weight: 700;
}
.ct-login-brand i { color: #60a5fa; font-size: 1.5rem; }
.ct-login-subtitle { color: #64748b; font-size: .85rem; margin: .5rem 0 0; }
.ct-login-body-inner { padding: 1.75rem 2rem; }
.ct-login-demo {
    padding: 1rem 2rem 1.5rem;
    background: #f8fafc;
    border-top: 1px solid #e2e8f0;
}
.ct-demo-creds {
    display: flex; flex-direction: column; gap: .2rem;
    font-size: .8rem; color: #475569;
}

/* ── Badges ─────────────────────────────────────────────────────────────────── */
.badge { font-weight: 600; }

/* ── Tables ─────────────────────────────────────────────────────────────────── */
.table > :not(caption) > * > * { padding: .75rem 1rem; }
.table-hover tbody tr:hover { background-color: #f8fafc; }

/* ── Print ─────────────────────────────────────────────────────────────────── */
@media print {
    .ct-sidebar, .ct-overlay, .ct-topbar,
    .ct-alerts, .btn, button, form,
    .no-print { display: none !important; }
    .ct-wrapper { display: block !important; }
    .ct-main { margin-left: 0 !important; }
    .ct-content { padding: 0 !important; }
    body { background: #fff; font-size: 10px; }
    .card { box-shadow: none; border: 1px solid #ddd; break-inside: avoid; margin-bottom: .4rem !important; }
    .card-body { padding: .35rem .5rem !important; }
    .card-header { padding: .25rem .5rem !important; font-size: .75rem; }
    .table { font-size: 9px; margin-bottom: 0 !important; }
    .table th, .table td { padding: .2rem .3rem !important; }
    .badge { border: 1px solid #999; font-size: .6rem !important; }
    .progress { border: 1px solid #ccc; }
    .row { margin-left: -4px !important; margin-right: -4px !important; }
    .col, .col-md-4, .col-md-3, .col-md-2, .col-md-1 { padding-left: 4px !important; padding-right: 4px !important; }
    .shadow-sm { box-shadow: none !important; }
    @page { margin: .6cm; size: landscape; }
}
