/* =========================================================
   Control Público — Estética AGC
   app.css
   ---------------------------------------------------------
   Estructura:
   01) Reset / Base
   02) Variables (Light/Dark)
   03) Layout (container/wrap)
   04) Header (único)
   05) Breadcrumb / Nav bar
   06) Cards
   07) Botones
   08) Formularios / Inputs
   09) Alertas
   10) Tablas
   11) Utilidades
   12) Header extra (navx + user)
   13) Notificaciones (campana + dropdown)
   14) Tareas en Tarjetas (Área)
   15) OVERRIDES / FIX (anti-desamarre)
   ========================================================= */


/* =========================
   01) RESET / BASE
   ========================= */
* {
    box-sizing: border-box;
}

html,
body {
    height: 100%;
}

body {
    margin: 0;
    font-family: var(--font-body);
    background: var(--bg);
    color: var(--text-primary);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}


/* =========================
   02) VARIABLES (Tema)
   ========================= */
:root {
    /* Paleta vino */
    --wine-900: #3D1A1E;
    --wine-800: #5C2328;
    --wine-700: #7A2E35;
    --wine-600: #983A42;
    --wine-500: #B54A54;
    --wine-400: #C97179;
    --wine-200: #EECDD0;
    --wine-50: #FDF7F7;

    /* Neutros */
    --slate-900: #111827;
    --slate-800: #1F2937;
    --slate-700: #374151;
    --slate-600: #4B5563;
    --slate-500: #6B7280;
    --slate-300: #D1D5DB;
    --slate-200: #E5E7EB;
    --slate-100: #F3F4F6;

    /* Tipografía */
    --font-body: system-ui, -apple-system, Segoe UI, Roboto, Ubuntu, Cantarell, "Helvetica Neue", Arial;
    --font-display: var(--font-body);

    /* Radios / anim */
    --radius-sm: 10px;
    --radius-md: 14px;
    --radius-lg: 18px;

    --duration-fast: 120ms;
    --duration-normal: 180ms;
    --ease-out: cubic-bezier(.2, .8, .2, 1);

    /* Semánticos (para consistencia) */
    --ok: #0f766e;
    --warn: #b45309;
    --err: #b91c1c;

    /* Light (más legible) */
    --bg: linear-gradient(180deg, #fbfbfd, #f3f4f7);
    --bg-surface: rgba(255, 255, 255, .88);
    --bg-surface-2: rgba(255, 255, 255, .96);

    --text-primary: #0f172a;
    --text-muted: rgba(15, 23, 42, .66);

    --border-default: rgba(15, 23, 42, .12);
    --border-hover: rgba(181, 74, 84, .30);

    --accent: var(--wine-600);
    --accent-hover: var(--wine-700);

    --shadow-sm: 0 8px 18px rgba(2, 6, 23, .08);
    --shadow-lg: 0 18px 55px rgba(2, 6, 23, .14);

    /* Header */
    --header-bg: linear-gradient(135deg, var(--wine-900), var(--wine-700));

    /* Focus ring (contraste constante) */
    --ring: 0 0 0 4px rgba(152, 58, 66, .18);
}

/* root: end
// Dark mode (más contraste real, menos “gris lavado”) */

html[data-theme="dark"] {
    --bg: linear-gradient(180deg, #070a12, #070a10);
    --bg-surface: rgba(18, 22, 40, .84);
    --bg-surface-2: rgba(18, 22, 40, .94);

    --text-primary: rgba(255, 255, 255, .94);
    --text-muted: rgba(255, 255, 255, .68);

    --border-default: rgba(255, 255, 255, .12);
    --border-hover: rgba(201, 113, 121, .40);

    --shadow-sm: 0 12px 26px rgba(0, 0, 0, .34);
    --shadow-lg: 0 22px 70px rgba(0, 0, 0, .55);

    --header-bg: linear-gradient(135deg, #13070a, #4b1e24);

    --ring: 0 0 0 4px rgba(201, 113, 121, .22);
}

/* ===== Calidad UI: focus visible + selección ===== */
:where(a, button, input, select, textarea, .btn, .inp, .input):focus-visible {
    outline: none;
    box-shadow: var(--ring);
    border-color: rgba(181, 74, 84, .55);
}

::selection {
    background: rgba(181, 74, 84, .22);
}

/* Superficies: micro brillo + borde consistente */
.card,
.task-card,
.tbl,
.nav-bar,
.user-dropdown,
.notif-drop {
    backdrop-filter: blur(10px);
}

/* Inputs un poquito más “premium” */
.inp,
.input,
select,
textarea {
    box-shadow: 0 1px 0 rgba(255, 255, 255, .35) inset;
}

html[data-theme="dark"] .inp,
html[data-theme="dark"] .input,
html[data-theme="dark"] select,
html[data-theme="dark"] textarea {
    box-shadow: 0 1px 0 rgba(255, 255, 255, .08) inset;
}

/* =========================
   FIX CONTRASTE: OBJETIVOS (tabla + filas) en DARK/LIGHT
   ========================= */

/* Contenedor del bloque (tu .card ya está ok, esto refuerza) */
.card .tbl {
    background: var(--bg-surface);
}

/* Filas objetivo (reemplaza hardcode #f8fafc / #e2e8f0) */
.tbl .fila-objetivo {
    background: transparent;
}

.tbl .fila-objetivo td {
    background: transparent;
}

.tbl .fila-objetivo:hover td {
    background: rgba(181, 74, 84, .06);
}

/* Bloques “secundarios” (progreso / pasos) que hoy tienen rgba(0,0,0,.02) */
.tbl .fila-progreso td,
.tbl .fila-pasos td {
    background: rgba(181, 74, 84, .04);
}

/* Separadores más visibles en dark */
html[data-theme="dark"] .tbl td,
html[data-theme="dark"] .tbl thead th {
    border-color: rgba(255, 255, 255, .12);
}

/* En dark: hover un poquito más marcado */
html[data-theme="dark"] .tbl .fila-objetivo:hover td {
    background: rgba(201, 113, 121, .12);
}

html[data-theme="dark"] .tbl .fila-progreso td,
html[data-theme="dark"] .tbl .fila-pasos td {
    background: rgba(201, 113, 121, .08);
}

/* Forzar fondo de filas (pisar hardcodes viejos) */
.tbl tr.fila-pasos td {
    background: rgba(181, 74, 84, .04) !important;
}

html[data-theme="dark"] .tbl tr.fila-pasos td {
    background: rgba(255, 255, 255, .06) !important;
}

.tbl tr.fila-progreso td {
    background: rgba(181, 74, 84, .04) !important;
}

html[data-theme="dark"] .tbl tr.fila-progreso td {
    background: rgba(255, 255, 255, .06) !important;
}

html[data-theme="dark"] .notif-menu .notif-item:hover {
    background: rgba(201, 113, 121, .12);
}

html[data-theme="dark"] .notif-menu .notif-item.unread {
    background: rgba(201, 113, 121, .16);
}

html[data-theme="dark"] .notif-menu .notif-all {
    background: rgba(255, 255, 255, .03);
}

/* ================= MODAL (Light/Dark) ================= */


.prog {
    position: relative;
    height: 10px;
    border-radius: 999px;
    background: rgba(0, 0, 0, .10);
    overflow: hidden;
}

.prog-bar {
    height: 100%;
    border-radius: 999px;
    background: rgba(20, 160, 90, .85);
    transition: width .35s ease;
}

html[data-theme="dark"] .tbl tr.fila-objetivo:hover td {
    background: rgba(201, 113, 121, .12);
}

html[data-theme="dark"] .tbl tr.fila-progreso td,
html[data-theme="dark"] .tbl tr.fila-pasos td {
    background: rgba(201, 113, 121, .08);
}

html[data-theme="dark"] .prog {
    background: rgba(255, 255, 255, .10);
}

/* Respeta reduce motion */
@media (prefers-reduced-motion: reduce) {
    * {
        transition: none !important;
        animation: none !important;
    }
}

/* =========================
   03) LAYOUT (contenedores)
   ========================= */
/* Contenedor principal (ancho de toda la app) */
.container {
    max-width: 1600px;
    margin: 0 auto;
    padding: 1.2rem 1.5rem 2rem;
}

/* wrap: compat con vistas viejas
   - IMPORTANTE: antes lo tenías en 1100px y rompía el layout.
   - Lo alineamos a container para que NO desamarre.
*/
.wrap {
    max-width: 1600px;
    margin: 0 auto;
    padding: 1.2rem 1.5rem 2rem;
}


/* =========================
   04) HEADER (ÚNICO)
   ========================= */
.header {
    background: var(--header-bg);
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: var(--shadow-lg);
}

.header-inner {
    max-width: 1600px;
    margin: 0 auto;
    padding: .55rem 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.header-title {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.header-title h1 {
    margin: 0;
    font-family: var(--font-display);
    font-size: .95rem;
    font-weight: 600;
    color: #fff;
    letter-spacing: -.01em;
    line-height: 1.2;
}

.header-title span {
    font-size: .65rem;
    color: rgba(255, 255, 255, .70);
    font-weight: 500;
    letter-spacing: .5px;
    text-transform: uppercase;
}

/* Acciones del header (botones, nav, usuario, etc.) */
.header-actions {
    display: flex;
    align-items: center;
    gap: .5rem;
}

/* Usuario (pill) */
.user-pill {
    display: flex;
    align-items: center;
    gap: .6rem;
    padding: .35rem .6rem;
    border-radius: 999px;
    background: rgba(255, 255, 255, .10);
    border: 1px solid rgba(255, 255, 255, .15);
    backdrop-filter: blur(8px);
    color: #fff;
    font-size: .8rem;
}

.user-dot {
    width: 26px;
    height: 26px;
    border-radius: 999px;
    display: grid;
    place-items: center;
    font-weight: 700;
    background: rgba(255, 255, 255, .18);
}

/* Toggle tema */
.theme-toggle {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    border: 1px solid rgba(255, 255, 255, .15);
    background: rgba(255, 255, 255, .08);
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--duration-fast) var(--ease-out);
    backdrop-filter: blur(8px);
}

.theme-toggle:hover {
    background: rgba(255, 255, 255, .15);
    transform: rotate(12deg);
}

/* Responsive header */
@media (max-width: 980px) {
    .header-inner {
        flex-wrap: wrap;
        align-items: stretch;
    }

    .header-actions {
        width: 100%;
        justify-content: flex-start;
        flex-wrap: wrap;
    }
}


/* =========================
   05) NAV BAR / BREADCRUMB
   ========================= */
.nav-bar {
    background: var(--bg-surface);
    border-bottom: 1px solid var(--border-default);
    padding: .55rem 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.nav-breadcrumb {
    display: flex;
    align-items: center;
    gap: .4rem;
    font-size: .82rem;
    color: var(--text-muted);
}

.nav-breadcrumb a {
    color: var(--accent);
    text-decoration: none;
    font-weight: 600;
}

.nav-breadcrumb a:hover {
    color: var(--accent-hover);
}

.nav-breadcrumb .sep {
    color: var(--border-default);
}

.nav-actions {
    display: flex;
    gap: .5rem;
}


/* =========================
   06) CARDS
   ========================= */
.cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: .875rem;
}

.card {
    background: var(--bg-surface);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
    transition: all var(--duration-normal) var(--ease-out);
}

.card:hover {
    border-color: var(--border-hover);
    box-shadow: var(--shadow-lg);
    transform: translateY(-2px);
}

.card-header {
    padding: 1rem 1rem .7rem 1rem;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: .8rem;
}

.card-title {
    margin: 0;
    font-weight: 800;
    font-size: .95rem;
    letter-spacing: -.01em;
}

.card-sub {
    margin: .2rem 0 0 0;
    color: var(--text-muted);
    font-size: .82rem;
}

.card-body {
    padding: 0 1rem 1rem 1rem;
}

.section-title {
    font-family: var(--font-display);
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: .4rem;
    margin: 0 0 .8rem 0;
}


/* =========================
   07) BOTONES
   ========================= */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .45rem;
    padding: .45rem .9rem;
    border-radius: var(--radius-md);
    font-size: .82rem;
    font-weight: 700;
    text-decoration: none;
    border: 1px solid var(--border-default);
    background: var(--bg-surface-2);
    color: var(--text-primary);
    cursor: pointer;
    transition: all var(--duration-fast) var(--ease-out);
}

.btn:hover {
    border-color: var(--border-hover);
    transform: translateY(-1px);
}

.btn:active {
    transform: translateY(0);
}

.btn.primary {
    background: linear-gradient(135deg, var(--wine-700), var(--wine-600));
    color: #fff;
    border-color: rgba(255, 255, 255, .15);
}

.btn.ghost {
    background: transparent;
    box-shadow: none;
}

.btn.danger {
    background: rgba(185, 28, 28, .10);
    border-color: rgba(185, 28, 28, .25);
    color: #b91c1c;
}


/* =========================
   08) FORMULARIOS / INPUTS
   ========================= */
label {
    display: block;
    font-size: .78rem;
    font-weight: 800;
    color: var(--text-muted);
    margin: 0 0 .35rem 0;
    letter-spacing: .2px;
}

.inp,
select,
textarea {
    width: 100%;
    padding: .68rem .75rem;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-default);
    background: var(--bg-surface-2);
    color: var(--text-primary);
    outline: none;
    transition: all var(--duration-fast) var(--ease-out);
}

.inp:focus,
select:focus,
textarea:focus {
    border-color: rgba(181, 74, 84, .45);
    box-shadow: 0 0 0 4px rgba(181, 74, 84, .16);
}

.formgrid {
    display: grid;
    gap: .75rem;
}

.formgrid.cols2 {
    grid-template-columns: 1fr 1fr;
}

@media (max-width:980px) {
    .formgrid.cols2 {
        grid-template-columns: 1fr;
    }
}


/* =========================
   09) ALERTAS
   ========================= */
.alert {
    border-radius: var(--radius-md);
    padding: .65rem .75rem;
    border: 1px solid var(--border-default);
    background: var(--bg-surface-2);
    font-weight: 800;
    font-size: .85rem;
}

.alert.err {
    border-color: rgba(185, 28, 28, .28);
    background: rgba(185, 28, 28, .10);
    color: #b91c1c;
}

.alert.ok {
    border-color: rgba(15, 118, 110, .28);
    background: rgba(15, 118, 110, .10);
    color: #0f766e;
}

.alert.warn {
    border-color: rgba(180, 83, 9, .28);
    background: rgba(180, 83, 9, .10);
    color: #b45309;
}


/* =========================
   10) TABLAS
   ========================= */
.tbl {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    background: var(--bg-surface);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-lg);
    overflow: hidden;
}

.tbl thead th {
    text-align: left;
    font-size: .72rem;
    letter-spacing: .45px;
    text-transform: uppercase;
    padding: .75rem .75rem;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border-default);
    background: linear-gradient(180deg, var(--bg-surface-2), transparent);
}

