/* ═══════════════════════════════════════════════════════════════════
   INTRANET — design system · Palette: Material Design 3
   ═══════════════════════════════════════════════════════════════════ */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
    /* Material Design 3 — Primary Color Scale (Red) */
    --md-primary-0:     #000000;
    --md-primary-10:    #410e0b;
    --md-primary-20:    #601410;
    --md-primary-25:    #721b15;
    --md-primary-30:    #84231b;
    --md-primary-35:    #992922;
    --md-primary-40:    #b3261e;
    --md-primary-50:    #f9dedc;
    --md-primary-60:    #f2b8b5;
    --md-primary-70:    #ead1dc;
    --md-primary-80:    #ffd8d0;
    --md-primary-90:    #fce4db;
    --md-primary-95:    #fcee4a;
    --md-primary-99:    #fffbf9;
    --md-primary-100:   #ffffff;

    /* Material Design 3 — Secondary Color Scale (Gray) */
    --md-secondary-0:    #000000;
    --md-secondary-10:   #1b1b1f;
    --md-secondary-20:   #313033;
    --md-secondary-25:   #3f3d42;
    --md-secondary-30:   #49454e;
    --md-secondary-35:   #54505b;
    --md-secondary-40:   #605d63;
    --md-secondary-50:   #79747e;
    --md-secondary-60:   #938f96;
    --md-secondary-70:   #aba8af;
    --md-secondary-80:   #cac7ce;
    --md-secondary-90:   #e8e7ec;
    --md-secondary-95:   #f5f1f8;
    --md-secondary-99:   #fffbfe;
    --md-secondary-100:  #ffffff;

    /* Material Design 3 — Tertiary Color Scale (Purple) */
    --md-tertiary-0:     #000000;
    --md-tertiary-10:    #2d1b69;
    --md-tertiary-20:    #453980;
    --md-tertiary-25:    #53459a;
    --md-tertiary-30:    #6250b5;
    --md-tertiary-35:    #7261d1;
    --md-tertiary-40:    #8372e8;
    --md-tertiary-50:    #a291ff;
    --md-tertiary-60:    #bfaaff;
    --md-tertiary-70:    #dcc3ff;
    --md-tertiary-80:    #f9d9ff;
    --md-tertiary-90:    #fde7ff;
    --md-tertiary-95:    #fff8fb;
    --md-tertiary-99:    #fffbfe;
    --md-tertiary-100:   #ffffff;

    /* Material Design 3 — Error Color Scale (Lila/Purple) */
    --md-error-0:        #000000;
    --md-error-10:       #2d1b69;
    --md-error-20:       #453980;
    --md-error-25:       #53459a;
    --md-error-30:       #6250b5;
    --md-error-35:       #7261d1;
    --md-error-40:       #8372e8;
    --md-error-50:       #a291ff;
    --md-error-60:       #bfaaff;
    --md-error-70:       #dcc3ff;
    --md-error-80:       #f9d9ff;
    --md-error-90:       #fde7ff;
    --md-error-95:       #fff8fb;
    --md-error-99:       #fffbfe;
    --md-error-100:      #ffffff;

    /* Material Design 3 — Neutral Color Scale (Gray) — KEPT AS NEUTRAL */
    --md-neutral-0:      #000000;
    --md-neutral-10:     #1b1b1f;
    --md-neutral-20:     #313033;
    --md-neutral-25:     #3f3d42;
    --md-neutral-30:     #49454e;
    --md-neutral-35:     #54505b;
    --md-neutral-40:     #605d63;
    --md-neutral-50:     #79747e;
    --md-neutral-60:     #938f96;
    --md-neutral-70:     #aba8af;
    --md-neutral-80:     #cac7ce;
    --md-neutral-90:     #e8e7ec;
    --md-neutral-95:     #f5f1f8;
    --md-neutral-99:     #fffbfe;
    --md-neutral-100:    #ffffff;

    /* Material Design 3 — Neutral Variant Color Scale */
    --md-neutral-variant-0:   #000000;
    --md-neutral-variant-10:  #1d192b;
    --md-neutral-variant-20:  #322f37;
    --md-neutral-variant-25:  #3e3b48;
    --md-neutral-variant-30:  #4a4458;
    --md-neutral-variant-35:  #565068;
    --md-neutral-variant-40:  #62577b;
    --md-neutral-variant-50:  #79747e;
    --md-neutral-variant-60:  #938f96;
    --md-neutral-variant-70:  #aba8af;
    --md-neutral-variant-80:  #cac7ce;
    --md-neutral-variant-90:  #e8e7ec;
    --md-neutral-variant-95:  #f5f1f8;
    --md-neutral-variant-99:  #fffbfe;
    --md-neutral-variant-100: #ffffff;

    /* Material Design 3 — Success Color (Teal-Green) — UNCHANGED */
    --md-success-20:    #0d5e3c;
    --md-success-40:    #10a561;
    --md-success-80:    #89f0a1;
    --md-success-90:    #c5f0c4;

    /* Material Design 3 — Warning Color (Amber) — UNCHANGED */
    --md-warning-20:    #7d4f00;
    --md-warning-40:    #b88c00;
    --md-warning-80:    #ffd99f;
    --md-warning-90:    #ffe082;

    /* ═════════════════════════════════════════════════════════════════
       Material Design 3 — Extended Color Palette (100-900 + Accent)
       Escalas completas para uso en componentes específicos
       ═════════════════════════════════════════════════════════════════ */

    /* Red Color Ramp — Official Material Design */
    --md-red-100:       #ffebee;
    --md-red-200:       #ffcdd2;
    --md-red-300:       #ef9a9a;
    --md-red-400:       #e57373;
    --md-red-500:       #f44336;
    --md-red-600:       #e53935;
    --md-red-700:       #d32f2f;
    --md-red-800:       #c62828;
    --md-red-900:       #b71c1c;
    --md-red-accent:    #ff5252;

    /* Pink Color Ramp */
    --md-pink-100:      #fcf1f5;
    --md-pink-200:      #f8dce5;
    --md-pink-300:      #f3bcc5;
    --md-pink-400:      #eb96a1;
    --md-pink-500:      #e9788f;
    --md-pink-600:      #e85d84;
    --md-pink-700:      #e84564;
    --md-pink-800:      #e83e5f;
    --md-pink-900:      #ec407a;
    --md-pink-accent:   #ff4081;

    /* Purple Color Ramp */
    --md-purple-100:    #f9f5ff;
    --md-purple-200:    #f3e5ff;
    --md-purple-300:    #ecd7ff;
    --md-purple-400:    #e0b3ff;
    --md-purple-500:    #d99fff;
    --md-purple-600:    #d081ff;
    --md-purple-700:    #c650ff;
    --md-purple-800:    #bb00ff;
    --md-purple-900:    #aa00ff;
    --md-purple-accent: #d500f9;

    /* Deep Purple Color Ramp */
    --md-deep-purple-100:   #f4f0ff;
    --md-deep-purple-200:   #ede7ff;
    --md-deep-purple-300:   #e1d5ff;
    --md-deep-purple-400:   #c9aeff;
    --md-deep-purple-500:   #b39ddb;
    --md-deep-purple-600:   #9c7bff;
    --md-deep-purple-700:   #7c4dff;
    --md-deep-purple-800:   #6a1bff;
    --md-deep-purple-900:   #6200ea;
    --md-deep-purple-accent: #76ff03;

    /* Indigo Color Ramp */
    --md-indigo-100:    #f0f4ff;
    --md-indigo-200:    #e8edff;
    --md-indigo-300:    #dde1ff;
    --md-indigo-400:    #c6d3ff;
    --md-indigo-500:    #b3bfff;
    --md-indigo-600:    #9fa8da;
    --md-indigo-700:    #5c6bc0;
    --md-indigo-800:    #3f51b5;
    --md-indigo-900:    #3949ab;
    --md-indigo-accent: #536dfe;

    /* Blue Color Ramp — Official Material Design */
    --md-blue-100:      #e3f2fd;
    --md-blue-200:      #bbdefb;
    --md-blue-300:      #90caf9;
    --md-blue-400:      #64b5f6;
    --md-blue-500:      #2196f3;
    --md-blue-600:      #1e88e5;
    --md-blue-700:      #1976d2;
    --md-blue-800:      #1565c0;
    --md-blue-900:      #0d47a1;
    --md-blue-accent:   #2196f3;

    /* Light Blue Color Ramp */
    --md-light-blue-100:    #e1f5fe;
    --md-light-blue-200:    #b3e5fc;
    --md-light-blue-300:    #81d4fa;
    --md-light-blue-400:    #4fc3f7;
    --md-light-blue-500:    #29b6f6;
    --md-light-blue-600:    #03a9f4;
    --md-light-blue-700:    #0288d1;
    --md-light-blue-800:    #0277bd;
    --md-light-blue-900:    #01579b;
    --md-light-blue-accent: #40c4ff;

    /* Cyan Color Ramp */
    --md-cyan-100:      #e0f7fa;
    --md-cyan-200:      #b2ebf2;
    --md-cyan-300:      #80deea;
    --md-cyan-400:      #4dd0e1;
    --md-cyan-500:      #26c6da;
    --md-cyan-600:      #00bcd4;
    --md-cyan-700:      #0097a7;
    --md-cyan-800:      #00838f;
    --md-cyan-900:      #006064;
    --md-cyan-accent:   #00e5ff;

    /* Teal Color Ramp */
    --md-teal-100:      #e0f2f1;
    --md-teal-200:      #b2dfdb;
    --md-teal-300:      #80cbc4;
    --md-teal-400:      #4db6ac;
    --md-teal-500:      #26a69a;
    --md-teal-600:      #009688;
    --md-teal-700:      #00897b;
    --md-teal-800:      #00796b;
    --md-teal-900:      #004d40;
    --md-teal-accent:   #1de9b6;

    /* Green Color Ramp */
    --md-green-100:     #e8f5e9;
    --md-green-200:     #c8e6c9;
    --md-green-300:     #a5d6a7;
    --md-green-400:     #81c784;
    --md-green-500:     #66bb6a;
    --md-green-600:     #4caf50;
    --md-green-700:     #43a047;
    --md-green-800:     #388e3c;
    --md-green-900:     #1b5e20;
    --md-green-accent:  #00e676;

    /* Light Green Color Ramp — Official Material Design */
    --md-light-green-100:   #f1f8e9;
    --md-light-green-200:   #dcedc8;
    --md-light-green-300:   #c5e1a5;
    --md-light-green-400:   #aed581;
    --md-light-green-500:   #9ccc65;
    --md-light-green-600:   #8bc34a;
    --md-light-green-700:   #7cb342;
    --md-light-green-800:   #689f38;
    --md-light-green-900:   #558b2f;
    --md-light-green-accent: #76ff03;

    /* Lime Color Ramp */
    --md-lime-100:      #f9fbe7;
    --md-lime-200:      #f0f4c3;
    --md-lime-300:      #e6ee9c;
    --md-lime-400:      #dced1f;
    --md-lime-500:      #cddc39;
    --md-lime-600:      #c0ca33;
    --md-lime-700:      #afb42b;
    --md-lime-800:      #9e9d24;
    --md-lime-900:      #827717;
    --md-lime-accent:   #c6ff00;

    /* Yellow Color Ramp */
    --md-yellow-100:    #fffde7;
    --md-yellow-200:    #fff9c4;
    --md-yellow-300:    #fff59d;
    --md-yellow-400:    #fff176;
    --md-yellow-500:    #ffee58;
    --md-yellow-600:    #ffeb3b;
    --md-yellow-700:    #fdd835;
    --md-yellow-800:    #fbc02d;
    --md-yellow-900:    #f57f17;
    --md-yellow-accent: #ffff00;

    /* Amber Color Ramp — Official Material Design */
    --md-amber-100:     #fff8e1;
    --md-amber-200:     #ffecb3;
    --md-amber-300:     #ffe082;
    --md-amber-400:     #ffd54f;
    --md-amber-500:     #ffc107;
    --md-amber-600:     #ffb300;
    --md-amber-700:     #ffa000;
    --md-amber-800:     #ff8f00;
    --md-amber-900:     #ff6f00;
    --md-amber-accent:  #ffc400;

    /* Orange Color Ramp */
    --md-orange-100:    #fff3e0;
    --md-orange-200:    #ffe0b2;
    --md-orange-300:    #ffcc80;
    --md-orange-400:    #ffb74d;
    --md-orange-500:    #ffa726;
    --md-orange-600:    #ff9800;
    --md-orange-700:    #f57c00;
    --md-orange-800:    #e65100;
    --md-orange-900:    #bf360c;
    --md-orange-accent: #ff9100;

    /* Deep Orange Color Ramp */
    --md-deep-orange-100:   #fbe9e7;
    --md-deep-orange-200:   #ffccbc;
    --md-deep-orange-300:   #ffab91;
    --md-deep-orange-400:   #ff8a65;
    --md-deep-orange-500:   #ff7043;
    --md-deep-orange-600:   #ff5722;
    --md-deep-orange-700:   #f4511e;
    --md-deep-orange-800:   #e64a19;
    --md-deep-orange-900:   #bf360c;
    --md-deep-orange-accent: #ff3d00;

    /* Brown Color Ramp — Official Material Design */
    --md-brown-100:     #efebe9;
    --md-brown-200:     #d7ccc8;
    --md-brown-300:     #bcaaa4;
    --md-brown-400:     #a1887f;
    --md-brown-500:     #795548;
    --md-brown-600:     #6d4c41;
    --md-brown-700:     #5d4037;
    --md-brown-800:     #4e342e;
    --md-brown-900:     #3e2723;
    --md-brown-accent:  #a1887f;

    /* Gray Color Ramp */
    --md-gray-100:      #f5f5f5;
    --md-gray-200:      #eeeeee;
    --md-gray-300:      #e0e0e0;
    --md-gray-400:      #bdbdbd;
    --md-gray-500:      #9e9e9e;
    --md-gray-600:      #757575;
    --md-gray-700:      #616161;
    --md-gray-800:      #424242;
    --md-gray-900:      #212121;
    --md-gray-accent:   #616161;

    /* Blue Grey Color Ramp */
    --md-blue-grey-100:     #eceff1;
    --md-blue-grey-200:     #cfd8dc;
    --md-blue-grey-300:     #b0bec5;
    --md-blue-grey-400:     #90a4ae;
    --md-blue-grey-500:     #78909c;
    --md-blue-grey-600:     #607d8b;
    --md-blue-grey-700:     #546e7a;
    --md-blue-grey-800:     #455a64;
    --md-blue-grey-900:     #37474f;
    --md-blue-grey-accent:  #78909c;

    /* Semantic aliases mapped to Material Design 3 — PROCON: Red Primary + Gray Secondary + Lila Error */
    --color-primary:        var(--md-primary-40);
    --color-primary-h:      var(--md-primary-30);
    --color-secondary:      var(--md-secondary-40);
    --color-tertiary:       var(--md-tertiary-40);
    --color-error:          var(--md-error-40);
    --color-success:        var(--md-success-40);
    --color-warning:        var(--md-warning-40);

    --color-bg:             var(--md-neutral-95);
    --color-surface:        var(--md-neutral-100);
    --color-surface-dim:    var(--md-neutral-80);
    --color-border:         var(--md-neutral-80);
    --color-divider:        var(--md-neutral-90);

    --color-text:           var(--md-neutral-10);
    --color-text-secondary: var(--md-neutral-30);
    --color-text-muted:     var(--md-neutral-50);
    --color-text-on-primary: var(--md-primary-100);

    /* Legacy role mapping (for backward compatibility) */
    --color-admin:          var(--md-error-40);
    --color-manager:        var(--md-secondary-40);
    --color-user:           var(--md-primary-40);

    /* Sidebar — Gray Gradient */
    --sidebar-w:            240px;
    --sidebar-collapsed-w:  56px;
    --sidebar-bg-from:      var(--md-secondary-99);
    --sidebar-bg-to:        var(--md-secondary-95);
    --sidebar-hover:        rgba(96, 93, 99, 0.08);
    --sidebar-active-from:  var(--md-red-500);
    --sidebar-active-to:    var(--md-red-800);
    --sidebar-text:         var(--md-secondary-40);
    --sidebar-text-active:  var(--md-primary-100);

    /* Hours Calendar Day States — Material Design colors
       Department Hours Color Scheme:
       - weekend/holidays: Red 500 (festive days)
       - vacation-pending: Amber 500 (unconfirmed vacations)
       - vacation-approved: LightGreen 500 (confirmed vacations)
       - absence/sick: Blue (medical leave, sick leave)
       - free days: Blue (free choice hours)
       - incomplete: Brown 500 (days with incomplete hour entries)
    */
    --day-weekend-bg:              var(--md-red-100);
    --day-weekend-border:          var(--md-red-500);
    --day-incomplete-bg:           var(--md-brown-500);
    --day-incomplete-border:       var(--md-brown-500);
    --day-vacation-pending-bg:     var(--md-yellow-500);
    --day-vacation-pending-border: var(--md-amber-500);
    --day-vacation-approved-bg:    var(--md-light-green-500);
    --day-vacation-approved-border: var(--md-light-green-500);
    --day-free-hours-pending-bg:   var(--md-tertiary-90);
    --day-free-hours-pending-border: var(--md-tertiary-40);
    --day-free-hours-approved-bg:  var(--md-tertiary-90);
    --day-free-hours-approved-border: var(--md-tertiary-40);
    --day-sick-leave-bg:           var(--md-light-blue-500);
    --day-sick-leave-border:       var(--md-light-blue-500);
    --day-project-hours-bg:        var(--md-tertiary-90);
    --day-project-hours-border:    var(--md-tertiary-40);
    --day-completed-bg:            var(--md-neutral-95);
    --day-completed-border:        var(--md-neutral-80);

    /* Layout */
    --radius:    4px;
    --radius-lg: 6px;
    --transition: .18s cubic-bezier(.4,0,.2,1);
}

