* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: Arial, Helvetica, sans-serif;
    background: #f5f7fb;
    color: #1f2937;
}

a {
    color: #2563eb;
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

.app-wrap {
    max-width: 1380px;
    margin: 0 auto;
    padding: 20px 24px;
}

/* =========================
   TOPBAR
========================= */

.topbar {
    background: #ffffff;
    border-bottom: 1px solid #e5e7eb;
    margin-bottom: 20px;
}

.topbar-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    padding: 14px 0;
    position: relative;
}

.topbar-brand-block {
    display: flex;
    align-items: center;
    flex: 0 0 auto;
}

.topbar-logo-link {
    display: inline-flex;
    align-items: center;
    text-decoration: none;
}

.topbar-logo-link:hover {
    text-decoration: none;
}

.topbar-logo {
    display: block;
    height: 46px;
    width: auto;
    max-width: 180px;
    object-fit: contain;
}

.topbar-right-tools {
    display: flex;
    align-items: center;
    gap: 16px;
    flex: 1 1 auto;
    justify-content: flex-end;
    min-width: 0;
}

.desktop-nav {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
    justify-content: flex-end;
    flex: 1 1 auto;
    max-width: 820px;
}

.nav-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 40px;
    padding: 8px 14px;
    border-radius: 10px;
    color: #1f2937;
    background: #f8fafc;
    border: 1px solid #e5e7eb;
    white-space: nowrap;
    font-size: 14px;
    font-weight: 500;
    line-height: 1.2;
}

.nav-link-home {
    min-width: 52px;
    padding: 8px 10px;
    font-size: 18px;
}

.nav-link:hover {
    background: #eff6ff;
    text-decoration: none;
}

.mobile-menu {
    display: none;
    margin-left: auto;
    position: relative;
}

.mobile-menu summary {
    list-style: none;
}

.mobile-menu summary::-webkit-details-marker {
    display: none;
}

.menu-toggle {
    width: 54px;
    height: 54px;
    border: 1px solid #d1d5db;
    background: #ffffff;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    line-height: 1;
    cursor: pointer;
    user-select: none;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.06);
}

.mobile-nav {
    position: absolute;
    right: 0;
    top: calc(100% + 10px);
    min-width: 240px;
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 14px;
    box-shadow: 0 16px 36px rgba(0, 0, 0, 0.12);
    padding: 10px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    z-index: 1000;
}

.mobile-nav-link {
    display: block;
    width: 100%;
    padding: 12px 14px;
    border-radius: 10px;
    background: #f8fafc;
    border: 1px solid #e5e7eb;
    color: #1f2937;
    font-weight: 600;
}

.mobile-nav-link:hover {
    background: #eff6ff;
    text-decoration: none;
}

/* =========================
   TOPBAR MODO EMPRESA
========================= */

.scope-panel {
    display: flex;
    flex-direction: column;
    gap: 10px;
    width: 235px;
    padding: 12px;
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 14px;
    box-shadow: 0 4px 14px rgba(15, 23, 42, 0.05);
}

.scope-panel-mobile {
    padding: 12px;
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 14px;
    margin-bottom: 10px;
}

.scope-panel-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    flex-wrap: wrap;
}

.scope-panel-title {
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #6b7280;
}

.scope-pill {
    display: inline-flex;
    align-items: center;
    padding: 6px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 700;
    line-height: 1.2;
    border: 1px solid transparent;
}

.scope-pill-global {
    background: #eff6ff;
    color: #1d4ed8;
    border-color: #bfdbfe;
}

.scope-pill-company {
    background: #ecfdf3;
    color: #166534;
    border-color: #bbf7d0;
}

.scope-panel-form {
    display: block;
    margin: 0;
}

.scope-panel-select {
    width: 100%;
    height: 40px;
    padding: 0 12px;
    border: 1px solid #d1d5db;
    border-radius: 10px;
    background: #f8fafc;
    font-size: 14px;
    font-weight: 600;
    color: #111827;
}

.scope-panel-select:focus {
    outline: none;
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.10);
    background: #ffffff;
}

/* =========================
   CARDS Y SECCIONES
========================= */

.card {
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 16px;
    padding: 24px;
    margin-bottom: 18px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.03);
}

.section-title {
    margin: 0 0 16px 0;
    font-size: 22px;
    line-height: 1.2;
    font-weight: 700;
    color: #111827;
}

.section-title-sub {
    font-size: 14px;
    font-weight: 400;
    color: #6b7280;
}

.user-meta p,
.meta-list p {
    margin: 8px 0;
    font-size: 15px;
}

/* =========================
   GRIDS
========================= */

.grid {
    display: grid;
    gap: 16px;
}

.grid-metrics {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px;
    margin-bottom: 28px;
}