.tbl td {
    padding: .75rem .75rem;
    border-bottom: 1px solid var(--border-default);
    font-size: .88rem;
}

.tbl tbody tr:hover td {
    background: rgba(181, 74, 84, .06);
}

.tbl tr:last-child td {
    border-bottom: 0;
}


/* =========================
   11) UTILIDADES
   ========================= */
.m0 {
    margin: 0;
}

.mb0 {
    margin-bottom: 0;
}

.mt8 {
    margin-top: .5rem;
}

.mt12 {
    margin-top: .75rem;
}

.mt16 {
    margin-top: 1rem;
}

.small {
    font-size: .82rem;
}

.muted {
    color: var(--text-muted);
}

.center {
    min-height: calc(100vh - 120px);
    display: grid;
    place-items: center;
    padding: 1rem;
}

.login-card {
    width: min(460px, 94vw);
}

.footer {
    padding: 1.25rem 0 2rem;
    text-align: center;
    color: var(--text-muted);
    font-size: .78rem;
}


/* =========================
   12) HEADER EXTRA (navx + usuario)
   - Este bloque es para links del header tipo navx-link
   ========================= */
.navx {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.navx-link,
.navx a {
    padding: 8px 10px;
    border-radius: 10px;
    text-decoration: none;
    display: inline-flex;
    gap: 8px;
    align-items: center;
    color: #fff;
    background: rgba(255, 255, 255, .08);
    border: 1px solid rgba(255, 255, 255, .12);
    backdrop-filter: blur(8px);
    transition: all var(--duration-fast) var(--ease-out);
}

.navx-link:hover,
.navx a:hover {
    background: rgba(255, 255, 255, .14);
    transform: translateY(-1px);
}

.user-name {
    max-width: 180px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.user-role {
    opacity: .8;
    font-weight: 700;
}

.btn.btn-logout {
    background: rgba(255, 255, 255, .10);
    border: 1px solid rgba(255, 255, 255, .18);
    color: #fff;
    font-weight: 800;
}

.btn.btn-logout:hover {
    background: rgba(255, 255, 255, .16);
    border-color: rgba(255, 255, 255, .26);
}


/* ===== Notificaciones (campana) ===== */
.notif-wrap {
    position: relative;
    display: inline-flex;
    align-items: center;
}

.icon-btn {
    position: relative;
    border: 1px solid rgba(255, 255, 255, .15);
    background: rgba(255, 255, 255, .08);
    color: #fff;
    border-radius: 999px;
    height: 34px;
    width: 34px;
    display: grid;
    place-items: center;
    cursor: pointer;
}

.notif-badge {
    position: absolute;
    top: -6px;
    right: -6px;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    border-radius: 999px;
    background: #ef4444;
    color: #fff;
    font-size: 12px;
    font-weight: 800;
    display: grid;
    place-items: center;
    border: 2px solid rgba(0, 0, 0, .15);
}

.notif-menu {
    position: absolute;
    right: 0;
    top: 44px;
    width: min(360px, 92vw);
    background: rgba(255, 255, 255, .96);
    border: 1px solid rgba(18, 24, 38, .12);
    border-radius: 14px;
    box-shadow: 0 18px 55px rgba(0, 0, 0, .22);
    overflow: hidden;
    z-index: 9999;
}



.notif-head {
    padding: 10px 12px;
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 10px;
    border-bottom: 1px solid rgba(18, 24, 38, .10);
}


.notif-title {
    font-weight: 900;
    font-size: .9rem;
}

.notif-sub {
    font-size: .75rem;
    opacity: .75;
}

.notif-list {
    max-height: 320px;
    overflow: auto;
}

.notif-item {
    padding: 10px 12px;
    border-bottom: 1px solid rgba(18, 24, 38, .08);
}



.notif-item.unread {
    background: rgba(152, 58, 66, .10);
}

.notif-msg {
    font-size: .85rem;
    font-weight: 700;
}

.notif-meta {
    margin-top: 4px;
    font-size: .72rem;
    opacity: .7;
    display: flex;
    gap: 8px;
}

.notif-type {
    padding: 1px 8px;
    border-radius: 999px;
    background: rgba(152, 58, 66, .10);
}

.notif-empty {
    padding: 14px 12px;
    text-align: center;
    opacity: .8;
}

/* Botón: usamos reset fuerte para que button no herede */
.notif-btn {
    all: unset;
    width: 36px;
    height: 36px;
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, .15);
    background: rgba(255, 255, 255, .10);
    backdrop-filter: blur(8px);
    color: #fff;
    cursor: pointer;
    display: grid;
    place-items: center;
    position: relative;
    transition: all var(--duration-fast) var(--ease-out);
}

.notif-btn:hover {
    background: rgba(255, 255, 255, .18);
    transform: translateY(-1px);
}

.notif-badge {
    position: absolute;
    top: -6px;
    right: -6px;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    border-radius: 999px;
    background: #dc2626;
    color: #fff;
    font-size: 10px;
    font-weight: 800;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    box-shadow: 0 0 0 2px var(--header-bg);
}

/* Dropdown */
.notif-drop {
    position: absolute;
    right: 0;
    top: calc(100% + 10px);
    width: 340px;
    max-height: 420px;
    overflow-y: auto;

    background: var(--bg-surface-2);
    border: 1px solid var(--border-default);
    border-radius: 14px;
    box-shadow: var(--shadow-lg);

    display: none;
    z-index: 99999;
}

.notif-drop.active {
    display: block;
}

.notif-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: .75rem .85rem;
    border-bottom: 1px solid var(--border-default);
    font-weight: 800;
}