.hour-validation-layout {
    max-width: 1200px;
    margin-left: auto;
    margin-right: auto;
}

.hour-validation-panel {
    min-height: auto;
}

.hour-validation-filters-card {
    margin-bottom: 1.5rem;
}

.hour-validation-table-body {
    margin: 0;
    width: 100%;
}

body {
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    font-size: 14px; color: var(--color-text); background: var(--color-bg);
}

/* ── Layout ───────────────────────────────────────────────────────── */
.layout { display: flex; min-height: 100vh; }

/* ── Sidebar ──────────────────────────────────────────────────────── */
.sidebar {
    position: fixed; top: 0; left: 0; height: 100vh;
    width: var(--sidebar-w);
    background: linear-gradient(180deg, var(--sidebar-bg-from) 0%, var(--sidebar-bg-to) 100%);
    display: flex; flex-direction: column; z-index: 150;
    transition: width var(--transition);
    box-shadow: 3px 0 16px rgba(0,0,0,.08);
    overflow: hidden;
}
.sidebar-collapsed .sidebar { width: var(--sidebar-collapsed-w); }

/* ── Sidebar header (hamburger + logo) ───────────────────────────── */
.sidebar-header {
    display: flex; align-items: center; justify-content: center;
    padding: .55rem .7rem;
    border-bottom: 1px solid rgba(0,0,0,.07);
    min-height: 64px; flex-shrink: 0;
}

/* ── Hamburger (solo visible cuando el sidebar está comprimido) ────── */
.hamburger {
    flex-shrink: 0;
    background: none; border: none; cursor: pointer; padding: .4rem;
    display: none;                      /* oculto por defecto (expandido) */
    flex-direction: column; gap: 5px; border-radius: var(--radius);
    transition: background var(--transition);
}
.hamburger:hover { background: rgba(0,0,0,.06); }
.hamburger span {
    display: block; width: 22px; height: 2px;
    background: var(--sidebar-text); border-radius: 2px;
}
/* Mostrar hamburger únicamente cuando está colapsado */
.sidebar-collapsed .hamburger { display: flex; }

/* ── Logo toggle (solo visible cuando el sidebar está expandido) ───── */
.sidebar-logo { display: none; }
.sidebar-logo-color { display: none; }

.sidebar-logo-toggle {
    display: block;                     /* visible por defecto (expandido) */
    height: 52px; width: auto; object-fit: contain;
    max-width: 160px;
    cursor: pointer;
    border-radius: var(--radius);
    transition: opacity var(--transition);
    opacity: 1;
}
.sidebar-logo-toggle:hover { opacity: .75; }
/* Ocultar logo cuando está colapsado */
.sidebar-collapsed .sidebar-logo-toggle { display: none; }


/* ── Nav links ────────────────────────────────────────────────────── */
.nav-links { list-style: none; padding: .5rem 0; flex: 1; overflow-y: auto; overflow-x: hidden; }
.nav-links li a {
    display: flex; align-items: center; gap: .75rem;
    padding: .5rem .75rem; color: var(--sidebar-text);
    text-decoration: none; border-left: 3px solid transparent;
    transition: background var(--transition), color var(--transition),
                padding var(--transition), border-color var(--transition),
                margin var(--transition), gap var(--transition);
    font-size: 13px; font-weight: 500;
    margin: .25rem .5rem; border-radius: var(--radius);
    white-space: nowrap;
}
.nav-links li a:hover {
    background: rgba(96, 93, 99, 0.08);
}
.nav-links li a.active {
    background: linear-gradient(90deg, var(--sidebar-active-from), var(--sidebar-active-to));
    color: var(--sidebar-text-active);
    box-shadow: 0 3px 10px rgba(179, 38, 30, 0.35);
}
.nav-links li a svg,
.nav-links li a img { flex-shrink: 0; opacity: .7; }
.nav-links li a:hover svg,
.nav-links li a:hover img,
.nav-links li a.active svg,
.nav-links li a.active img { opacity: 1; }

/* Collapsed: icono centrado pixel-perfect
   sidebar-collapsed-w=56px, margin=2×4px=8px → link=48px
   border-left eliminado para simetría exacta, padding 0 para que
   justify-content:center coloque el icono de 18px en el centro exacto */
.sidebar-collapsed .nav-links li a {
    justify-content: center;
    padding: .5rem 0;
    margin: 5px;
    gap: 0;
    border-left-color: transparent;
    border-left-width: 0;
}

/* ── Nav label (text that hides on collapse) ─────────────────────── */
.nav-label {
    overflow: hidden; white-space: nowrap;
    opacity: 1; max-width: 180px;
    transition: opacity var(--transition), max-width var(--transition);
}
.sidebar-collapsed .nav-label { opacity: 0; max-width: 0; }

/* ── Nav items with submenus (parent buttons) ─────────────────────── */
.nav-item-parent { position: relative; }
.nav-button-parent {
    display: flex; align-items: center; gap: .75rem;
    width: calc(100% - 1rem); padding: .5rem .75rem;
    color: var(--sidebar-text);
    background: transparent; border: none; cursor: pointer;
    text-decoration: none;
    transition: background var(--transition), color var(--transition),
                padding var(--transition), border-color var(--transition),
                margin var(--transition), gap var(--transition);
    font-size: 13px; font-weight: 500;
    margin: .25rem .5rem; border-radius: var(--radius);
    white-space: nowrap;
    font-family: inherit;
    border-left: 3px solid transparent;
}
.nav-button-parent:hover { background: rgba(96, 93, 99, 0.08); color: var(--sidebar-text); }
.nav-button-parent svg { flex-shrink: 0; opacity: .7; }
.nav-button-parent:hover svg { opacity: 1; }

.nav-chevron {
    margin-left: auto;
    transition: transform var(--transition);
}
.nav-chevron.expanded {
    transform: rotate(180deg);
}

/* ── Submenus (nested menu items) ─────────────────────────────────── */
.nav-submenu {
    list-style: none; padding: 0;
    background: transparent;
    margin: 0.25rem 0.5rem;
    border-radius: var(--radius);
    overflow: hidden;
    animation: slideDown var(--transition) ease-out;
}

@keyframes slideDown {
    from {
        opacity: 0;
        max-height: 0;
    }
    to {
        opacity: 1;
        max-height: 500px;
    }
}

.nav-submenu li a {
    display: flex; align-items: center; gap: .75rem;
    padding: .45rem .75rem .45rem 1.25rem;
    color: var(--sidebar-text);
    text-decoration: none;
    transition: background var(--transition), color var(--transition);
    font-size: 12px; font-weight: 400;
    white-space: nowrap;
    border-left: 2px solid transparent;
}
.nav-submenu li a:hover {
    background: rgba(0,0,0,.06);
    color: var(--sidebar-text);
}
.nav-submenu li a.active {
    background: linear-gradient(90deg, var(--sidebar-active-from), var(--sidebar-active-to));
    color: var(--sidebar-text-active);
    box-shadow: inset 0 1px 3px rgba(179, 38, 30, 0.2);
    border-left-color: var(--sidebar-text-active);
}
.nav-submenu li a svg,
.nav-submenu li a img { flex-shrink: 0; opacity: .7; }
.nav-submenu li a:hover svg,
.nav-submenu li a:hover img,
.nav-submenu li a.active svg,
.nav-submenu li a.active img { opacity: 1; }

/* Collapsed: hide submenus, center parent button icon */
.sidebar-collapsed .nav-button-parent {
    justify-content: center;
    padding: .5rem 0;
    margin: 5px;
    gap: 0;
}
.sidebar-collapsed .nav-chevron { display: none; }
.sidebar-collapsed .nav-submenu { display: none; }