.metric-card {
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 16px;
    padding: 22px;
    min-height: 150px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.metric-title {
    font-size: 15px;
    color: #6b7280;
    margin-bottom: 8px;
    line-height: 1.3;
}

.metric-value {
    font-size: 64px;
    line-height: 1;
    font-weight: 700;
    color: #111827;
}

/* =========================
   ACTIVIDAD / LISTAS
========================= */

.activity-item {
    border: 1px solid #e5e7eb;
    border-radius: 14px;
    padding: 16px;
    margin-bottom: 14px;
    background: #fff;
}

.activity-item:last-child {
    margin-bottom: 0;
}

.activity-item strong {
    display: inline-block;
    margin-bottom: 6px;
    font-size: 18px;
    line-height: 1.3;
    color: #111827;
}

.activity-date {
    font-size: 14px;
    color: #6b7280;
    margin-bottom: 10px;
    line-height: 1.4;
}

/* =========================
   ALERTAS
========================= */

.flash-success,
.flash-error {
    border-radius: 12px;
    padding: 12px 14px;
    margin-bottom: 16px;
    font-size: 15px;
}

.flash-success {
    background: #ecfdf5;
    border: 1px solid #a7f3d0;
    color: #065f46;
}

.flash-error {
    background: #fef2f2;
    border: 1px solid #fecaca;
    color: #991b1b;
}

/* =========================
   FORMULARIOS
========================= */

.form-grid {
    display: grid;
    gap: 16px;
}

.form-grid label {
    display: block;
    margin-bottom: 6px;
    font-weight: 600;
    font-size: 14px;
    color: #374151;
}

.form-grid input,
.form-grid textarea,
.form-grid select {
    width: 100%;
    padding: 11px 12px;
    border: 1px solid #d1d5db;
    border-radius: 10px;
    background: #fff;
    font-size: 14px;
}

.form-grid textarea {
    min-height: 120px;
    resize: vertical;
}

.form-grid input:focus,
.form-grid textarea:focus,
.form-grid select:focus {
    outline: none;
    border-color: #2563eb;
    box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.1);
}

/* =========================
   BOTONES
========================= */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 16px;
    border: 1px solid #2563eb;
    background: #2563eb;
    color: #ffffff;
    border-radius: 12px;
    cursor: pointer;
    text-decoration: none;
    font-weight: 600;
    font-size: 15px;
}

.btn:hover {
    text-decoration: none;
    opacity: 0.95;
}

.btn-light {
    background: #ffffff;
    color: #2563eb;
}

.btn-icon {
    padding: 6px 10px;
    min-width: 38px;
    min-height: 38px;
    font-size: 16px;
    line-height: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
}

.btn-icon:hover {
    background: #f3f4f6;
    transform: scale(1.05);
}

/* =========================
   BADGES
========================= */

.badge {
    display: inline-block;
    padding: 5px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 700;
    line-height: 1.2;
}

.badge-pendiente {
    background: #fef3c7;
    color: #92400e;
    border: 1px solid #fcd34d;
}

.badge-en_proceso {
    background: #dbeafe;
    color: #1d4ed8;
    border: 1px solid #93c5fd;
}

.badge-en_revision {
    background: #fde68a;
    color: #92400e;
    border: 1px solid #facc15;
}

.badge-completada {
    background: #dcfce7;
    color: #166534;
    border: 1px solid #86efac;
}

.badge-cancelada {
    background: #fee2e2;
    color: #991b1b;
    border: 1px solid #fca5a5;
}

.badge-vencida {
    background: #fee2e2;
    color: #991b1b;
    border: 1px solid #fca5a5;
}

.badge-hoy {
    background: #fef3c7;
    color: #92400e;
    border: 1px solid #fcd34d;
}

.badge-en-tiempo {
    background: #dcfce7;
    color: #166534;
    border: 1px solid #86efac;
}

.badge-neutral {
    background: #e5e7eb;
    color: #374151;
    border: 1px solid #d1d5db;
}

/* =========================
   DASHBOARD
========================= */

.dashboard-task-list {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.dashboard-task-card {
    margin-bottom: 0;
}

.dashboard-task-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    margin-top: 10px;
}

.dashboard-task-badges {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

.dashboard-complete-form {
    margin: 0;
}

.dashboard-task-section {
    margin-top: 0;
}

.task-link-title {
    color: inherit;
    text-decoration: none;
}

.task-link-title:hover {
    text-decoration: underline;
}

/* =========================
   DESK
========================= */

.desk-intro {
    margin: 0;
    color: #6b7280;
    font-size: 15px;
}

.desk-project-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(360px, 1fr));
    gap: 18px;
}

.desk-project-card {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.desk-project-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
}