.notif-item {
    display: block;
    padding: .7rem .85rem;
    border-bottom: 1px solid var(--border-default);
    text-decoration: none;
    color: inherit;
    transition: background var(--duration-fast);
}

.notif-item:last-child {
    border-bottom: none;
}

.notif-item:hover {
    background: rgba(181, 74, 84, .06);
}

.notif-item.unread {
    background: rgba(181, 74, 84, .10);
}

.notif-msg {
    font-weight: 800;
    font-size: .86rem;
}

.notif-time {
    font-size: .72rem;
    margin-top: .15rem;
    opacity: .75;
}

.notif-empty {
    padding: 1rem .85rem;
    text-align: center;
    font-size: .85rem;
    color: var(--text-muted);
}

.notif-all {
    display: block;
    text-align: center;
    padding: .65rem .85rem;
    text-decoration: none;
    font-weight: 900;
    color: var(--accent);
    background: rgba(0, 0, 0, .02);
    border-top: 1px solid var(--border-default);
}

.notif-all:hover {
    background: rgba(181, 74, 84, .06);
}


/* =========================
   14) TAREAS EN TARJETAS (Área)
   ========================= */
/* OVERRIDE fuerte: tareas en tarjetas SI O SI */
.task-grid {
    display: grid !important;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)) !important;
    gap: 12px !important;
    margin: 12px 0 18px !important;
}

