/* =====================================================================
   App Tareas — Sistema de diseño (web)
   Self-hosted, sin CDN. Capa sobre Bootstrap 5.
   Todo se controla con tokens (variables CSS) para que la identidad
   oficial (colores, tipografía, logo) sea un cambio de un solo punto.
   ===================================================================== */

:root {
    /* --- Marca --- */
    --brand-900: #1E3A8A;
    --brand-800: #1E40AF;   /* primary */
    --brand-700: #1D4ED8;
    --brand-600: #2563EB;
    --brand-500: #3B82F6;
    --brand-100: #DBEAFE;
    --brand-050: #EFF4FF;
    --accent:    #D97706;   /* ámbar, uso puntual */

    /* --- Neutros (slate) --- */
    --bg:         #F1F5F9;
    --surface:    #FFFFFF;
    --text:       #0F172A;
    --text-muted: #64748B;
    --border:     #E2E8F0;

    /* --- Estados de tarea (compartidos con la app Android) --- */
    --status-pendiente:   #64748B;
    --status-progreso:    #0EA5E9;
    --status-completada:  #16A34A;
    --status-cancelada:   #DC2626;

    /* --- Tipografía (slot intercambiable) --- */
    --font-sans: "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;

    /* --- Radios y sombras --- */
    --radius:    .625rem;
    --radius-sm: .375rem;
    --shadow-sm: 0 1px 2px rgba(16, 24, 40, .06), 0 1px 3px rgba(16, 24, 40, .08);
    --shadow-md: 0 4px 12px rgba(16, 24, 40, .10);

    /* Puentes con las variables de Bootstrap */
    --bs-primary: var(--brand-800);
    --bs-primary-rgb: 30, 64, 175;
    --bs-link-color: var(--brand-700);
    --bs-link-hover-color: var(--brand-900);
    --bs-body-font-family: var(--font-sans);
    --bs-body-color: var(--text);
}