.desk-project-topline {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.desk-project-title {
    margin: 0;
    font-size: 22px;
    line-height: 1.2;
}

.desk-project-description {
    margin: 8px 0 0 0;
    color: #6b7280;
    font-size: 14px;
    line-height: 1.4;
}

.desk-project-stats {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.desk-project-block {
    border-top: 1px solid #e5e7eb;
    padding-top: 12px;
}

.desk-project-block-title {
    font-size: 14px;
    font-weight: 700;
    color: #374151;
    margin-bottom: 10px;
}

.desk-mini-task-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.desk-mini-task {
    background: #f8fafc;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    padding: 12px;
}

.desk-mini-task-title {
    display: inline-block;
    color: #111827;
    font-weight: 700;
    text-decoration: none;
    margin-bottom: 4px;
}

.desk-mini-task-title:hover {
    text-decoration: underline;
}

.desk-mini-task-meta {
    font-size: 13px;
    color: #6b7280;
    line-height: 1.4;
}

.desk-last-activity,
.desk-last-comment {
    background: #f8fafc;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    padding: 12px;
}

.desk-comment-preview {
    color: #374151;
    line-height: 1.5;
    font-size: 14px;
}

.desk-empty {
    margin: 0;
    color: #6b7280;
    font-size: 14px;
}

.desk-project-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: auto;
}

.task-link-inline {
    color: #2563eb;
    text-decoration: none;
}

.task-link-inline:hover {
    text-decoration: underline;
}

.js-desk-hide-target {
    transition: opacity 0.18s ease, transform 0.18s ease;
}

.js-desk-hide-target.is-hiding {
    opacity: 0;
    transform: scale(0.96);
}

/* =========================
   RESPONSIVE
========================= */

@media (max-width: 1100px) {
    .scope-panel {
        width: 210px;
        padding: 10px;
    }

    .topbar-logo {
        height: 54px;
        max-width: 200px;
    }
}

@media (max-width: 900px) {
    .desktop-nav {
        display: none;
    }

    .mobile-menu {
        display: block;
    }

    .scope-panel {
        display: none;
    }
}


@media (max-width: 768px) {
    .topbar-logo {
        height: 40px;
        max-width: 150px;
    }
}

    .topbar-head {
        align-items: center;
        justify-content: space-between;
        gap: 16px;
        padding: 12px 0;
    }

    .topbar-logo {
        height: 48px;
        max-width: 170px;
    }

    .card {
        padding: 18px;
        border-radius: 14px;
    }

    .section-title {
        font-size: 18px;
    }

    .grid-metrics {
        grid-template-columns: 1fr 1fr;
        gap: 14px;
        margin-bottom: 28px;
    }

    .metric-card {
        min-height: 120px;
        padding: 18px;
        border-radius: 14px;
    }

    .metric-title {
        font-size: 14px;
    }

    .metric-value {
        font-size: 50px;
    }

    .activity-item {
        padding: 14px;
    }

    .activity-item strong {
        font-size: 17px;
    }

    .activity-date {
        font-size: 13px;
    }

    .btn {
        border-radius: 12px;
    }

    .dashboard-task-actions {
        align-items: flex-start;
        flex-direction: column;
    }

    .dashboard-complete-form {
        width: 100%;
    }

    .dashboard-complete-form .btn {
        width: 100%;
    }

    .desk-project-grid {
        grid-template-columns: 1fr;
    }

    .desk-project-actions .btn {
        width: 100%;
    }

    .scope-panel-form .scope-panel-select {
        width: 100%;
    }
}

.topbar-logo,
.topbar-logo img {
    height: 46px !important;
    max-height: 46px !important;
    width: auto !important;
    max-width: 180px !important;
    object-fit: contain;
}

@media (max-width: 768px) {
    .topbar-logo,
    .topbar-logo img {
        height: 40px !important;
        max-height: 40px !important;
        max-width: 150px !important;
    }
}

@media (max-width: 768px) {
    .topbar-logo-link img {
        height: 60px !important;
        max-width: 200px !important;
    }
}

/* DROPDOWN EMPRESA */
.scope-dropdown {
    position: relative;
}

.scope-btn {
    background: #f3f4f6;
    border: none;
    padding: 8px 12px;
    border-radius: 10px;
    cursor: pointer;
    font-size: 14px;
}

.scope-menu {
    position: absolute;
    top: 110%;
    right: 0;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.1);
    min-width: 220px;
    display: none;
    z-index: 9999;
}

.scope-menu a {
    display: block;
    padding: 10px 12px;
    text-decoration: none;
    color: #111827;
    font-size: 14px;
}

.scope-menu a:hover {
    background: #f3f4f6;
}

.scope-dropdown:hover .scope-menu {
    display: block;
}

.scope-dropdown {
    position: relative;
}

.scope-btn {
    background: #f3f4f6;
    border: none;
    padding: 8px 12px;
    border-radius: 10px;
    cursor: pointer;
}

.scope-menu {
    position: absolute;
    top: 110%;
    right: 0;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.1);
    min-width: 220px;
    display: none;
    z-index: 9999;
}

.scope-menu a {
    display: block;
    padding: 10px 12px;
    text-decoration: none;
    color: #111827;
}

.scope-menu a:hover {
    background: #f3f4f6;
}

/* MOBILE MENU BONITO */
.mobile-nav {
    background: #fff;
    border-radius: 14px;
    padding: 10px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.08);
}

.mobile-link {
    display: block;
    padding: 10px 12px;
    border-radius: 10px;
    text-decoration: none;
    color: #111827;
    font-size: 15px;
    margin-bottom: 5px;
}

.mobile-link:hover {
    background: #f3f4f6;
}

.mobile-link.logout {
    color: #dc2626;
}

/* HAMBURGER BOTON */
.menu-toggle {
    font-size: 20px;
    background: #f3f4f6;
    padding: 8px 12px;
    border-radius: 10px;
    cursor: pointer;
}