.task-card {
    display: block !important;
    background: var(--bg-surface) !important;
    border: 1px solid var(--border-default) !important;
    border-radius: var(--radius-lg) !important;
    box-shadow: var(--shadow-sm) !important;
    padding: 14px !important;
}

.task-card:hover {
    border-color: var(--border-hover);
    box-shadow: var(--shadow-lg);
    transform: translateY(-2px);
}

.task-top {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: .75rem;
    margin-bottom: .85rem;
}

.task-title {
    min-width: 0;
}

.task-link {
    font-weight: 900;
    font-size: .95rem;
    letter-spacing: -.01em;
    color: var(--text-primary);
    text-decoration: none;
}

.task-link:hover {
    color: var(--accent);
    text-decoration: underline;
}

.task-sub {
    margin-top: .35rem;
}

.task-pill {
    display: inline-flex;
    align-items: center;
    padding: .22rem .5rem;
    border-radius: 999px;
    font-size: .70rem;
    font-weight: 900;
    letter-spacing: .4px;
    text-transform: uppercase;
    border: 1px solid var(--border-default);
    background: var(--bg-surface-2);
}

.task-pill.prog {
    border-color: rgba(181, 74, 84, .28);
    background: rgba(181, 74, 84, .10);
    color: var(--accent);
}