/* ── Sidebar footer (user + logout) ─────────────────────────────── */
.sidebar-footer {
    flex-shrink: 0;
    padding: .6rem .5rem;
    border-top: 1px solid rgba(0,0,0,.07);
}
.sidebar-user {
    display: flex; align-items: center;
    padding: .35rem .5rem; border-radius: var(--radius);
    gap: .5rem; min-width: 0;
}
.sidebar-username {
    flex: 1; font-size: 12px; font-weight: 600;
    color: var(--sidebar-text);
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.btn-logout-side {
    flex-shrink: 0;
    background: none; border: none; cursor: pointer;
    color: var(--color-text-muted);
    display: flex; align-items: center; justify-content: center;
    padding: .3rem; border-radius: var(--radius);
    transition: background var(--transition), color var(--transition);
}
.btn-logout-side:hover { background: #fce4db; color: var(--md-error-40); }

/* Collapsed footer: center the logout icon */
.sidebar-collapsed .sidebar-user { justify-content: center; padding: .35rem 0; }

/* ── Sidebar overlay (solo móvil) ────────────────────────────────── */
.sidebar-overlay {
    display: none;
    position: fixed; inset: 0; background: rgba(0,0,0,.4);
    z-index: 140; backdrop-filter: blur(2px); animation: fadeIn .2s ease;
}
@media (max-width: 768px) {
    .sidebar-overlay { display: block; }
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

/* ── Main content ─────────────────────────────────────────────────── */
.main-content {
    flex: 1; padding: 2rem;
    margin-left: var(--sidebar-w);
    transition: margin-left var(--transition);
    min-width: 0;
}
.sidebar-collapsed .main-content { margin-left: var(--sidebar-collapsed-w); }

@media (max-width: 768px) {
    .sidebar { width: var(--sidebar-w); transform: translateX(calc(-1 * var(--sidebar-w))); transition: transform var(--transition); }
    .sidebar-open .sidebar  { transform: translateX(0); }
    .main-content { margin-left: 0 !important; padding-left: 1rem; padding-right: 1rem; }
}


/* ── Page header ──────────────────────────────────────────────────── */
.page-header {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: 1.5rem; gap: 1rem; flex-wrap: wrap;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--color-border);
}
.page-heading {
    display: flex; align-items: center; gap: .9rem;
}
.page-heading-icon {
    width: 64px;
    height: 64px;
    border-radius: 3px;
    flex-shrink: 0;
    background: linear-gradient(135deg, var(--sidebar-active-from), var(--sidebar-active-to));
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(179, 38, 30, 0.28);
}
.page-heading-icon svg,
.page-heading-icon img {
    color: #fff;
    display: block;
    width: 50px;
    height: 50px;
}
.page-title {
    font-size: 22px; font-weight: 800; line-height: 1.1;
    color: var(--color-text);
    margin: 0 0 .15rem;
}
.page-subtitle { font-size: 12px; color: var(--color-text-muted); margin: 0; }

.hour-validation-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .75rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}

.hour-validation-checkbox {
    display: inline-flex;
    align-items: center;
    gap: .45rem;
    font-size: .9rem;
}

.hour-validation-filters {
    display: grid;
    grid-template-columns: 1fr;
    gap: .85rem;
    align-items: stretch;
    margin-bottom: 1rem;
    width: 100%;
}

.vacation-filters-grid {
    display: grid;
    grid-template-columns: 1.5fr 1fr auto;
    gap: 1rem;
    align-items: flex-end;
    width: 100%;
    margin-bottom: .1rem;
}

.project-filters-grid {
    display: grid;
    grid-template-columns: 1fr 1fr auto;
    gap: 1rem;
    align-items: flex-end;
    width: 100%;
    margin-bottom: .1rem;
}

.btn-toggle-validation {
    padding: .5rem;
    width: 2.5rem;
    height: 2.5rem;
    min-width: 2.5rem;
    min-height: 2.5rem;
    border: none;
    border-radius: var(--radius);
    font-weight: 600;
    font-size: 13px;
    cursor: pointer;
    transition: all var(--transition);
    background: var(--md-neutral-80);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: .73rem;
}

.btn-toggle-validation:hover {
    background: var(--md-neutral-70);
}

.btn-toggle-validation.active {
    background: var(--md-red-500);
    color: #fff;
}

.btn-toggle-validation.active:hover {
    background: var(--md-red-600);
}

.users-table.hour-validation-table {
    margin-top: .5rem;
    width: 100%;
    min-width: 100%;
    table-layout: fixed;
    border-collapse: collapse;
}

.users-table.hour-validation-table.hour-validation-table-body {
    margin-top: 0;
}

.hour-validation-actions {
    display: flex;
    align-items: center;
    gap: .5rem;
    white-space: nowrap;
}

.hour-validation-table td.hour-validation-actions {
    justify-content: flex-start;
}

.hour-validation-col-actions {
    padding: 0;
    font-size: 0;
    border-bottom: none;
}

.hour-validation-table thead th:last-child {
    padding: 0;
    height: 0;
    line-height: 0;
    font-size: 0;
    border-bottom: none;
}

.hour-validation-more {
    margin-top: .9rem;
    display: flex;
    justify-content: center;
}

.hour-validation-panel .time-entry-requests-table {
    max-height: 320px;
    overflow: auto;
}

.btn-danger {
    border: 1px solid var(--md-error-40);
    background: var(--md-error-40);
    color: #fff;
    border-radius: 3px;
    height: 32px;
    padding: 0 .8rem;
    cursor: pointer;
    font-weight: 600;
}

.btn-danger:hover {
    background: var(--md-error-30);
    border-color: var(--md-error-30);
}

.hour-validation-actions .btn-icon-approve {
    background: #27ae60;
    border-color: #1f8f4f;
    color: #fff;
}

.hour-validation-actions .btn-icon-approve:hover {
    background: #1f8f4f;
    border-color: #197341;
    color: #fff;
}

.hour-validation-actions .btn-icon-cancel {
    background: var(--color-primary);
    border-color: var(--color-primary-h);
    color: #fff;
}

.hour-validation-actions .btn-icon-cancel:hover {
    background: var(--color-primary-h);
    border-color: #962d22;
    color: #fff;
}

/* ── Task allocation tiles (Windows 8 style) ─────────────────────── */
.tasks-tiles-toggle {
    display: inline-flex;
    align-items: center;
    gap: .5rem;
    background: none;
    border: none;
    padding: 0;
    margin: 0;
    font-size: 1.4rem;
    font-weight: 400;
    color: var(--color-text);
    cursor: pointer;
}

.tasks-tiles-toggle__icon {
    font-size: 1rem;
    color: var(--color-text-muted);
}

.tasks-tiles-panel {
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: .4rem;
    margin: 0 0 1rem;
}

.tasks-hdc-tile {
    min-height: 64px;
    padding: .4rem .45rem;
    border-radius: 3px;
    color: #2f3b4a;
    border: 1px solid transparent;
    box-shadow: none;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: .25rem;
}

.tasks-hdc-tile--regular {
    background: #d5e7fb;
    border-color: #bdd4ee;
}

.tasks-hdc-tile--green {
    background: #ddf2e5;
    border-color: #c3decf;
}

.tasks-hdc-tile--orange {
    background: #fcead4;
    border-color: #e8d3b8;
}

.tasks-hdc-tile--red {
    background: #f8dddd;
    border-color: #e4c2c2;
}

.tasks-hdc-tile--purple {
    background: #ece0f8;
    border-color: #d5c8e4;
}

.tasks-hdc-tile--selected {
    border: 1px solid #4caf50;
}

.tasks-hdc-tile__checkmark {
    position: absolute;
    top: 2px;
    right: 2px;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: white;
    border-radius: 50%;
}

.tasks-hdc-tile__hdc {
    font-size: .72rem;
    font-weight: 400;
    opacity: 1;
}

.tasks-hdc-tile__hours {
    font-size: .86rem;
    font-weight: 400;
    line-height: 1.1;
}

.tasks-hdc-tile__progress {
    height: 6px;
    border-radius: 999px;
    background: rgba(47, 59, 74, 0.16);
    overflow: visible;
    position: relative;
}

.tasks-hdc-tile__progress-fill {
    height: 100%;
    border-radius: 999px;
    transition: width .25s ease;
    position: absolute;
    top: 0;
    left: 0;
}

.tasks-hdc-tile__progress-fill--green {
    background: linear-gradient(90deg, #4caf50 0%, #81c784 100%);
}

.tasks-hdc-tile__progress-fill--orange {
    background: linear-gradient(90deg, #ff9800 0%, #ffb74d 100%);
}

.tasks-hdc-tile__progress-fill--red {
    background: linear-gradient(90deg, #f44336 0%, #ef9a9a 100%);
}

.tasks-hdc-tile__progress-fill--purple {
    background: linear-gradient(90deg, #9c27b0 0%, #ce93d8 100%);
}

/* Overlay de horas imputadas (superpuesto) */
.tasks-hdc-tile__progress-used {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    border-radius: 999px;
    background: rgba(0, 0, 0, 0.5);
    z-index: 2;
}

/* Marcador de horas imputadas */
.tasks-hdc-tile__progress-marker {
    position: absolute;
    top: 50%;
    width: 2px;
    height: 10px;
    background: #333;
    border-radius: 1px;
    transform: translateX(-50%) translateY(-50%);
    cursor: pointer;
    z-index: 3;
}

.tasks-tiles-empty {
    grid-column: 1 / -1;
    padding: .65rem;
    border: 1px dashed var(--color-border);
    border-radius: 4px;
    color: var(--color-text-muted);
    background: #fafafa;
}

.tasks-tree-row {
    cursor: pointer;
}

.tasks-tree-row--child td {
    background-color: #fcfcfc;
}

.tasks-tree-row--child td {
    padding-top: .35rem;
    padding-bottom: .35rem;
}

.tasks-tree-row--child .tasks-tree-title {
    min-height: 1rem;
}

.tasks-tree-title {
    display: flex;
    align-items: center;
    gap: .45rem;
    min-height: 1.25rem;
    width: 100%;
}

.tasks-tree-indent {
    display: inline-block;
    flex: 0 0 auto;
    height: 1rem;
}

.tasks-tree-caret {
    width: .8rem;
    color: var(--color-text-muted);
    text-align: center;
    font-weight: 600;
}

.tasks-tree-loading {
    font-size: .75rem;
    color: var(--color-text-muted);
}

@media (max-width: 1200px) {
    .tasks-tiles-panel {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }
}

@media (max-width: 768px) {
    .tasks-tiles-panel {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

/* ── Stats panel ──────────────────────────────────────────────────── */
.stats-panel {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    padding: .875rem 1.25rem;
    margin-bottom: 1.25rem;
    box-shadow: 0 1px 6px rgba(44,62,80,.06);
    display: flex;
    gap: 1.5rem;
    align-items: flex-start;
    flex-wrap: wrap;
    max-width: 860px;
}

/* Totales */
.stats-summary {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    flex-shrink: 0;
}
.summary-divider {
    width: 1px; height: 36px;
    background: var(--color-border);
}
.summary-item {
    display: flex; flex-direction: column; align-items: center; gap: .15rem;
}
.summary-value {
    font-size: 2rem; font-weight: 800; line-height: 1;
    color: var(--color-text);
}
.summary-value--active   { color: #27ae60; }
.summary-value--inactive { color: var(--md-neutral-80); }
.summary-label {
    font-size: 11px; font-weight: 500;
    color: var(--color-text-muted); text-transform: uppercase; letter-spacing: .04em;
}

/* Desglose por rol */
.stats-roles {
    flex: 1; min-width: 260px;
    display: flex; flex-direction: column; gap: .6rem;
}
.role-stat { display: flex; flex-direction: column; gap: .3rem; }
.role-stat-header {
    display: flex; align-items: center;
    justify-content: space-between;
}
.role-stat-count {
    font-size: 13px; font-weight: 700; color: var(--color-text);
}
.role-stat-pct { font-weight: 400; color: var(--color-text-muted); font-size: 12px; }
.role-stat-bar {
    height: 6px; background: var(--md-neutral-95);
    border-radius: 99px; overflow: hidden;
}
.role-stat-fill {
    height: 100%; border-radius: 99px;
    transition: width .4s cubic-bezier(.4,0,.2,1);
}

/* Colores de barra por rol */
.role-fill-admin              { background: var(--md-primary-40); }
.role-fill-manager            { background: #9b59b6; }
.role-fill-projectmanager     { background: #e67e22; }
.role-fill-technicalteamleader{ background: #2e86c1; }
.role-fill-user               { background: #aab7b8; }

/* ── Role filter tiles ─────────────────────────────────────────────── */
.role-filter-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
    gap: 0.75rem;
    margin-bottom: 1.25rem;
}

.role-filter-tile {
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    padding: 0.75rem;
    background: var(--color-surface);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    min-height: 100px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    transition: all 0.2s ease;
    cursor: pointer;
    font-family: inherit;
    border: 2px solid var(--color-border);
}

.role-filter-tile:hover {
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
    border-color: var(--md-primary-40);
}

.role-filter-tile--active {
    background: linear-gradient(135deg, rgba(179, 38, 30, 0.15) 0%, rgba(179, 38, 30, 0.08) 100%);
    border: 2px solid rgba(179, 38, 30, 0.4);
}

.role-filter-tile-label {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    color: var(--color-text-secondary);
    margin-bottom: 0.5rem;
    line-height: 1.2;
    text-align: center;
}

.role-filter-tile-value {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--color-text);
    text-align: center;
    margin-bottom: 0.25rem;
}

.role-filter-tile--active .role-filter-tile-value {
    color: var(--md-primary-40);
}

@media (max-width: 640px) {
    .role-filter-grid {
        grid-template-columns: repeat(auto-fit, minmax(80px, 1fr));
        gap: 0.5rem;
    }
    .role-filter-tile {
        min-height: 80px;
        padding: 0.5rem;
    }
    .role-filter-tile-label {
        font-size: 0.65rem;
    }
    .role-filter-tile-value {
        font-size: 1.2rem;
    }
}

/* ── Stats row (legacy, kept for reference) ───────────────────────── */
.stats-row { display: flex; gap: 1rem; margin-bottom: 1.75rem; flex-wrap: wrap; }
.stats-groups { display: flex; gap: 1.25rem; margin-bottom: 1.75rem; flex-wrap: wrap; align-items: flex-start; }
.stat-group { display: flex; flex-direction: column; gap: .75rem; flex-shrink: 0; }
.stat-group-roles { display: grid; grid-template-columns: repeat(3, 1fr); gap: .75rem; flex: 1; min-width: 280px; }
@media (max-width: 600px) {
    .stats-groups     { flex-direction: column; }
    .stat-group-roles { grid-template-columns: repeat(2, 1fr); }
}
.stat-card {
    background: var(--color-surface); border: 1px solid var(--color-border);
    border-radius: var(--radius-lg); padding: .75rem 1rem;
    flex: 1; min-width: 120px; display: flex; flex-direction: column; gap: .2rem;
    border-top: 3px solid var(--md-primary-40);
    transition: box-shadow var(--transition), transform var(--transition);
}
.stat-card:hover { box-shadow: 0 4px 16px rgba(179, 38, 30, 0.12); transform: translateY(-1px); }
.stat-card:nth-child(2) { border-top-color: var(--md-error-40); }
var(--md-warning-40)
.stat-card:nth-child(4) { border-top-color: var(--md-success-40); }
.stat-value { font-size: 28px; font-weight: 800; color: var(--color-text); line-height: 1; }
.stat-label { font-size: 12px; color: var(--color-text-muted); font-weight: 500; }

/* ── Toolbar ──────────────────────────────────────────────────────── */
.toolbar { display: flex; gap: .75rem; margin-bottom: 1.25rem; flex-wrap: wrap; }
.search-wrap { position: relative; flex: 1; max-width: 480px; }
.search-icon {
    position: absolute; left: .75rem; top: 50%; transform: translateY(-50%);
    color: var(--color-text-muted); pointer-events: none;
}
.search-wrap .form-input {
    padding-left: 2rem;
}
.search-input {
    width: 100%; padding: .38rem .65rem .38rem 2rem;
    border: 2px solid var(--color-border); border-radius: var(--radius);
    font-size: 13px; background: var(--color-surface); color: var(--color-text);
    transition: border-color .15s, box-shadow .15s;
}
.search-input:focus {
    outline: none; border-color: var(--md-primary-40);
    box-shadow: 0 0 0 3px rgba(179, 38, 30, .15);
}
.search-input::placeholder { color: var(--md-neutral-80); }

/* ── State Multi-Select ───────────────────────────────────────────── */
.state-multi-select { position: relative; display: inline-block; }
.state-filter-toggle {
    display: flex; align-items: center; gap: .5rem;
    padding: .45rem .6rem; border: 1px solid var(--color-border);
    border-radius: var(--radius); background: #fff; color: var(--color-text);
    font-size: 13px; cursor: pointer; transition: border-color .15s;
}
.state-filter-toggle:hover { border-color: var(--md-primary-40); }
.state-filter-toggle svg { transition: transform .2s; }
.state-multi-select.active .state-filter-toggle svg { transform: rotate(180deg); }
.state-filter-label { flex: 1; white-space: nowrap; }

.state-filter-dropdown {
    position: absolute; top: calc(100% + 4px); left: 0; z-index: 1000;
    background: #fff; border: 1px solid var(--color-border);
    border-radius: var(--radius); box-shadow: 0 2px 8px rgba(0,0,0,.12);
    min-width: 200px; max-width: 280px;
}
.state-filter-header {
    display: flex; gap: .5rem; padding: .5rem;
    border-bottom: 1px solid var(--color-border);
}
.state-filter-action {
    flex: 1; padding: .4rem .6rem; border: 1px solid var(--color-border);
    border-radius: 3px; background: #fff; font-size: 12px; cursor: pointer;
    transition: background-color .15s; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.state-filter-action:hover { background-color: var(--color-surface); }
.state-filter-list {
    display: flex; flex-direction: column; max-height: 300px; overflow: auto;
    padding: .25rem;
}
.state-filter-item {
    display: flex; align-items: center; gap: .5rem;
    padding: .4rem .6rem; cursor: pointer; user-select: none;
    transition: background-color .15s; min-width: 0;
}
.state-filter-item:hover { background-color: var(--color-surface); }
.state-filter-item input[type="checkbox"] {
    margin: 0; cursor: pointer; flex-shrink: 0;
}
.state-filter-item span {
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

/* ── Table card ───────────────────────────────────────────────────── */
/* ═══════════════════════════════════════════════════════════════════
   TABLAS — Estilos base y variantes
   ═══════════════════════════════════════════════════════════════════ */

/* ── Base: Contenedor de tablas ─────────────────────────────────── */
.table-card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    margin-bottom: 1rem;
    box-shadow: 0 1px 6px rgba(44,62,80,.06);
}

/* Variante: Tabla con scroll vertical */
.table-card.hour-validation-table-card {
    overflow: auto;
}

/* ── Base: Tabla ───────────────────────────────────────────────── */
.users-table {
    width: 100%;
    border-collapse: collapse;
    margin: 0;
    box-sizing: border-box;
}

/* Tabla de proyectos con ancho fijo en columnas */
.users-table.projects-table {
    table-layout: fixed;
    width: 100%;
    min-width: 100%;
}

.users-table.projects-table td,
.users-table.projects-table th {
    box-sizing: border-box;
}

/* ── Base: Encabezados ─────────────────────────────────────────── */
.users-table th {
    background: var(--color-surface);
    padding: .5rem .875rem;
    text-align: left;
    font-weight: 600;
    font-size: 12px;
    color: var(--color-text);
    letter-spacing: 0;
    border-bottom: 2px solid var(--md-primary-40);
}

/* ── Base: Celdas de datos ────────────────────────────────────── */
.users-table td {
    padding: .5rem .875rem;
    vertical-align: middle;
    font-size: 13px;
    border-bottom: 1px solid #f2f4f7;
}

.users-table tr:last-child td {
    border-bottom: none;
}

.users-table tbody tr {
    transition: background var(--transition);
}

.users-table tbody tr:hover td {
    background: #fff5f5;
}

/* ═══════════════════════════════════════════════════════════════════
   TABLAS — Variante: Validación de horas (scrolleable con header fijo)
   ═══════════════════════════════════════════════════════════════════ */

.hour-validation-table-card {
    margin-top: 0;
    max-height: calc(100vh - 250px);
    overflow: auto;
}

.users-table.hour-validation-table {
    margin-top: .5rem;
    width: 100%;
    min-width: 100%;
    table-layout: fixed;
}

.users-table.hour-validation-table thead {
    position: sticky;
    top: 0;
    z-index: 10;
}

.users-table.hour-validation-table th {
    background: var(--color-surface);
    padding: .5rem .875rem;
    text-align: left;
    font-weight: 600;
    font-size: 12px;
    color: var(--color-text);
    letter-spacing: 0;
    box-shadow: inset 0 -2px 0 var(--md-primary-40);
    border-bottom: none;
}

/* ── User cell ────────────────────────────────────────────────────── */
.user-cell { display: flex; align-items: center; gap: .75rem; }
.user-avatar {
    width: 36px; height: 36px; border-radius: 50%;
    background: linear-gradient(135deg, var(--md-primary-40), var(--md-primary-30));
    color: #fff; font-size: 12px; font-weight: 700;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0; letter-spacing: .5px;
    box-shadow: 0 2px 6px rgba(179, 38, 30, 0.3);
}
.user-avatar.large {
    width: 48px; height: 48px; font-size: 16px;
    box-shadow: 0 3px 10px rgba(179, 38, 30, 0.35);
}
.user-name  { font-weight: 600; font-size: 13.5px; color: var(--color-text); }
.user-email { font-size: 12px; color: var(--color-text-muted); }
.text-muted { color: var(--color-text-muted); }

/* ── Badges ───────────────────────────────────────────────────────── */
.badge {
    display: inline-block; padding: .22rem .65rem; border-radius: 20px;
    font-size: 11px; font-weight: 700; margin-right: .3rem; white-space: nowrap;
}
/* Badges de roles combinables (Admin, ITEngineer, Executive, Accountant):
   borde discontinuo + peso normal para diferenciarlos visualmente de los roles principales */
.badge-addon {
    border-style: dashed !important;
    font-weight: 500;
    font-size: 10px;
    opacity: .85;
}
/* Badge cuadrado de 2 letras para roles decoradores (tabla + modal) */
.badge-decorator {
    display: inline-flex; align-items: center; justify-content: center;
    width: 22px; height: 22px;
    border-radius: 3px;
    font-size: 9px; font-weight: 300;
    font-family: 'Segoe UI', system-ui, sans-serif;
    color: #fff;
    letter-spacing: .06em;
    vertical-align: middle;
    margin-right: .25rem;
    flex-shrink: 0;
}
/* Texto dentro de la celda decoradora del organigrama */
.org-decorator-text {
    font-size: 9px; font-weight: 400;
    font-family: 'Segoe UI', system-ui, sans-serif;
    color: #fff; letter-spacing: .06em;
    line-height: 1;
    user-select: none;
}
.badge-admin {
    /* Rojo pastel — máxima autoridad */
    background: #fdecea; color: var(--md-primary-30);
    border: 1px solid #f5c6c2; box-shadow: none;
}
.badge-manager {
    /* Lila pastel */
    background: #f3eef8; color: #7d3c98;
    border: 1px solid #d7bde2; box-shadow: none;
}
.badge-project {
    /* Marrón pastel */
    background: #fdf3e7; color: #935116;
    border: 1px solid #f0c889; box-shadow: none;
}
.badge-tech {
    /* Azul pastel */
    background: #eaf4fb; color: #1a6fa8;
    border: 1px solid #aed6f1; box-shadow: none;
}
.badge-user {
    /* Gris pastel — nivel base */
    background: #f2f3f4; color: #5d6d7e;
    border: 1px solid #d5d8dc; box-shadow: none;
}
.badge-engineer {
    /* Gris azulado pastel — Engineer (mismo rango que User) */
    background: #eef0f5; color: #4a5568;
    border: 1px solid #c8cdd8; box-shadow: none;
}
.badge-executive {
    /* Dorado pastel — Executive */
    background: #fdf6e3; color: #7d5a00;
    border: 1px solid #e8d08a; box-shadow: none;
}
.badge-accountant {
    /* Teal pastel — Accountant */
    background: #e8f6f3; color: #0e6655;
    border: 1px solid #a2d9ce; box-shadow: none;
}
.badge-it {
    /* Verde musgo pastel — IT Engineer */
    background: #eaf4ee; color: #1e7e4a;
    border: 1px solid #a9d6b8; box-shadow: none;
}
.badge-none { background: var(--md-neutral-95); color: var(--md-neutral-80); }

/* ── Status dot ───────────────────────────────────────────────────── */
.status-dot { display: inline-flex; align-items: center; gap: .4rem; font-size: 12px; }
.status-dot::before { content: ''; width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.status-dot.active::before   { background: var(--md-success-40); box-shadow: 0 0 5px rgba(46,204,113,.5); }
.status-dot.inactive::before { background: var(--md-neutral-80); }

/* ── Icon button (square) ────────────────────────────────────────── */
.btn-icon {
    width: 32px; height: 32px; padding: 0; flex-shrink: 0;
    background: var(--color-primary);
    border: 1px solid var(--color-primary-h);
    color: #fff;
    border-radius: 3px;
    box-shadow: 0 0 3px rgba(74,74,74,.35);
    cursor: pointer; display: inline-flex; align-items: center; justify-content: center;
    transition: border-color .15s, color .15s, background .15s, box-shadow .15s, transform .15s;
}
.btn-icon:hover {
    background: var(--color-primary-h);
    border-color: #962d22;
    color: #fff;
    box-shadow: 0 0 5px rgba(74,74,74,.45);
    transform: translateY(-1px);
}
.btn-icon.btn-icon-primary {
    background: linear-gradient(135deg, var(--md-red-500), var(--md-red-800));
    border: 1px solid var(--md-red-500);
    color: #fff;
}
.btn-icon.btn-icon-primary:hover {
    background: linear-gradient(135deg, var(--md-red-600), var(--md-red-900));
    border-color: var(--md-red-600);
    color: #fff;
    box-shadow: 0 0 5px rgba(244, 67, 54, 0.45);
    transform: translateY(-1px);
}
.btn-icon.btn-icon-danger {
    background: linear-gradient(135deg, var(--md-error-20), var(--md-error-50));
    border: 1px solid var(--md-error-40);
    color: #fff;
}
.btn-icon.btn-icon-danger:hover {
    background: linear-gradient(135deg, var(--md-error-30), var(--md-error-60));
    border-color: var(--md-error-40);
    color: #fff;
    box-shadow: 0 0 5px rgba(98, 80, 181, 0.45);
    transform: translateY(-1px);
}

/* ── Button Icon Disabled State ───────────────────────────────── */
.btn-icon:disabled,
.btn-icon[disabled] {
    background: var(--md-neutral-60) !important;
    border-color: var(--md-neutral-60) !important;
    color: #fff !important;
    box-shadow: none !important;
    cursor: not-allowed;
    opacity: 0.6;
    transform: none !important;
}

.btn-icon:disabled:hover,
.btn-icon[disabled]:hover {
    background: var(--md-neutral-60) !important;
    border-color: var(--md-neutral-60) !important;
    color: #fff !important;
    box-shadow: none !important;
    transform: none !important;
}
.btn-icon img,
.btn-close img,
.search-icon {
    display: block;
}

.btn-icon img,
.btn-close img {
    filter: brightness(0) invert(1);
}

.btn-icon:not(.btn-icon-sm) img {
    width: 20px !important;
    height: 20px !important;
}

.btn-icon.btn-icon-sm img {
    width: 16px !important;
    height: 16px !important;
}

/* ── Button Icon Gradient Variants ─────────────────────────────── */
.btn-icon-success {
    background: linear-gradient(90deg, #4caf50 0%, #81c784 100%);
    border-color: #4caf50;
}

.btn-icon-success:hover:not(:disabled) {
    background: linear-gradient(90deg, #45a049 0%, #7bc97a 100%);
    border-color: #45a049;
    box-shadow: 0 0 5px rgba(76, 175, 80, 0.45);
    transform: translateY(-1px);
}

.btn-icon-warning {
    background: linear-gradient(90deg, #ff9800 0%, #ffb74d 100%);
    border-color: #ff9800;
}

.btn-icon-warning:hover:not(:disabled) {
    background: linear-gradient(90deg, #f57c00 0%, #ffa726 100%);
    border-color: #f57c00;
    box-shadow: 0 0 5px rgba(255, 152, 0, 0.45);
    transform: translateY(-1px);
}

.btn-icon-error {
    background: linear-gradient(90deg, #f44336 0%, #ef9a9a 100%);
    border-color: #f44336;
}

.btn-icon-error:hover:not(:disabled) {
    background: linear-gradient(90deg, #d32f2f 0%, #e57373 100%);
    border-color: #d32f2f;
    box-shadow: 0 0 5px rgba(244, 67, 54, 0.45);
    transform: translateY(-1px);
}

.btn-icon-purple {
    background: linear-gradient(90deg, #9c27b0 0%, #ce93d8 100%);
    border-color: #9c27b0;
}

.btn-icon-purple:hover:not(:disabled) {
    background: linear-gradient(90deg, #7b1fa2 0%, #ba68c8 100%);
    border-color: #7b1fa2;
    box-shadow: 0 0 5px rgba(156, 39, 176, 0.45);
    transform: translateY(-1px);
}

.btn-close img {
    width: 20px;
    height: 20px;
}

/* ── Tooltip ──────────────────────────────────────────────────────── */
[data-tooltip] { position: relative; }
[data-tooltip]::after {
    content: attr(data-tooltip);
    position: absolute; bottom: calc(100% + 7px); left: 50%;
    transform: translateX(-50%) scale(.9);
    background: #1a1a1a; color: #fff;
    font-size: 11.5px; font-weight: 500; white-space: nowrap;
    padding: .28rem .55rem; border-radius: 4px;
    pointer-events: none; opacity: 0;
    transition: opacity .15s, transform .12s; z-index: 9999;
}
[data-tooltip]::before {
    content: '';
    position: absolute; bottom: calc(100% + 3px); left: 50%;
    transform: translateX(-50%);
    border: 4px solid transparent; border-top-color: #1a1a1a;
    pointer-events: none; opacity: 0;
    transition: opacity .15s; z-index: 9999;
}
[data-tooltip]:hover::after  { opacity: 1; transform: translateX(-50%) scale(1); }
[data-tooltip]:hover::before { opacity: 1; }

/* ── Loading / empty panels ───────────────────────────────────────── */
.loading-panel, .empty-panel {
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    gap: .75rem; padding: 3rem; color: var(--color-text-muted);
    background: var(--color-surface); border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
}
.spinner {
    width: 30px; height: 30px; border: 3px solid var(--md-neutral-95);
    border-top-color: var(--md-primary-40); border-radius: 50%;
    animation: spin .7s linear infinite;
}
.btn-spinner {
    display: inline-block; width: 13px; height: 13px;
    border: 2px solid rgba(255,255,255,.4); border-top-color: #fff;
    border-radius: 50%; animation: spin .7s linear infinite; margin-right: .4rem;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Pagination ───────────────────────────────────────────────────── */
.pagination {
    display: flex; align-items: center; justify-content: space-between;
    font-size: 12.5px; color: var(--color-text-muted); flex-wrap: wrap; gap: .5rem;
    padding: .45rem .875rem; background: var(--color-surface);
    border: 1px solid var(--color-border); border-radius: var(--radius-lg);
}
.pagination-btns { display: flex; align-items: center; gap: .4rem; }
.pagination-btns button {
    background: var(--color-surface); border: 2px solid var(--color-border);
    border-radius: var(--radius); padding: .22rem .45rem; cursor: pointer;
    display: flex; align-items: center; color: var(--color-text); font-weight: 600; font-size: 12px;
    transition: border-color .15s, color .15s, background .15s;
}
.pagination-btns button:hover:not(:disabled) { border-color: var(--md-primary-40); color: var(--md-primary-40); background: rgba(179, 38, 30, .06); }
.pagination-btns button:disabled { opacity: .4; cursor: not-allowed; }

/* ── Buttons ──────────────────────────────────────────────────────── */
.btn-primary, .btn-secondary {
    display: inline-flex; align-items: center; gap: .4rem;
    padding: .42rem 1rem; border-radius: var(--radius); cursor: pointer;
    font-size: 12.5px; font-weight: 400; border: none; transition: all .15s; white-space: nowrap;
}
.btn-primary {
    background: linear-gradient(135deg, var(--md-primary-40), var(--md-primary-30));
    color: #fff; box-shadow: 0 1px 4px rgba(179, 38, 30, 0.12);
}
.btn-primary:hover {
    background: linear-gradient(135deg, var(--md-primary-30), var(--md-primary-35));
    box-shadow: 0 2px 6px rgba(179, 38, 30, 0.14); transform: translateY(-1px);
}
.btn-primary:disabled { opacity: .6; cursor: not-allowed; transform: none; }
.btn-secondary {
    background: var(--color-surface); border: 2px solid var(--color-border); color: var(--color-text);
}
.btn-secondary:hover { border-color: var(--md-neutral-20); background: var(--md-neutral-95); }

/* ── Modal action buttons: simplified to primary/secondary only ─────── */
.modal .btn-icon-primary,
.modal .btn-secondary {
    color: #fff;
    box-shadow: 0 0 4px rgba(179, 38, 30, 0.25);
}
.modal .btn-secondary {
    padding: .42rem 1rem;
    font-weight: 600;
}
.modal .btn-icon-primary,
.modal .btn-icon-secondary {
    width: 32px;
    height: 32px;
    padding: 0;
    border-radius: 3px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.modal .btn-icon-primary svg,
.modal .btn-icon-secondary svg,
.modal .btn-secondary svg {
    color: #fff;
    stroke: currentColor;
    fill: currentColor;
}
.modal .btn-icon-primary img,
.modal .btn-icon-secondary img,
.modal .btn-secondary img {
    display: block;
    filter: brightness(0) invert(1);
}
.modal .btn-icon-primary:hover,
.modal .btn-secondary:hover {
    box-shadow: 0 0 5px rgba(179, 38, 30, 0.35);
    transform: translateY(-1px);
}
.modal .btn-icon-primary:disabled,
.modal .btn-icon-secondary:disabled,
.modal .btn-secondary:disabled {
    background: var(--md-neutral-80);
    border-color: var(--md-neutral-60);
    color: #fff;
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}
.modal .btn-icon:not(.btn-close):disabled,
.modal .btn-secondary:not(.btn-close):disabled {
    background: var(--md-success-40);
    border-color: var(--md-neutral-60);
    color: #fff;
    opacity: 1;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* ── Modal ────────────────────────────────────────────────────────── */
.modal-overlay {
    position: fixed; inset: 0; background: rgba(44,62,80,.5); backdrop-filter: blur(3px);
    display: flex; align-items: center; justify-content: center;
    z-index: 300; animation: fadeIn .15s ease;
}

/* When showing nested or secondary modals that must appear above existing ones */
/* removed debug-only top overlay class */
.modal {
    background: var(--color-surface); padding: 1.25rem; width: 572px;
    max-width: 95vw; border-radius: var(--radius-lg);
    box-shadow: 0 20px 60px rgba(50,50,50,.25);
    animation: slideUp .2s ease;
    border-top: 4px solid var(--md-primary-40);
}
.modal--wide {
    width: 1066px;
}
.modal-body-cols {
    display: flex; gap: 1.5rem;
}
.modal-col {
    flex: 1; min-width: 0;
}
.modal-col--depts {
    flex: 0 0 260px; border-left: 1px solid var(--color-border); padding-left: 1.25rem;
}
.dept-subsection-title {
    font-size: 11px; font-weight: 700; text-transform: uppercase;
    letter-spacing: .06em; color: var(--color-text-muted); margin-bottom: .4rem;
}
.dept-subsection-title--muted { opacity: .7; }
.dept-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: .3rem; }
.dept-list--inactive .dept-name { color: var(--color-text-muted); }
.dept-item {
    display: flex; align-items: center; gap: .4rem; padding: .3rem .4rem;
    border-radius: var(--radius); border: 1px solid var(--color-border);
    background: var(--color-bg); font-size: 13px;
}
.dept-item--primary {
    border-color: var(--md-primary-40); background: rgba(179, 38, 30, .04);
}
.dept-name { flex: 1; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dept-code { font-size: 11px; color: var(--color-text-muted); padding: 1px 5px; border-radius: 4px; background: var(--color-border); flex-shrink: 0; }
.dept-primary-btn {
    background: none; border: none; cursor: pointer; padding: 2px;
    color: #aaa; display: flex; border-radius: 4px; flex-shrink: 0;
    transition: color .15s;
}
.dept-primary-btn.active { color: #f39c12; }
.dept-primary-btn:hover { color: #f39c12; }
.dept-remove-btn {
    background: none; border: none; cursor: pointer; padding: 2px;
    color: var(--color-text-muted); display: flex; border-radius: 4px; flex-shrink: 0;
    transition: color .15s;
}
.dept-remove-btn:hover { color: var(--md-error-40); }
.dept-add-btn {
    background: none; border: none; cursor: pointer; padding: 2px;
    color: var(--color-text-muted); display: flex; border-radius: 4px; flex-shrink: 0;
    transition: color .15s;
}
.dept-add-btn:hover { color: var(--md-success-40); }
.dept-empty { font-size: 12.5px; color: var(--color-text-muted); font-style: italic; margin: .25rem 0; }
.badge-responsable {
    font-size: 10px; font-weight: 700; padding: 1px 5px; border-radius: 4px;
    background: #2471a3; color: #fff; flex-shrink: 0;
}
.spinner--sm { width: 14px; height: 14px; border-width: 2px; }
@keyframes slideUp { from { transform: translateY(16px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
.modal-header { display: flex; align-items: center; gap: .85rem; margin-bottom: 1.25rem; justify-content: space-between; }
.modal-header h2 { font-size: 16px; font-weight: 700; flex: 1; }
.modal-header-actions { display: flex; align-items: center; gap: 0.5rem; }
.modal-subtitle  { font-size: 12px; color: var(--color-text-muted); }
.btn-close {
    margin-left: 0;
    width: 32px;
    height: 32px;
    background: transparent;
    border: 1px solid transparent;
    cursor: pointer;
    color: var(--md-neutral-20);
    padding: 0;
    border-radius: 3px;
    box-shadow: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: background .15s, color .15s, border-color .15s;
}
.btn-close:hover {
    background: rgba(179, 38, 30, .08);
    border-color: rgba(179, 38, 30, .25);
    color: var(--color-primary);
}
.modal-section-title {
    font-size: 11px; font-weight: 700; text-transform: uppercase;
    letter-spacing: .07em; color: var(--color-text-muted); margin-bottom: .75rem;
}

/* Allocations modal specific layout */
.alloc-section {
     background: var(--color-surface); border: 1px solid var(--color-border);
     border-radius: var(--radius); padding: .75rem .9rem; margin-bottom: .75rem;
}
.alloc-section__title { font-weight:700; font-size:13px; margin-bottom:.5rem; }
.alloc-section__header { display: flex; flex-direction: column; gap: .35rem; margin-bottom: .55rem; }
.alloc-section__summary { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; }
.alloc-section__actions { display: flex; gap: .35rem; margin-left: auto; }
.alloc-list, .alloc-available {
     max-height: 220px; overflow:auto; border-radius:4px; padding: .25rem; background: transparent;
}
.alloc-actions { display:flex; gap:.5rem; align-items:center; margin-top:.5rem; }
.alloc-list table, .alloc-available table { margin:0; }
.role-checkboxes { display: flex; flex-direction: column; gap: .5rem; margin-bottom: 1.25rem; }
.role-option {
    display: flex; align-items: center; gap: .6rem; padding: .45rem .75rem;
    border: 2px solid var(--color-border); border-radius: var(--radius); cursor: pointer;
    transition: border-color .15s, background .15s;
}
.role-option:hover { border-color: var(--md-primary-40); background: rgba(179, 38, 30, .04); }
.role-option.checked { border-color: var(--md-primary-40); background: rgba(179, 38, 30, .06); }
.role-option input { accent-color: var(--md-primary-40); width: 15px; height: 15px; flex-shrink: 0; }
.role-info { display: flex; flex-direction: column; gap: .15rem; }
.role-info small { font-size: 11.5px; color: var(--color-text-muted); }
.modal-actions { display: flex; gap: .75rem; }
.error { color: var(--md-error-40); font-size: 13px; margin-bottom: .75rem; }

/* ── Welcome card ─────────────────────────────────────────────────── */
.welcome-loading { display: flex; align-items: center; gap: .6rem; color: var(--color-text-muted); padding: 2rem 0; }
.welcome-card {
    display: flex; align-items: flex-start; gap: 1.75rem;
    background: var(--color-surface); border-radius: var(--radius-lg);
    padding: 2rem 2.25rem; max-width: 580px;
    border: 1px solid var(--color-border);
    border-left: 5px solid var(--md-primary-40);
    box-shadow: 0 2px 12px rgba(50,50,50,.08);
}
.welcome-card-error { color: var(--color-text-muted); font-size: .9rem; }
.welcome-avatar {
    flex-shrink: 0; width: 68px; height: 68px; border-radius: 50%;
    background: linear-gradient(135deg, var(--md-primary-40), var(--md-primary-30));
    color: #fff; font-size: 1.5rem; font-weight: 800;
    display: flex; align-items: center; justify-content: center;
    box-shadow: 0 4px 14px rgba(179, 38, 30, 0.4);
}
.welcome-info { display: flex; flex-direction: column; gap: .4rem; }
.welcome-name  { font-size: 1.3rem; font-weight: 800; color: var(--color-text); }
.welcome-email { font-size: .875rem; color: var(--color-text-muted); }
.welcome-meta  { font-size: .8rem; color: var(--color-text-muted); display: flex; align-items: center; gap: .4rem; flex-wrap: wrap; }
.meta-sep      { color: var(--md-neutral-80); }
.welcome-roles { display: flex; align-items: center; gap: .4rem; flex-wrap: wrap; margin-top: .6rem; }
.welcome-roles-label { font-size: .75rem; color: var(--color-text-muted); margin-right: .1rem; }
.badge-empty   { font-size: .75rem; color: var(--color-text-muted); font-style: italic; }

/* ── Organigrama ──────────────────────────────────────────────────── */
.org-tabs {
    display: flex; gap: 0; margin-bottom: 1rem;
    border-bottom: 1px solid var(--color-border);
}
.org-tab {
    background: none; border: none; cursor: pointer;
    padding: .5rem 1rem;
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
    font-size: 13px; font-weight: 600; color: var(--color-text-muted);
    border-radius: 0;
    transition: color var(--transition), background var(--transition), border-color var(--transition);
}
.org-tab:hover   { background: var(--md-neutral-95); color: var(--color-text); }
.org-tab.active  { color: var(--md-primary-40); border-bottom-color: var(--md-primary-40); background: none; }

.org-panel {
    background: var(--color-surface); border: 1px solid var(--color-border);
    border-radius: var(--radius-lg); padding: 1rem 1.25rem;
    box-shadow: 0 1px 6px rgba(44,62,80,.06);
}

/* Barra de acción (selects + botón) */
.org-action-bar {
    display: flex; align-items: flex-end; gap: 1rem;
    flex-wrap: wrap; margin-bottom: 1.25rem;
}
.org-select-wrap { display: flex; flex-direction: column; gap: .3rem; }
.org-select-wrap label { font-size: 11px; font-weight: 700; text-transform: uppercase;
    letter-spacing: .05em; color: var(--color-text-muted); }
.org-select-wrap select {
    padding: .5rem .75rem; border: 2px solid var(--color-border);
    border-radius: var(--radius); font-size: 13px; background: var(--color-surface);
    color: var(--color-text); min-width: 200px;
    transition: border-color .15s;
}
.org-select-wrap select:focus { outline: none; border-color: var(--md-primary-40); }
.org-arrow { font-size: 1.2rem; color: var(--color-text-muted); padding-bottom: .35rem; }

/* Árbol */
.org-tree { padding: .5rem 0; display: flex; flex-direction: column; gap: 1.75rem; }

/* ── Nodo genérico ─────────────────────────────────────────────────── */
.org-node { position: relative; }

/* ── Tarjeta raíz (jefe) ──────────────────────────────────────────── */
.org-tree > .org-node > .org-node-card {
    background: var(--color-surface);
    border: 1.5px solid var(--md-primary-30);
    border-left: 4px solid var(--md-primary-30);
    box-shadow: 0 2px 10px rgba(179, 38, 30, .12);
    max-width: 400px;
}

/* ── Tarjeta hijo / descendiente ─────────────────────────────────── */
.org-node-card {
    display: flex; align-items: center; gap: .6rem;
    background: var(--md-neutral-95); border: 1px solid var(--color-border);
    border-radius: var(--radius); padding: .35rem .65rem;
    max-width: 360px;
    transition: box-shadow var(--transition);
}
.org-node-card:hover { box-shadow: 0 2px 8px rgba(44,62,80,.1); }
.org-avatar   { width: 32px !important; height: 32px !important; font-size: 11px !important; flex-shrink: 0; }

/* ── Profundidad: escala de color (niveles 1-5, máx.) ───────────── */
/* nivel 1 = raíz: ya estilizado por .org-tree > .org-node > .org-node-card */
.org-node-card.org-depth-2 { background: #fac8c3; border-color: #d95f52; }
.org-node-card.org-depth-3 { background: #fddcc8; border-color: #c8824e; }
.org-node-card.org-depth-4 { background: #fef0cc; border-color: #b89a44; }
.org-node-card.org-depth-5 { background: #e8e8e8; border-color: #909090; }

/* ── Delegaciones: escala lila (niveles 1-5, máx.) ─────────────── */
.org-delegate-card {
    border-left-width: 3px;
    border-left-style: solid;
}
.org-delegate-card.org-delegate-depth-1 { background: #e0c8f5; border-color: #7d3c98; border-left-color: #7d3c98; }
.org-delegate-card.org-delegate-depth-2 { background: #e8d5f7; border-color: #9b59b6; border-left-color: #9b59b6; }
.org-delegate-card.org-delegate-depth-3 { background: #efe0fa; border-color: #b07cc6; border-left-color: #b07cc6; }
.org-delegate-card.org-delegate-depth-4 { background: #f4eafc; border-color: #c39bd3; border-left-color: #c39bd3; }
.org-delegate-card.org-delegate-depth-5 { background: #f8f2fd; border-color: #d7bde2; border-left-color: #d7bde2; }
.org-delegate-tag {
    display: inline-flex; align-items: center; gap: .25rem;
    font-size: 10px; font-weight: 700; color: #7d3c98;
    text-transform: uppercase; letter-spacing: .04em;
}

.org-node-info { display: flex; flex-direction: column; gap: .15rem; flex: 1; min-width: 0; }
.org-node-name  { font-size: 13px; font-weight: 700; color: var(--color-text);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.org-node-email { font-size: 11px; color: var(--color-text-muted); }
.org-unlink { margin-left: auto; opacity: 0; transition: opacity .15s; }
.org-node-card:hover .org-unlink { opacity: 1; }

/* ── Columna de iconos decoradores (derecha del nodo) ─────────────── */
.org-decorator-col {
    display: grid;
    grid-template-rows: repeat(3, 22px);
    gap: 1px;
    flex-shrink: 0;
    align-self: center;
}
.org-decorator-cell {
    width: 22px; height: 22px;
    display: flex; align-items: center; justify-content: center;
    border-radius: 3px;
}
.org-decorator-cell img { display: block; }
.org-decorator-empty {
    background: transparent !important;
    box-shadow: none !important;
}

/* ──────────────────────────────────────────────────────────────────────
   Árbol de conectores
   Medidas base:
     card-height  ≈ 50px  (avatar 32px + padding .55rem×2 ≈ 18px)
     card-center  = 24px  (desde el top del .org-node)
     gap-siblings = .45rem (margin-top entre hermanos)
     trunk-x      = 2rem  (padding-left de .org-children → posición del tronco)
   ────────────────────────────────────────────────────────────────────── */
.org-children {
    position: relative;
    margin-left: 1.5rem;  /* desplaza el tronco bajo el área del avatar del padre */
    padding-left: 2rem;   /* espacio para el tronco + brazo horizontal */
    padding-top:  .5rem;  /* hueco entre la tarjeta del padre y el primer hijo */
    padding-bottom: 0;
    margin-top: 0;
}

/* Puente vertical: conecta la tarjeta del padre con el primer hijo
   Va desde el top de .org-children (= justo debajo de la tarjeta padre)
   hasta que empieza la línea ::after del primer hijo.              */
.org-children::before {
    content: '';
    position: absolute;
    left: 0;               /* alineado con las líneas ::after de los hijos */
    top: 0;
    height: .5rem;         /* = padding-top → tapa el hueco exacto */
    width: 1.5px;
    background: var(--color-border);
}

/* Cada hijo: space between siblings */
.org-children > .org-node              { position: relative; margin-top: .45rem; }
.org-children > .org-node:first-child  { margin-top: 0; }

/* ── Brazo horizontal: del tronco a la tarjeta ──────────────────── */
.org-children > .org-node::before {
    content: '';
    position: absolute;
    left: -2rem;      /* arranca en el tronco (left: 0 de .org-children) */
    width: 2rem;
    top: 22px;        /* centro vertical de la tarjeta */
    height: 1.5px;
    background: var(--color-border);
}

/* ── Segmento vertical (tronco) — no-último hermano ─────────────── */
/* Llega hasta el TOP del siguiente hermano (bridgeando el margin-top) */
.org-children > .org-node:not(:last-child)::after {
    content: '';
    position: absolute;
    left: -2rem;
    top: 0;
    bottom: calc(-0.45rem);  /* tapa el margin-top del siguiente hermano */
    width: 1.5px;
    background: var(--color-border);
}

/* ── Segmento vertical (tronco) — último hermano ────────────────── */
/* Solo llega al centro de la tarjeta, sin extenderse hacia abajo */
.org-children > .org-node:last-child::after {
    content: '';
    position: absolute;
    left: -2rem;
    top: 0;
    height: 23px;     /* hasta el centro de la tarjeta (= top 22px + 1px) */
    width: 1.5px;
    background: var(--color-border);
}

/* Usuarios sin jefe */
.org-orphans {
    margin-top: 1.25rem; border: 1px dashed var(--color-border);
    border-radius: var(--radius); padding: .75rem 1rem;
}
.org-orphans summary { cursor: pointer; font-size: 12px; font-weight: 600;
    color: var(--color-text-muted); user-select: none; }
.org-orphans-list { display: flex; flex-wrap: wrap; gap: .4rem; margin-top: .6rem; }
.org-chip {
    background: var(--md-neutral-95); border: 1px solid var(--color-border);
    border-radius: 20px; padding: .2rem .65rem; font-size: 12px; color: var(--color-text-muted);
}

/* ── Org panel toolbar ────────────────────────────────────────────── */
.org-panel-toolbar {
    display: flex; align-items: center; justify-content: space-between; gap: .5rem; margin-bottom: 1rem;
}

.panel-title {
    font-weight: 600; font-size: .9rem; color: var(--text-primary);
}

/* ── Delegation subordinate sections ─────────────────────────────── */
.hier-section {
    border-top: 1px solid var(--border);
    padding: .75rem 0;
}
.hier-section:first-of-type { border-top: none; }

.hier-section-header {
    display: flex; align-items: center; gap: .75rem; margin-bottom: .25rem;
}
.hier-section-header .btn-icon { margin-left: auto; }


/* ── Hierarchy modal ──────────────────────────────────────────────── */
.hierarchy-modal { max-width: 1100px; width: 96vw; }

.hierarchy-editor {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.25rem;
    height: 580px;
}

.hier-col {
    display: flex; flex-direction: column;
    gap: .75rem;
    min-height: 0;
}

/* Each row inside a column takes half the column height and scrolls independently */
.hier-row {
    display: flex; flex-direction: column;
    background: var(--md-neutral-95);
    border: 1px solid var(--color-border);
    border-radius: 10px;
    padding: .75rem;
    flex: 1;
    min-height: 0;
    overflow-y: auto;
}

.hier-filter-wrap {
    display: flex; align-items: center; gap: .4rem;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: 7px;
    padding: .3rem .6rem;
    margin-bottom: .6rem;
}
.hier-filter-wrap svg,
.hier-filter-wrap img { color: var(--color-text-muted); flex-shrink: 0; }
.hier-filter {
    border: none; background: transparent; outline: none;
    font-size: 13px; color: var(--color-text); width: 100%;
}
.hier-filter::placeholder { color: var(--color-text-muted); }
.hier-filter:disabled { cursor: not-allowed; opacity: .45; }

.hier-col-right { position: relative; }

.hier-user-list {
    list-style: none; padding: 0; margin: 0;
    display: flex; flex-direction: column; gap: .3rem;
}

.hier-user-item {
    display: flex; align-items: center; gap: .5rem;
    padding: .3rem .5rem;
    border-radius: 4px;
    cursor: pointer;
    transition: background .12s;
    font-size: 13px;
}
.hier-user-item:hover  { background: #e8e8e8; }
.hier-user-item.selected { background: #fde8e6; border: 1px solid #f5b7b1; }

.hier-unassigned .hier-user-item { opacity: .75; }
.hier-unassigned .hier-user-item:hover { opacity: 1; }

.hier-user-info { display: flex; flex-direction: column; gap: .05rem; }
.hier-user-name { font-weight: 600; color: var(--color-text); }
.hier-user-sub  { font-size: 11px; color: var(--color-text-muted); }

.hier-children .hier-user-item { background: var(--color-surface); border: 1px solid var(--color-border); }
.hier-children .hier-user-item:hover { background: #fef9f9; }

.hier-add-item { border: 1px dashed var(--color-border); }
.hier-add-item:hover { background: #eafaf1 !important; border-color: #a9dfbf; }
.hier-add-item svg,
.hier-add-item img { color: #27ae60; flex-shrink: 0; }

.hier-item-actions {
    margin-left: auto; display: flex; align-items: center; gap: 2px;
}

.hier-remove-btn {
    border: none; background: none;
    cursor: pointer; color: var(--md-error-40); opacity: 0;
    transition: opacity .15s; padding: 2px;
    display: flex; align-items: center;
}
.hier-user-item:hover .hier-remove-btn { opacity: 1; }

.hier-promote-btn {
    border: none; background: none;
    cursor: pointer; color: #c9a227; opacity: 0;
    transition: opacity .15s; padding: 2px;
    display: flex; align-items: center;
}
.hier-user-item:hover .hier-promote-btn { opacity: 1; }

.hier-placeholder {
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    flex: 1; gap: .6rem; color: var(--color-text-muted);
    font-size: 13px; text-align: center; padding: 1rem;
}
.hier-placeholder svg,
.hier-placeholder img { opacity: .35; }

.hier-empty-hint { font-size: 12px; color: var(--color-text-muted); padding: .3rem .4rem; margin: 0; }

/* ── Auth / loading screens ───────────────────────────────────────── */
.auth-status, .loading-auth, .loading-screen {
    display: flex; align-items: center; justify-content: center;
    height: 100vh; font-size: 16px; color: var(--color-text-muted);
}

/* ══════════════════════════════════════════════════════════════════════
   PRINT / PDF
   ══════════════════════════════════════════════════════════════════════ */
@media print {
    /* Ocultar todo lo que no sea el árbol */
    .topbar, .sidebar, .sidebar-overlay,
    .org-tabs, .org-panel-toolbar,
    .page-subtitle,
    .modal-overlay { display: none !important; }

    /* Ajustar layout */
    body { background: #fff !important; font-size: 12px; }
    .main-content { margin-left: 0 !important; padding: 1cm !important; }

    /* Encabezado de página impresa */
    .page-header { margin-bottom: 1rem; }
    .page-heading-icon { display: none; }
    .page-title { font-size: 18px !important; color: #2d2d2d !important; }

    /* Panel y árbol */
    .org-panel {
        border: none !important;
        box-shadow: none !important;
        padding: 0 !important;
    }
    .org-tree { gap: 1.25rem !important; }

    /* Tarjeta raíz */
    .org-tree > .org-node > .org-node-card {
        border: 1.5px solid var(--md-primary-30) !important;
        border-left: 4px solid var(--md-primary-30) !important;
        box-shadow: none !important;
        background: #fff !important;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }

    /* Tarjetas hijas */
    .org-node-card {
        background: #f9f9f9 !important;
        box-shadow: none !important;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
        page-break-inside: avoid;
    }

    /* Avatares y badges en color */
    .user-avatar, .org-avatar {
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }
    .badge {
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }

    /* Líneas de árbol */
    .org-children::before,
    .org-children > .org-node::before,
    .org-children > .org-node::after {
        background: #aaa !important;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }

    /* Evitar cortes de página en el interior de un nodo con hijos */
    .org-node { page-break-inside: avoid; }
}

/* ═══════════════════════════════════════════════════════════════════
   SETTINGS — pivot layout
   ═══════════════════════════════════════════════════════════════════ */
.settings-pivot {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.pivot-tabs {
    display: flex;
    gap: 2px;
    border-bottom: 2px solid var(--color-border);
    margin-bottom: 1.25rem;
}

.pivot-tab {
    display: inline-flex;
    align-items: center;
    gap: .45rem;
    padding: .55rem 1.1rem;
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    font-size: 13.5px;
    font-weight: 500;
    color: var(--md-neutral-20);
    cursor: pointer;
    border-radius: var(--radius) var(--radius) 0 0;
    transition: color var(--transition), border-color var(--transition), background var(--transition);
}
.pivot-tab img,
.pivot-tab svg {
    color: var(--md-neutral-20);
    fill: currentColor;
    stroke: currentColor;
    transition: color var(--transition), fill var(--transition), stroke var(--transition);
}
.pivot-tab:hover {
    color: var(--md-neutral-10);
    background: rgba(0,0,0,.03);
}
.pivot-tab:hover img,
.pivot-tab:hover svg {
    color: var(--md-neutral-10);
}
.pivot-tab.active {
    color: var(--color-primary);
    border-bottom-color: var(--color-primary);
}
.pivot-tab.active img,
.pivot-tab.active svg {
    color: var(--color-primary);
}

.pivot-panel { min-height: 200px; }

/* ── Panel toolbar (shared between UsersPanel & DepartmentsPanel) ── */
.panel-toolbar {
    display: flex;
    align-items: center;
    gap: .6rem;
    margin-bottom: 1rem;
}

/* ── Departments panel helpers ──────────────────────────────────── */
.dept-code {
    font-size: 12px;
    background: var(--md-neutral-95);
    border-radius: 3px;
    padding: 1px 6px;
    color: var(--color-text-muted);
    letter-spacing: .04em;
}

.modal-wide { max-width: 560px; }

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: .75rem;
}
.form-group { display: flex; flex-direction: column; gap: .3rem; }
.form-group label { font-size: 12px; font-weight: 600; color: var(--color-text-muted); }
.form-input {
    padding: .45rem .6rem;
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    font-size: 13px;
    color: var(--color-text);
    background: #fff;
    transition: border-color var(--transition);
}
.form-input:focus { outline: none; border-color: var(--color-primary); }
select.form-input { cursor: pointer; }

.member-list {
    display: flex;
    flex-direction: column;
    gap: .3rem;
    max-height: 180px;
    overflow-y: auto;
    padding-right: 2px;

/* ── Audit Log Panel ─────────────────────────────────────────────── */
.table-meta { font-size: 12px; color: var(--color-text-muted); margin-bottom: .4rem; }
.alert { padding: .75rem 1rem; border-radius: var(--radius); font-size: 13.5px; }
.alert-error { background: #fdecea; color: var(--md-error-40); border: 1px solid #f5c6c6; }
    margin-bottom: .25rem;
}
.member-item {
    display: flex;
    align-items: center;
    gap: .5rem;
    padding: .25rem .4rem;
    border-radius: var(--radius);
    background: var(--md-neutral-95);
}
.member-name { flex: 1; font-size: 13px; }

.add-member-row {
    display: flex;
    gap: .5rem;
    align-items: center;
}
.add-member-row select { flex: 1; }

.btn-icon-sm {
    width: 26px !important;
    height: 26px !important;
}
.btn-icon-danger {
    color: #fff;
    border-color: var(--md-error-20);
}
.btn-icon-danger:hover {
    background: linear-gradient(135deg, var(--md-error-30), var(--md-error-60));
    border-color: var(--md-error-30);
    color: #fff;
    box-shadow: 0 0 5px rgba(98, 80, 181, 0.45);
    transform: translateY(-1px);
}
.text-muted { color: var(--color-text-muted); }

/* ═══════════════════════════════════════════════════════════════════
   DEPARTMENT EDITOR MODAL
   ═══════════════════════════════════════════════════════════════════ */

.modal-dept-editor {
    width: min(1120px, 98vw);
    max-width: none;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* Fixed-height grid — columns never grow or shrink with content */
.dept-editor-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr);
    gap: 1.25rem;
    height: 500px;      /* fixed, same role as .hierarchy-editor height */
    min-height: 0;
    margin-top: .5rem;
    flex-shrink: 0;     /* prevent the modal from squeezing the grid */
}

/* Variante: 3 columnas para modal de propiedades */
.dept-editor-grid-3col {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr) minmax(0, 1.2fr);
}

.dept-col-left {
    display: flex;
    flex-direction: column;
    gap: .75rem;
    height: 100%;
    min-height: 0;
    overflow: hidden;
}

/* Properties box fills available space and scrolls if needed */
.dept-props-box {
    display: flex;
    flex-direction: column;
    gap: .6rem;
    background: var(--md-neutral-95);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    padding: .75rem;
    flex: 1;            /* fill remaining col height */
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
}

.dept-responsable-badge {
    display: flex;
    align-items: center;
    gap: .5rem;
    background: var(--md-neutral-95);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    padding: .35rem .6rem;
    font-size: 13px;
    font-weight: 500;
}
.dept-responsable-badge span { flex: 1; }

/* Tooltips de los botones guardar/cancelar: hacia abajo para no quedar recortados por overflow */
.dept-props-box [data-tooltip]::after {
    bottom: auto;
    top: calc(100% + 7px);
    transform: translateX(-50%) scale(.9);
}
.dept-props-box [data-tooltip]::before {
    bottom: auto;
    top: calc(100% + 3px);
    border-top-color: transparent;
    border-bottom-color: #1a1a1a;
}
.dept-props-box [data-tooltip]:hover::after  { transform: translateX(-50%) scale(1); }


/* ═══════════════════════════════════════════════════════════════════════
   DISTRIBUCIÓN DE HORAS — modal y componentes
   ═══════════════════════════════════════════════════════════════════════ */

/* Botón de acción — variante teal (distribuir) */
.btn-icon-teal {
    color: #0d9488;
}
.btn-icon-teal:hover:not(:disabled) {
    background: #ccfbf1;
    color: #0f766e;
}

/* Modal de distribución: misma estructura que allocations-modal */
.dist-modal {
    width: min(780px, 96vw);
    max-height: 88vh;
    display: flex;
    flex-direction: column;
}

/* Badges */
.dist-hdc-badge {
    display: inline-block;
    background: #dbeafe;
    color: #1d4ed8;
    border-radius: 5px;
    padding: .1rem .45rem;
    font-size: .72rem;
    font-weight: 700;
    letter-spacing: .03em;
}

.dist-wt-badge {
    display: inline-block;
    background: #f3f4f6;
    color: #6b7280;
    border-radius: 5px;
    padding: .1rem .4rem;
    font-size: .72rem;
    font-family: monospace;
}

/* Horas restantes */
.dist-remain {
    font-size: .78rem;
    color: #374151;
    white-space: nowrap;
}
.dist-over {
    font-size: .78rem;
    color: #dc2626;
    font-weight: 600;
    white-space: nowrap;
}

/* Barra de progreso */
.dist-progress-bar {
    flex: 1;
    min-width: 60px;
    max-width: 120px;
    height: 6px;
    background: #e5e7eb;
    border-radius: 3px;
    overflow: visible;
    position: relative;
}

.dist-progress-fill {
    height: 100%;
    border-radius: 3px;
    transition: width .3s ease;
    position: absolute;
    top: 0;
    left: 0;
}
.dist-progress-fill.dist-progress--green  { background: #22c55e; }
.dist-progress-fill.dist-progress--orange { background: #f97316; }
.dist-progress-fill.dist-progress--red    { background: #ef4444; }

/* Overlay de horas imputadas (superpuesto) */
.dist-progress-used {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    border-radius: 3px;
    background: rgba(0, 0, 0, 0.5);
    z-index: 2;
}

/* Marcador de horas imputadas */
.dist-progress-marker {
    position: absolute;
    top: 50%;
    width: 2px;
    height: 12px;
    background: #333;
    border-radius: 1px;
    transform: translateX(-50%) translateY(-50%);
    cursor: pointer;
    z-index: 3;
}

/* Tabla de usuarios dentro del grupo */
.dist-table {
    width: 100%;
    border-collapse: collapse;
    font-size: .82rem;
    margin-bottom: .4rem;
}
.dist-table thead th {
    font-size: .73rem;
    font-weight: 600;
    color: #6b7280;
    padding: .2rem .4rem;
    border-bottom: 1px solid var(--color-border, #dee2e6);
    text-transform: uppercase;
    letter-spacing: .04em;
}
.dist-table tbody tr:hover {
    background: rgba(0,0,0,.025);
}

.alloc-cell {
    padding: .3rem .4rem;
    vertical-align: middle;
}
.alloc-cell--right  { text-align: right; }
.alloc-cell--center { text-align: center; }

/* Input de horas en la tabla */
.dist-hours-input {
    width: 90px;
    text-align: right;
    padding: .25rem .4rem;
    font-size: .82rem;
}

/* Badge de porcentaje por usuario */
.dist-pct-badge {
    display: inline-block;
    background: #f3f4f6;
    color: #374151;
    border-radius: 5px;
    padding: .1rem .35rem;
    font-size: .72rem;
    font-weight: 600;
    min-width: 46px;
    text-align: right;
}

/* Selector para añadir usuario */
.dist-add-user {
    margin-top: .35rem;
}
.dist-user-select {
    font-size: .8rem;
    padding: .3rem .5rem;
    max-width: 360px;
}

/* Botones pequeños de acción rápida (= Igual, ✕ Limpiar) */
.btn-xs {
    display: inline-flex;
    align-items: center;
    gap: .25rem;
    padding: .2rem .5rem;
    font-size: .72rem;
    font-weight: 600;
    border: 1px solid transparent;
    border-radius: 5px;
    cursor: pointer;
    background: transparent;
    line-height: 1.3;
    transition: background .15s, color .15s;
}
.btn-xs:disabled {
    color: #9ca3af;
    border-color: #e5e7eb;
    cursor: not-allowed;
    opacity: 0.6;
}
.btn-xs--teal {
    color: #0d9488;
    border-color: #99f6e4;
}
.btn-xs--teal:hover {
    background: #ccfbf1;
    border-color: #0d9488;
}
.btn-xs--danger {
    color: #dc2626;
    border-color: #fecaca;
}
.btn-xs--danger:hover {
    background: #fee2e2;
    border-color: #dc2626;
}

/* ── Time Entry / Work Calendar ─────────────────────────────────── */
.time-entry-header {
    align-items: center;
}



.time-entry-calendar-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 1rem;
    max-width: 1200px;
    margin: 0 auto;
}

.time-entry-calendar-grid.single-month {
    grid-template-columns: minmax(0, 1fr);
}

.time-entry-requests-panel {
    margin-top: 1.5rem;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    padding: 0;
    max-width: 1200px;
    margin-left: auto;
    margin-right: auto;
    overflow: hidden;
}

.time-entry-requests-header {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 0;
    padding: 1rem 1rem .75rem 1rem;
    border-bottom: 1px solid var(--color-border);
}

.time-entry-requests-header-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.time-entry-requests-filter {
    display: inline-flex;
    align-items: center;
    gap: .35rem;
    font-size: .85rem;
    color: var(--color-text);
}

.time-entry-requests-table {
    max-height: 320px;
    overflow: auto;
    padding: 0;
}

.time-entry-requests-panel .table-card {
    border: none;
    margin: 0;
    border-radius: 0;
    box-shadow: none;
}

.time-entry-requests-panel .users-table th {
    border-bottom: none;
}

.time-entry-requests-panel .users-table td {
    border-bottom: none;
}

.time-entry-requests-panel .users-table tr:last-child td {
    border-bottom: none;
}

.time-entry-month-card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    padding: .75rem;
}

.time-entry-month-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .75rem;
    margin-bottom: .5rem;
    flex-wrap: wrap;
}

.time-entry-month-title {
    font-size: 1rem;
    font-weight: 700;
    text-transform: capitalize;
    color: var(--color-text);
}

.time-entry-month-actions {
    display: flex;
    align-items: center;
    gap: .5rem;
    flex-wrap: wrap;
}

.time-entry-month-card h3 {
    margin-bottom: .5rem;
    text-transform: capitalize;
    font-size: 1rem;
}

.time-entry-weekdays,
.time-entry-days-grid {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    gap: .35rem;
}

.time-entry-weekdays {
    margin-bottom: .35rem;
}

.time-entry-weekdays span {
    text-align: center;
    font-size: .72rem;
    color: var(--color-text-muted);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .04em;
}

.time-entry-day {
    min-height: 92px;
    border: 1px solid var(--color-border);
    border-radius: 4px;
    padding: .25rem;
    background: #fff;
    display: flex;
    flex-direction: column;
    gap: .2rem;
    position: relative;
    padding-right: .6rem;
    --tile-border-color: var(--color-border);
}

.time-entry-day-icon-stack {
    position: absolute;
    right: 6px;
    top: 6px;
    display: inline-flex;
    gap: 4px;
    align-items: center;
    justify-content: center;
    color: var(--tile-border-color);
}

.time-entry-day-icon-stack > span {
    width: 16px;
    height: 16px;
}

.time-entry-day-tooltip {
    margin-top: auto;
    font-size: .7rem;
    color: var(--tile-border-color);
    text-align: center;
    font-weight: 600;
}

.time-entry-day-progress {
    position: absolute;
    right: 0;
    top: 0;
    bottom: 0;
    width: 6px;
    background: transparent;
    border-top-right-radius: 4px;
    border-bottom-right-radius: 4px;
    overflow: hidden;
    color: var(--tile-border-color);
}

.time-entry-day-progress::after {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: calc(var(--progress, 0) * 1%);
    background: currentColor;
    border-top-right-radius: 4px;
    border-bottom-right-radius: 4px;
}

.time-entry-day.empty {
    border: none;
    background: transparent;
}

.time-entry-day.weekend {
    background: var(--day-weekend-bg);
    border-color: var(--day-weekend-border);
    --tile-border-color: var(--day-weekend-border);
}

.time-entry-day.additional-holiday {
    background: var(--day-weekend-bg);
    border-color: var(--day-weekend-border);
    --tile-border-color: var(--day-weekend-border);
}

.time-entry-day.special-day {
    background: #e6f3ff;
    border-color: #7dbcf2;
    --tile-border-color: #7dbcf2;
}

.time-entry-day.vacation-approved {
    background: var(--day-vacation-approved-bg);
    border-color: var(--day-vacation-approved-border);
    --tile-border-color: var(--day-vacation-approved-border);
}

.time-entry-day.vacation-pending {
    background: var(--day-vacation-pending-bg);
    border-color: var(--day-vacation-pending-border);
    --tile-border-color: var(--day-vacation-pending-border);
}

.time-entry-day.incomplete-past-day {
    background: var(--day-incomplete-bg);
    border-color: var(--day-incomplete-border);
    --tile-border-color: var(--day-incomplete-border);
}

.time-entry-day.completed-day {
    background: var(--day-completed-bg);
    border-color: var(--day-completed-border);
    --tile-border-color: var(--day-completed-border);
}

.time-entry-day.sick-leave {
    background: linear-gradient(180deg, #e0f2fe 0%, #b3e5fc 100%);
    border: 1px solid #4fc3f7;
    --tile-border-color: #4fc3f7;
}

.time-entry-day.sick-leave .time-entry-day-icon-stack {
    color: #4fc3f7;
}

.time-entry-day.leave {
    background: linear-gradient(180deg, #e0f2fe 0%, #b3e5fc 100%);
    border: 1px solid #4fc3f7;
    --tile-border-color: #4fc3f7;
}

.time-entry-day.leave .time-entry-day-icon-stack {
    color: #4fc3f7;
}

.time-entry-day.project-hours {
    background: var(--day-project-hours-bg);
    border-color: var(--day-project-hours-border);
    --tile-border-color: var(--day-project-hours-border);
}



.time-entry-day-number {
    font-weight: 700;
    font-size: .82rem;
}

.time-entry-day-hours {
    font-size: .78rem;
    font-weight: 600;
}

.time-entry-day-summary {
    font-size: .65rem;
    font-weight: 500;
    color: var(--color-secondary);
    margin-top: auto;
    padding-top: .2rem;
    border-top: 1px solid rgba(0, 0, 0, 0.05);
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.work-calendar-settings .panel-toolbar {
    margin-bottom: 1rem;
    align-items: center;
}

.work-calendar-toolbar-left {
    display: flex;
    align-items: center;
    gap: .65rem;
    flex-wrap: wrap;
    min-width: 0;
}

.work-calendar-year-strip {
    position: relative;
    display: flex;
    align-items: center;
    gap: .45rem;
    min-width: 0;
}

.work-calendar-year-track-wrap {
    position: relative;
    width: 470px;
    max-width: 60vw;
    overflow: hidden;
    border: 1px solid var(--color-border);
    border-radius: 4px;
    background: var(--color-surface);
    padding: .28rem .55rem;
}

.work-calendar-year-track-wrap::before,
.work-calendar-year-track-wrap::after {
    content: "";
    position: absolute;
    top: 0;
    bottom: 0;
    width: 38px;
    pointer-events: none;
    z-index: 1;
}

.work-calendar-year-track-wrap::before {
    left: 0;
    background: linear-gradient(90deg, var(--color-surface) 0%, rgba(255,255,255,0) 100%);
}

.work-calendar-year-track-wrap::after {
    right: 0;
    background: linear-gradient(270deg, var(--color-surface) 0%, rgba(255,255,255,0) 100%);
}

.work-calendar-year-track {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    align-items: center;
    justify-items: center;
    gap: .35rem;
}

.work-calendar-year-item {
    color: var(--md-neutral-50);
    font-size: 14px;
    font-weight: 400;
    opacity: .95;
    background: transparent;
    border: none;
    padding: .15rem .25rem;
    border-radius: 3px;
    cursor: pointer;
}

.work-calendar-year-item:hover {
    background: rgba(0,0,0,.04);
}

.work-calendar-year-item.has-config {
    font-weight: 700;
}

.work-calendar-year-item.selected {
    color: var(--color-primary);
    font-weight: 800;
    transform: scale(1.06);
}

.work-calendar-year-nav {
    width: 28px;
    height: 28px;
    min-width: 28px;
    font-size: 14px;
    font-weight: 800;
}

.work-calendar-year-hint {
    font-size: 12px;
    color: var(--color-text-muted);
}

.work-calendar-panels-row {
    display: grid;
    grid-template-columns: repeat(3, minmax(350px, 1fr));
    gap: 1rem;
    align-items: start;
}

.work-calendar-panel-card {
    margin-bottom: 0;
}

/* Vacation tile states */
.time-entry-day.vacation-pending {
    background: linear-gradient(180deg, #fff9e6 0%, #fff3cf 100%);
    border: 1px solid #f0d57a;
}

.time-entry-day.vacation-approved {
    background: linear-gradient(180deg, #e8faea 0%, #d9f6d6 100%);
    border: 1px solid #9be29a;
}

.work-calendar-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: .6rem .875rem;
    border-bottom: 1px solid #f2f4f7;
}

.work-calendar-card-header h3 {
    margin: 0;
    font-size: 13px;
    font-weight: 700;
    color: var(--color-text);
}

.work-calendar-hours-input {
    max-width: 120px;
}

.work-calendar-empty-cell {
    color: var(--color-text-muted);
    font-style: italic;
    text-align: center;
    padding: 1rem .875rem !important;
}

@media (max-width: 1200px) {
    .time-entry-calendar-grid {
        grid-template-columns: 1fr;
    }

    .work-calendar-panels-row {
        grid-template-columns: repeat(2, minmax(350px, 1fr));
    }
}

@media (max-width: 768px) {
    .work-calendar-toolbar-left {
        width: 100%;
    }

    .work-calendar-year-track-wrap {
        width: 100%;
        max-width: 100%;
    }
}

/* ── User Search Multi-Select Component ────────────────────────── */
.user-search-multi-select {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.user-search-multi-select .search-input-wrapper {
    position: relative;
}

.user-search-multi-select .search-input {
    width: 100%;
    padding: 0.45rem 0.6rem;
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    font-size: 13px;
    color: var(--color-text);
    background: #fff;
    transition: border-color var(--transition);
}

.user-search-multi-select .search-input:focus {
    outline: none;
    border-color: var(--color-primary);
}

.user-search-multi-select .suggestions-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: #fff;
    border: 1px solid var(--color-border);
    border-top: none;
    border-radius: 0 0 var(--radius) var(--radius);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    z-index: 1000;
    max-height: 200px;
    overflow-y: auto;
}

.user-search-multi-select .suggestion-item {
    padding: 0.6rem 0.75rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 13px;
    color: var(--color-text);
    transition: background-color var(--transition);
    border-bottom: 1px solid var(--color-border);
}

.user-search-multi-select .suggestion-item:last-child {
    border-bottom: none;
}

.user-search-multi-select .suggestion-item:hover {
    background-color: var(--color-bg);
}

.user-search-multi-select .suggestion-item.all-option {
    background-color: #f9f9f9;
    font-weight: 600;
    color: var(--color-primary);
    border-bottom: 1px solid var(--color-border);
}

.user-search-multi-select .suggestion-item.selected {
    background-color: rgba(231, 76, 60, 0.05);
    color: var(--color-primary);
}

.user-search-multi-select .suggestion-checkbox {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
    border: 1px solid var(--color-border);
    border-radius: 2px;
    font-weight: 700;
    font-size: 12px;
    color: var(--color-primary);
    flex-shrink: 0;
}

.user-search-multi-select .suggestion-item.selected .suggestion-checkbox {
    background-color: var(--color-primary);
    border-color: var(--color-primary);
    color: #fff;
}

.user-search-multi-select .suggestion-text {
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-search-multi-select .selected-items {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
}

.user-search-multi-select .selected-item-tag {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.3rem 0.6rem;
    background-color: rgba(231, 76, 60, 0.1);
    border: 1px solid rgba(231, 76, 60, 0.3);
    border-radius: var(--radius);
    font-size: 12px;
    color: var(--color-primary);
    white-space: nowrap;
}

/* ── Subordinates Hours Summary ─────────────────────────────────────────────── */
.subordinates-summary-container {
    padding: 0;
}

.subordinates-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(420px, 1fr));
    gap: 1.5rem;
    padding: 1rem 0;
}

.subordinate-card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    padding: 1rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    transition: box-shadow var(--transition), border-color var(--transition);
}

.subordinate-card:hover {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    border-color: var(--color-primary);
}

.subordinate-header {
    margin-bottom: 1rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--color-border);
}

.subordinate-name {
    font-weight: 600;
    font-size: 14px;
    color: var(--color-text);
    margin-bottom: 0.25rem;
}

.subordinate-email {
    font-size: 12px;
    color: var(--color-text-muted);
}

.subordinate-calendar {
    min-height: 200px;
}

.mini-calendar {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.mini-calendar-header {
    text-align: center;
    font-weight: 600;
    font-size: 13px;
    color: var(--color-text);
    padding: 0.5rem 0;
    background: linear-gradient(90deg, var(--sidebar-active-from), var(--sidebar-active-to));
    color: white;
    border-radius: var(--radius);
}

.mini-calendar-weekdays {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 2px;
    margin-bottom: 0.25rem;
}

.mini-calendar-weekdays > span {
    text-align: center;
    font-weight: 600;
    font-size: 11px;
    color: var(--color-text-muted);
    padding: 0.25rem;
}

.mini-calendar-days {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 2px;
}

.mini-calendar-day {
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    font-weight: 500;
    background: var(--color-bg);
    border: 1px solid var(--color-border);
    border-radius: 2px;
    color: var(--color-text);
    cursor: pointer;
    transition: all var(--transition);
}

.mini-calendar-day:hover {
    background: var(--color-surface);
    border-color: var(--color-primary);
    box-shadow: 0 0 4px rgba(231, 76, 60, 0.2);
}

/* Day color states for mini calendars */
.mini-calendar-day.weekend {
    background: var(--day-weekend-bg);
    border-color: var(--day-weekend-border);
}

.mini-calendar-day.holiday {
    background: var(--day-weekend-bg);
    border-color: var(--day-weekend-border);
}

.mini-calendar-day.vacation-pending {
    background: var(--day-vacation-pending-bg);
    border-color: var(--day-vacation-pending-border);
}

.mini-calendar-day.vacation-approved {
    background: var(--day-vacation-approved-bg);
    border-color: var(--day-vacation-approved-border);
    color: #000;
}

.mini-calendar-day.absence-pending {
    background: var(--day-absence-pending-bg);
    border-color: var(--day-absence-pending-border);
    color: #000;
}

.mini-calendar-day.absence-approved {
    background: var(--md-blue-200);
    border-color: var(--md-blue-500);
    color: #ffffff;
    font-weight: 600;
}

.mini-calendar-day.project-hours {
    background: var(--day-project-hours-bg);
    border-color: var(--day-project-hours-border);
    color: #000;
}

.mini-calendar-day.incomplete {
    background: var(--day-incomplete-bg);
    border-color: var(--day-incomplete-border);
    color: #000;
}

.mini-calendar-day.completed {
    background: var(--day-completed-bg);
    border-color: var(--day-completed-border);
    color: #000;
}


.user-search-multi-select .remove-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
    padding: 0;
    background: none;
    border: none;
    color: var(--color-primary);
    font-size: 16px;
    cursor: pointer;
    transition: opacity var(--transition);
    flex-shrink: 0;
}

.user-search-multi-select .remove-btn:hover {
    opacity: 0.7;
}

/* ── Department Hours Table ──────────────────────────────────────────────── */
.department-hours-container {
    padding: 1rem 0;
}

.department-hours-header {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 1.5rem;
}

.month-navigation {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 1rem;
}

.btn-nav-prev,
.btn-nav-next {
    background: var(--color-primary);
    color: white;
    border: none;
    border-radius: var(--radius);
    padding: 0.5rem 0.75rem;
    font-size: 16px;
    cursor: pointer;
    transition: all var(--transition);
    display: flex;
    justify-content: center;
    align-items: center;
    width: 40px;
    height: 40px;
}

.btn-nav-prev:hover,
.btn-nav-next:hover {
    background: var(--color-primary-h);
    transform: scale(1.05);
}

.btn-nav-prev:disabled,
.btn-nav-next:disabled {
    background: var(--color-border);
    color: var(--color-text-muted);
    cursor: not-allowed;
    transform: none;
}

.month-display {
    min-width: 180px;
    text-align: center;
}

.month-name {
    font-size: 16px;
    font-weight: 600;
    color: var(--color-text);
    text-transform: capitalize;
}

.hours-table-wrapper {
    overflow: hidden;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    background: var(--color-surface);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.departments-grid {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.department-table-card {
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    background: var(--color-surface);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    overflow: hidden;
}

.department-hours-table {
    width: calc(100% + 1px);
    border-collapse: collapse;
    font-size: 14px;
    font-weight: 300;
    margin-right: -1px;
    margin-bottom: -1px;
}

.department-hours-table thead {
    background: linear-gradient(90deg, var(--sidebar-active-from), var(--sidebar-active-to));
    color: white;
    font-weight: 600;
    position: sticky;
    top: 0;
    z-index: 10;
}

.department-header-row {
    background: linear-gradient(90deg, var(--sidebar-active-from), var(--sidebar-active-to)) !important;
}

.department-header-cell {
    padding: 0 !important;
}

.department-toggle {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    width: 100%;
    padding: 0.75rem 1rem;
    background: none;
    border: none;
    color: white;
    font-weight: 600;
    cursor: pointer;
    text-align: left;
    font-size: 14px;
    transition: opacity 0.2s;
}

.department-toggle:hover {
    opacity: 0.85;
}

.toggle-icon {
    display: inline-block;
    min-width: 20px;
    text-align: center;
    font-size: 12px;
}

.department-name {
    flex: 1;
}

.department-hours-table thead th {
    padding: 0.5rem 0.25rem;
    text-align: center;
    border-right: 1px solid rgba(255, 255, 255, 0.2);
}

.department-hours-table thead th.col-name {
    text-align: left;
    padding-left: 0.75rem;
    min-width: 120px;
    width: 15%;
}

.department-hours-table thead th.col-day {
    min-width: 32px;
    width: calc(85% / 31);
    padding: 0.35rem 0;
}

.department-hours-table thead th.col-day.weekend-header {
    background: rgba(0, 0, 0, 0.15);
}

.department-hours-table thead th.col-day.holiday-header {
    background: rgba(0, 0, 0, 0.15);
}

.day-header-number {
    font-weight: 700;
    font-size: 11px;
}

.day-header-abbr {
    font-size: 9px;
    font-weight: 400;
    opacity: 0.8;
}

.department-hours-table tbody tr {
    border-bottom: 1px solid var(--color-border);
    transition: background var(--transition);
}

.department-hours-table tbody tr:hover {
    background: var(--color-bg);
}

.department-hours-table tbody td {
    padding: 0.35rem 0.25rem;
    text-align: center;
    height: 40px;
    vertical-align: middle;
    border-right: 1px solid var(--color-border);
}

.department-hours-table tbody td.col-name {
    font-weight: 500;
    text-align: left;
    padding-left: 0.75rem;
    color: var(--color-text);
    background: var(--color-bg);
    position: sticky;
    left: 0;
    z-index: 5;
    max-width: 120px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.department-hours-table tbody td.day-cell {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    font-weight: 600;
    font-size: 11px;
    transition: all var(--transition);
    cursor: default;
    position: relative;
}

.department-hours-table tbody td.day-cell:hover {
    background-color: opacity(var(--color-surface), 0.9);
}

/* Day cell color states */
.department-hours-table tbody td.day-cell.weekend {
    background: var(--md-red-500);
    border-color: var(--color-border);
    position: relative;
    z-index: 3;
    color: #ffffff;
}

.department-hours-table tbody td.day-cell.normal-day {
    background: var(--color-surface);
    border-color: var(--color-border);
}

.department-hours-table tbody td.day-cell.vacation-pending {
    background: var(--day-vacation-pending-bg);
    border-color: var(--color-border);
    color: var(--md-amber-900);
}

.department-hours-table tbody td.day-cell.vacation-approved {
    background: var(--day-vacation-approved-bg);
    border-color: var(--color-border);
    color: var(--md-light-green-900);
}

.department-hours-table tbody td.day-cell.absence-pending {
    background: var(--day-absence-pending-bg);
    border-color: var(--color-border);
    color: var(--md-blue-900);
}

.department-hours-table tbody td.day-cell.absence-approved {
    background: var(--md-blue-200);
    border-color: var(--md-blue-500);
    color: var(--md-blue-900);
}

.department-hours-table tbody td.day-cell.project-hours {
    background: var(--day-project-hours-bg);
    border-color: var(--color-border);
    color: #000;
}

.department-hours-table tbody td.day-cell.incomplete {
    background: var(--day-incomplete-bg);
    border-color: var(--color-border);
    color: #ffffff;
}

.department-hours-table tbody td.day-cell.completed {
    background: var(--day-completed-bg);
    border-color: var(--color-border);
    color: #000;
}

.day-hours {
    font-weight: 700;
    font-size: 10px;
}

/* ─── Data Table ────────────────────────────────────────────────── */
.data-table {
    width: 100%;
    border-collapse: collapse;
    margin: 0;
}

.data-table th {
    background: var(--color-surface);
    padding: .5rem .875rem;
    text-align: left;
    font-weight: 600;
    font-size: 12px;
    color: var(--color-text);
    letter-spacing: 0;
    border-bottom: 2px solid var(--md-primary-40);
}

.data-table td {
    padding: .5rem .875rem;
    vertical-align: middle;
    font-size: 13px;
    border-bottom: 1px solid #f2f4f7;
}

.data-table tr:last-child td {
    border-bottom: none;
}

.data-table tbody tr {
    transition: background var(--transition);
}

.data-table tbody tr:hover td {
    background: #fff5f5;
}

/* Blazor Error UI */
#blazor-error-ui {
    position: fixed;
    top: 0;
    right: 0;
    background: #b3261e;
    color: white;
    padding: 1rem;
    z-index: 10000;
    border-radius: 4px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    display: none;
    max-width: 400px;
}

#blazor-error-ui.show {
    display: block;
}

#blazor-error-ui a {
    color: white;
    text-decoration: underline;
    margin-left: 1rem;
    cursor: pointer;
}

#blazor-error-ui a:hover {
    text-decoration: none;
}

#blazor-error-ui .dismiss {
    float: right;
    font-size: 1.2rem;
    cursor: pointer;
}