/* ---------- Base ---------- */
body {
    background: var(--bg);
    color: var(--text);
    font-family: var(--font-sans);
    -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, h5, h6 { font-weight: 700; letter-spacing: -.01em; color: var(--text); }

a { color: var(--brand-700); }
a:hover { color: var(--brand-900); }

/* Foco visible para navegación por teclado (accesibilidad, prioridad 1) */
:focus-visible {
    outline: 2px solid var(--brand-600);
    outline-offset: 2px;
    border-radius: var(--radius-sm);
}

/* ---------- Barra de navegación ---------- */
.app-navbar {
    background: linear-gradient(90deg, var(--brand-900), var(--brand-700));
    box-shadow: var(--shadow-sm);
}
.app-navbar .navbar-brand { font-weight: 700; letter-spacing: .2px; }
.app-navbar .navbar-brand i { color: var(--brand-100); }
.app-navbar .nav-link {
    color: rgba(255, 255, 255, .78);
    border-radius: var(--radius-sm);
    padding-inline: .75rem;
    transition: background-color .15s ease, color .15s ease;
}
.app-navbar .nav-link:hover,
.app-navbar .nav-link:focus { color: #fff; background: rgba(255, 255, 255, .10); }
.app-navbar .nav-link.active { color: #fff; background: rgba(255, 255, 255, .16); font-weight: 600; }
.app-navbar .badge-role {
    background: rgba(255, 255, 255, .18) !important;
    color: #fff;
}

.app-main { padding: 1.75rem 0 3.5rem; }

/* ---------- Tarjetas ---------- */
.card {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    background: var(--surface);
}
.card:focus-within { box-shadow: var(--shadow-md); }

/* ---------- Botones ---------- */
.btn { border-radius: var(--radius-sm); font-weight: 500; transition: all .15s ease; }
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0); }

.btn-primary {
    --bs-btn-bg: var(--brand-800);
    --bs-btn-border-color: var(--brand-800);
    --bs-btn-hover-bg: var(--brand-900);
    --bs-btn-hover-border-color: var(--brand-900);
    --bs-btn-active-bg: var(--brand-900);
    --bs-btn-focus-shadow-rgb: var(--bs-primary-rgb);
}
.btn-outline-primary {
    --bs-btn-color: var(--brand-700);
    --bs-btn-border-color: var(--brand-600);
    --bs-btn-hover-bg: var(--brand-800);
    --bs-btn-hover-border-color: var(--brand-800);
}

/* ---------- Badge de rol ---------- */
.badge-role { text-transform: capitalize; font-weight: 600; }

/* ---------- Badges de estado de tarea ---------- */
.badge-status {
    display: inline-flex;
    align-items: center;
    gap: .4em;
    font-weight: 600;
    padding: .35em .7em;
    border-radius: 999px;
    color: #fff;
    font-size: .8rem;
}
.badge-status::before {
    content: "";
    width: .5em; height: .5em;
    border-radius: 50%;
    background: currentColor;
    opacity: .9;
}
.badge-status--pendiente  { background: var(--status-pendiente); }
.badge-status--en_progreso{ background: var(--status-progreso); }
.badge-status--completada { background: var(--status-completada); }
.badge-status--cancelada  { background: var(--status-cancelada); }

/* ---------- Tarjetas de estadística (dashboard) ---------- */
.stat-card {
    position: relative;
    overflow: hidden;
    border-radius: var(--radius);
}
.stat-card__accent { border-left: 4px solid var(--brand-600); }
.stat-card__accent--pendiente  { border-left-color: var(--status-pendiente); }
.stat-card__accent--en_progreso{ border-left-color: var(--status-progreso); }
.stat-card__accent--completada { border-left-color: var(--status-completada); }
.stat-card__accent--cancelada  { border-left-color: var(--status-cancelada); }
.stat-card .stat-card__icon {
    width: 2.25rem; height: 2.25rem;
    display: inline-flex; align-items: center; justify-content: center;
    border-radius: var(--radius-sm);
    background: var(--brand-050);
    color: var(--brand-700);
    font-size: 1.1rem;
}
.stat-card .stat-card__value { font-size: 1.9rem; font-weight: 700; line-height: 1.1; }
.stat-card .stat-card__label { color: var(--text-muted); font-size: .85rem; }

/* ---------- Gráficos del dashboard (SVG/CSS, sin librerías) ---------- */
.dash-donut {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    flex-wrap: wrap;
}
.dash-donut svg { flex: 0 0 auto; }
.dash-donut__num { font-size: 22px; font-weight: 700; fill: var(--text); }
.dash-donut__cap { font-size: 10px; fill: var(--text-muted); text-transform: uppercase; letter-spacing: .05em; }

.dash-legend {
    list-style: none;
    margin: 0;
    padding: 0;
    flex: 1 1 180px;
    min-width: 180px;
}
.dash-legend li {
    display: flex;
    align-items: center;
    gap: .55rem;
    padding: .3rem 0;
    font-size: .9rem;
    border-bottom: 1px solid var(--border);
}
.dash-legend li:last-child { border-bottom: 0; }
.dash-legend .dot { width: .7rem; height: .7rem; border-radius: 50%; flex: 0 0 auto; }
.dash-legend .val { margin-left: auto; font-weight: 700; }

.dash-bars { display: flex; flex-direction: column; gap: .9rem; }
.dash-bar__label { display: flex; justify-content: space-between; font-size: .875rem; margin-bottom: .3rem; }
.dash-bar__track {
    height: .6rem;
    background: var(--muted);
    border-radius: 999px;
    overflow: hidden;
}
.dash-bar__fill {
    height: 100%;
    border-radius: 999px;
    background: linear-gradient(90deg, var(--brand-700), var(--brand-500));
    transition: width .4s ease;
}

/* ---------- Pantalla de autenticación ---------- */
.auth-wrap {
    min-height: calc(100vh - 2rem);
    display: flex;
    align-items: center;
    justify-content: center;
}
.auth-brand {
    display: inline-flex; align-items: center; gap: .5rem;
    font-size: 1.5rem; font-weight: 700; color: var(--brand-800);
}
.auth-brand i { color: var(--brand-600); }
.auth-card { width: 100%; max-width: 420px; }

/* ---------- DataTables ---------- */
table.dataTable { font-size: .925rem; }
table.dataTable thead th {
    text-transform: uppercase;
    font-size: .72rem;
    letter-spacing: .04em;
    color: var(--text-muted);
    border-bottom: 2px solid var(--border);
}
table.dataTable tbody tr:hover > * { background: var(--brand-050); }
.dataTables_wrapper .dt-buttons .btn { margin-right: .25rem; }
.dataTables_wrapper .dataTables_paginate .paginate_button.current {
    background: var(--brand-800) !important;
    border-color: var(--brand-800) !important;
    color: #fff !important;
}

/* ---------- Formularios ---------- */
.form-control:focus, .form-select:focus {
    border-color: var(--brand-500);
    box-shadow: 0 0 0 .2rem rgba(var(--bs-primary-rgb), .18);
}

/* ---------- Respeta usuarios que prefieren menos movimiento ---------- */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { transition: none !important; animation: none !important; }
    .btn:hover { transform: none; }
}