.task-pill.ok {
    border-color: rgba(15, 118, 110, .28);
    background: rgba(15, 118, 110, .10);
    color: #0f766e;
}

.task-pill.muted {
    border-color: rgba(18, 24, 38, .12);
    background: rgba(18, 24, 38, .06);
    color: var(--text-muted);
}

.task-assignee {
    display: flex;
    align-items: center;
    gap: .5rem;
    max-width: 46%;
    min-width: 160px;
    justify-content: flex-end;
}

.task-avatar {
    width: 28px;
    height: 28px;
    border-radius: 999px;
    display: grid;
    place-items: center;
    font-weight: 900;
    background: rgba(181, 74, 84, .14);
    border: 1px solid rgba(181, 74, 84, .22);
    color: var(--accent);
}

.task-assignee-name {
    font-size: .80rem;
    font-weight: 800;
    color: var(--text-muted);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.task-progress-row {
    display: flex;
    flex-direction: column;
    gap: .45rem;
}

.task-progress-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: .78rem;
    color: var(--text-muted);
    font-weight: 800;
}

.task-progressbar {
    height: 7px;
    background: rgba(18, 24, 38, .08);
    border-radius: 999px;
    overflow: hidden;
}

.task-progressfill {
    height: 100%;
    border-radius: 999px;
    background: linear-gradient(90deg, var(--wine-700), var(--wine-600));
    transition: width .6s var(--ease-out);
}

.task-foot {
    margin-top: .75rem;
    padding-top: .75rem;
    border-top: 1px solid var(--border-default);
}


/* =========================
   15) OVERRIDES / FIX
   - Lo que “manda” cuando hay conflicto
   ========================= */

/* 1) Si alguna vista usa .wrap, NO debe achicarte a 1100px */
.wrap {
    max-width: 1600px;
}

/* 2) Evitar que el dropdown de notificaciones quede tapado */
.notif-drop {
    z-index: 99999;
}

.notif-item {
    cursor: pointer;
}

/* ============ USER DROPDOWN ============ */
.user-menu {
    position: relative;
}

.user-pill-btn {
    cursor: pointer;
    border: 0;
    outline: 0;
}

.user-caret {
    opacity: .9;
    font-weight: 900;
}

.user-dropdown {
    position: absolute;
    right: 0;
    top: calc(100% + 10px);
    min-width: 240px;
    background: var(--bg-surface-2);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    padding: .4rem;
    display: none;
    z-index: 1000;
    backdrop-filter: blur(10px);
}

.user-menu.open .user-dropdown {
    display: block;
}

.ud-item {
    display: flex;
    align-items: center;
    gap: .5rem;
    padding: .55rem .6rem;
    border-radius: 12px;
    text-decoration: none;
    color: var(--text-primary);
    font-weight: 800;
    font-size: .85rem;
    transition: all var(--duration-fast) var(--ease-out);
}

.ud-item:hover {
    background: rgba(181, 74, 84, .10);
    border: 1px solid rgba(181, 74, 84, .18);
}

.ud-item.danger {
    color: #ffdddd;
    background: rgba(185, 28, 28, .12);
    border: 1px solid rgba(185, 28, 28, .22);
}

html[data-theme="light"] .ud-item.danger {
    color: #b91c1c;
    background: rgba(185, 28, 28, .08);
}

.ud-sep {
    height: 1px;
    background: var(--border-default);
    margin: .35rem .2rem;
}

/* =========================
   16) CUENTA / PERFIL (ALIAS + EXTRAS)
   - Para que .input funcione como .inp
   ========================= */

/* Alias: lo que uses como .input queda igual que .inp */
.input {
    width: 100%;
    padding: .68rem .75rem;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-default);
    background: var(--bg-surface-2);
    color: var(--text-primary);
    outline: none;
    transition: all var(--duration-fast) var(--ease-out);
}

.input:focus {
    border-color: rgba(181, 74, 84, .45);
    box-shadow: 0 0 0 4px rgba(181, 74, 84, .16);
}

/* Readonly más claro */
.input[readonly],
.inp[readonly] {
    opacity: .78;
    cursor: not-allowed;
}

/* Grupo input + botón (ojito) */
.input-group {
    display: flex;
    gap: .5rem;
    align-items: center;
}

.input-group .input,
.input-group .inp {
    flex: 1;
}

/* Botón “ojito” compacto (usa .btn que ya tenés) */
.btn.icon {
    width: 40px;
    height: 40px;
    padding: 0;
    border-radius: 12px;
    display: inline-grid;
    place-items: center;
    font-size: 1rem;
}

/* Mensajito pequeño */
.help {
    font-size: .78rem;
    color: var(--text-muted);
    margin-top: .35rem;
}

.task-progress {
    height: 10px;
    border-radius: 999px;
    background: rgba(0, 0, 0, .10);
    overflow: hidden;
    margin-top: 10px;
}

.task-progress-bar {
    height: 100%;
    border-radius: 999px;
    transition: width .35s ease;
}

.bar-green {
    background: rgba(20, 160, 90, .85);
}

.bar-yellow {
    background: rgba(245, 158, 11, .90);
}

.bar-gray {
    background: rgba(148, 163, 184, .85);
}

.task-progressfill.bar-green {
    background: rgba(20, 160, 90, .85);
}

.task-progressfill.bar-yellow {
    background: rgba(245, 158, 11, .90);
}

.task-progressfill.bar-gray {
    background: rgba(148, 163, 184, .85);
}

/* =========================================
   PROGRESO en tarjetas de tareas (index)
   ========================================= */
.progress-bar {
    height: 10px;
    border-radius: 999px;
    background: rgba(0, 0, 0, .10);
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    border-radius: 999px;
    width: 0;
    transition: width .35s ease;
}

/* colores */
.progress-fill.bar-green {
    background: rgba(20, 160, 90, .85);
}

.progress-fill.bar-yellow {
    background: rgba(245, 158, 11, .90);
}

.progress-fill.bar-gray {
    background: rgba(148, 163, 184, .85);
}

/* util */
.mt8 {
    margin-top: 8px;
}

/* =============================
   Cards del panel principal
   ============================= */

.cerrar {
    display: block;
    border-radius: 14px;
    padding: 14px;
    text-decoration: none;
    transition: all .18s ease;
}

/* MODO CLARO */
html[data-theme="light"] .cerrar {
    background: #ffffff;
    border: 1px solid rgba(0, 0, 0, .08);
    color: #121826;
}

html[data-theme="light"] .cerrar:hover {
    border-color: rgba(181, 74, 84, .35);
    box-shadow: 0 6px 18px rgba(0, 0, 0, .08);
    transform: translateY(-2px);
}

/* MODO OSCURO */
html[data-theme="dark"] .cerrar {
    background: rgba(18, 22, 40, .85);
    border: 1px solid rgba(255, 255, 255, .10);
    color: rgba(255, 255, 255, .92);
}

html[data-theme="dark"] .cerrar:hover {
    border-color: rgba(201, 113, 121, .35);
    box-shadow: 0 12px 26px rgba(0, 0, 0, .45);
    transform: translateY(-2px);
}

.icon-salida {
    font-size: 20px;
    opacity: .7;
}

.cerrar:hover .icon-salida {
    opacity: 1;
    transform: translateX(3px);
    transition: all .15s ease;
}

/* =========================
   HOME - Dashboard Secretario
   ========================= */
.dash-wide {
    margin-top: 14px;
    border: 1px solid var(--border);
    background: var(--card);
    border-radius: 16px;
    box-shadow: var(--shadow);
    padding: 14px;
}

.dash-head {
    display: flex;
    gap: 12px;
    align-items: flex-start;
    justify-content: space-between;
    flex-wrap: wrap;
    margin-bottom: 10px;
}

.dash-title {
    margin: 0;
    font-size: 18px;
}

.dash-kpis {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.kpi {
    border: 1px solid var(--border);
    background: rgba(255, 255, 255, .02);
    border-radius: 12px;
    padding: 10px 12px;
    min-width: 120px;
}

.kpi-label {
    font-size: 12px;
    opacity: .75;
}

.kpi-value {
    font-size: 20px;
    font-weight: 800;
}

.dash-body {
    display: grid;
    grid-template-columns: minmax(240px, 420px) 1fr;
    gap: 12px;
    align-items: center;
}

@media (max-width: 860px) {
    .dash-body {
        grid-template-columns: 1fr;
    }
}

.dash-chart {
    height: 220px;
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 10px;
    background: rgba(255, 255, 255, .02);
}

.dash-legend {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    justify-content: flex-start;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    opacity: .9;
}

.dot {
    width: 10px;
    height: 10px;
    border-radius: 999px;
    display: inline-block;
}

.dot-prog {
    background: var(--warn);
}

.dot-ok {
    background: var(--ok);
}

.dot-bad {
    background: var(--danger);
}

/* Mini-cards por área */
.areas-mini-grid {
    margin-top: 12px;
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 10px;
}

@media (max-width: 1200px) {
    .areas-mini-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 860px) {
    .areas-mini-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 520px) {
    .areas-mini-grid {
        grid-template-columns: 1fr;
    }
}

.area-mini-card {
    border: 1px solid var(--border);
    background: var(--card);
    border-radius: 14px;
    box-shadow: var(--shadow);
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    min-height: 210px;
}

.area-mini-title {
    font-weight: 800;
}

.area-mini-bars .mini-row {
    display: flex;
    justify-content: space-between;
    font-size: 12px;
    opacity: .9;
    margin-top: 6px;
}

.mini-bar {
    height: 8px;
    border-radius: 999px;
    background: rgba(255, 255, 255, .06);
    overflow: hidden;
    border: 1px solid var(--border);
}

.mini-fill {
    height: 100%;
    border-radius: 999px;
}

.mini-prog {
    background: var(--warn);
}

.mini-ok {
    background: var(--ok);
}

.mini-bad {
    background: var(--danger);
}

.area-mini-foot {
    margin-top: auto;
    display: flex;
    justify-content: flex-end;
}

/* DASHBOARD GENERAL */
.dash-wide {
    margin-top: 18px;
    padding: 18px;
}

/* GRID DE MINI TARJETAS DE AREAS */
.areas-mini-grid {
    margin-top: 18px;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 12px;
}

/* MINI TARJETAS */
.area-mini-card {
    padding: 14px;
}

/* barras */
.mini-bar {
    height: 8px;
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.08);
    overflow: hidden;
    margin-bottom: 8px;
}

.mini-fill {
    height: 100%;
}

.mini-prog {
    background: #f59e0b;
}

.mini-ok {
    background: #22c55e;
}

.mini-bad {
    background: #ef4444;
}

.area-mini-top {
    display: flex;
    justify-content: space-between;
    margin-bottom: 10px;
}

.area-mini-title {
    font-weight: 700;
}

.area-mini-foot {
    margin-top: 10px;
}

/* =========================
   16) MOBILE IMPROVEMENTS
   ========================= */

@media (max-width: 768px) {

    /* Container más compacto */
    .container,
    .wrap {
        padding: 1rem .9rem 1.5rem;
    }

    /* Header */
    .header-inner {
        padding: .6rem .9rem;
        gap: .6rem;
    }

    .header-title h1 {
        font-size: .85rem;
    }

    .header-title span {
        font-size: .6rem;
    }

    /* Usuario pill más compacto */
    .user-pill {
        padding: .25rem .5rem;
        font-size: .75rem;
    }

    .user-dot {
        width: 22px;
        height: 22px;
        font-size: .75rem;
    }

    .user-name {
        max-width: 110px;
    }

    /* Dropdown usuario */
    .user-dropdown {
        right: 0;
        left: auto;
        min-width: 200px;
    }

    /* Cards */
    .card {
        border-radius: var(--radius-md);
    }

    .card-header {
        padding: .85rem .85rem .6rem .85rem;
    }

    .card-body {
        padding: 0 .85rem .85rem .85rem;
    }

    /* Botones full width en mobile */
    .btn {
        width: 100%;
    }

    .nav-actions .btn {
        width: auto;
    }

    /* Formularios */
    .formgrid {
        gap: .6rem;
    }

    /* Task grid */
    .task-grid {
        grid-template-columns: 1fr !important;
    }

    .task-assignee {
        max-width: 100%;
        justify-content: flex-start;
        margin-top: .4rem;
    }

    /* Tablas responsive */
    .tbl {
        font-size: .8rem;
    }

    .tbl thead {
        display: none;
    }

    .tbl tr {
        display: block;
        border-bottom: 1px solid var(--border-default);
    }

    .tbl td {
        display: flex;
        justify-content: space-between;
        padding: .6rem .75rem;
        font-size: .82rem;
    }

    .tbl td::before {
        content: attr(data-label);
        font-weight: 800;
        color: var(--text-muted);
        margin-right: .6rem;
    }

    /* Notificaciones */
    .notif-drop {
        width: min(94vw, 360px);
    }

}

/* =========================================
   FIX NUCLEAR: Notif dropdown en DARK
   (pisamos cualquier regla vieja / inline)
   ========================================= */

html[data-theme="dark"] #notifMenu.notif-menu,
html[data-theme="dark"] #notifMenu {
    background: rgba(18, 22, 40, .94) !important;
    /* o var(--bg-surface-2) */
    color: rgba(255, 255, 255, .94) !important;
    /* o var(--text-primary) */
    border-color: rgba(255, 255, 255, .12) !important;
    /* o var(--border-default) */
}

html[data-theme="dark"] #notifMenu * {
    color: inherit !important;
}

/* Que los items no metan fondo blanco */
html[data-theme="dark"] #notifMenu .notif-item,
html[data-theme="dark"] #notifMenu a,
html[data-theme="dark"] #notifMenu div {
    background: transparent !important;
}

/* hover y unread */
html[data-theme="dark"] #notifMenu .notif-item:hover {
    background: rgba(201, 113, 121, .12) !important;
}

html[data-theme="dark"] #notifMenu .notif-item.unread {
    background: rgba(201, 113, 121, .16) !important;
}

/* lista scrolleable si corresponde */
html[data-theme="dark"] #notifMenu .notif-list {
    background: transparent !important;
}

.notif-menu-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .75rem;
    padding: .75rem .9rem;
    border-bottom: 1px solid var(--border-default);
    background: var(--bg-surface-2);
    position: sticky;
    top: 0;
    z-index: 2;
}

.notif-menu-title {
    font-size: .82rem;
    font-weight: 800;
    color: var(--text-primary);
}

.notif-mark-all {
    appearance: none;
    border: 0;
    background: none;
    padding: 0;
    font-size: .75rem;
    font-weight: 700;
    color: var(--accent);
    cursor: pointer;
    white-space: nowrap;
}

.notif-mark-all:hover {
    color: var(--accent-hover);
    text-decoration: underline;
}

.tarea-layout {
    display: grid;
    grid-template-columns: minmax(0, 1.8fr) minmax(320px, 380px);
    gap: 16px;
    align-items: start;
}

.tarea-main {
    min-width: 0;
    display: grid;
    gap: 14px;
    align-content: start;
}

.tarea-side {
    min-width: 0;
    align-self: start;
}

.actividad-card {
    position: sticky;
    top: 90px;
}

@media (max-width: 980px) {
    .tarea-layout {
        grid-template-columns: 1fr;
    }

    .actividad-card {
        position: static;
    }
}

.actividad-list {
    display: grid;
    gap: 10px;
    max-height: 520px;
    overflow: auto;
    padding-right: 4px;
}

.actividad-item {
    border: 1px solid var(--border-default);
    border-radius: 12px;
    padding: 10px;
    background: var(--bg-surface-2);
}

.actividad-head {
    display: flex;
    justify-content: space-between;
    gap: 8px;
    align-items: flex-start;
    margin-bottom: 6px;
    flex-wrap: wrap;
}

.actividad-user {
    font-weight: 800;
}

.actividad-fecha {
    font-size: .78rem;
    color: var(--text-muted);
}

.actividad-body {
    white-space: pre-wrap;
    line-height: 1.45;
}

.actividad-files {
    margin-top: 8px;
    display: grid;
    gap: 6px;
}

.actividad-file {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: .88rem;
}

.actividad-form {
    display: grid;
    gap: 10px;
}

.actividad-divider {
    height: 1px;
    background: var(--border-default);
    margin: 12px 0;
}

.actividad-list {
    display: grid;
    gap: 10px;
    max-height: 520px;
    overflow: auto;
    padding-right: 4px;
}

.actividad-item {
    border: 1px solid var(--border-default);
    border-radius: 12px;
    padding: 10px;
    background: var(--bg-surface-2);
}

.actividad-head {
    display: flex;
    justify-content: space-between;
    gap: 8px;
    align-items: flex-start;
    margin-bottom: 6px;
    flex-wrap: wrap;
}

.actividad-user {
    font-weight: 800;
    color: var(--text-primary);
}

.actividad-fecha {
    font-size: .76rem;
    color: var(--text-muted);
    white-space: nowrap;
}

.actividad-body {
    white-space: pre-wrap;
    line-height: 1.45;
    color: var(--text-primary);
    font-size: .88rem;
}

.actividad-files {
    margin-top: 10px;
    display: grid;
    gap: 6px;
}

.actividad-file {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 7px 9px;
    border: 1px solid var(--border-default);
    border-radius: 10px;
    background: rgba(255, 255, 255, .03);
    color: var(--text-primary);
    text-decoration: none;
    font-size: .84rem;
    transition: all var(--duration-fast) var(--ease-out);
    word-break: break-word;
}

.actividad-file:hover {
    border-color: var(--border-hover);
    background: rgba(255, 255, 255, .06);
    transform: translateY(-1px);
}

.actividad-file::before {
    content: "📎";
    flex: 0 0 auto;
}

.actividad-divider {
    height: 1px;
    background: var(--border-default);
    margin: 12px 0;
}

.actividad-form {
    display: grid;
    gap: 10px;
}

.no-comments {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .6px;
    opacity: .75;
}

.empty-msg {
    font-size: 11px;
    font-weight: 700;
    color: var(--text-muted);
    opacity: .8;
}

.empty-msg::before {
    content: "ℹ ";
}