/* =========================================================
   TICKETING INTERNO · ESTILO SaaS MODERNO
   Archivo: /assets/css/app.css
   ========================================================= */

/* -------------------------
   VARIABLES GLOBALES
   ------------------------- */
:root {
    --color-fondo: #f4f7fb;
    --color-fondo-secundario: #eef3f9;
    --color-panel: rgba(255, 255, 255, 0.88);
    --color-panel-solido: #ffffff;
    --color-borde: #e2e8f0;

    --color-texto: #0f172a;
    --color-texto-suave: #64748b;
    --color-texto-invertido: #ffffff;

    --color-primario: #4f46e5;
    --color-primario-hover: #4338ca;
    --color-primario-suave: #eef2ff;

    --color-exito: #16a34a;
    --color-exito-suave: #dcfce7;

    --color-alerta: #d97706;
    --color-alerta-suave: #fef3c7;

    --color-peligro: #dc2626;
    --color-peligro-suave: #fee2e2;

    --color-info: #0284c7;
    --color-info-suave: #e0f2fe;

    --color-sidebar-1: #0f172a;
    --color-sidebar-2: #111827;

    --radio-xl: 24px;
    --radio-lg: 18px;
    --radio-md: 14px;
    --radio-sm: 10px;

    --sombra-suave: 0 10px 30px rgba(15, 23, 42, 0.06);
    --sombra-media: 0 16px 42px rgba(15, 23, 42, 0.08);
    --sombra-fuerte: 0 24px 60px rgba(15, 23, 42, 0.12);

    --ancho-sidebar: 270px;

    --fuente-principal: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    --transicion: 0.2s ease;
}

/* -------------------------
   RESET Y BASE
   ------------------------- */
* {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    padding: 0;
    font-family: var(--fuente-principal);
    color: var(--color-texto);
    background:
        radial-gradient(circle at top left, rgba(79, 70, 229, 0.12), transparent 25%),
        radial-gradient(circle at bottom right, rgba(124, 58, 237, 0.10), transparent 25%),
        linear-gradient(180deg, var(--color-fondo) 0%, var(--color-fondo-secundario) 100%);
}

body {
    min-height: 100vh;
}

a {
    color: inherit;
    text-decoration: none;
}

img {
    max-width: 100%;
    display: block;
}

button,
input,
select,
textarea {
    font: inherit;
}

h1,
h2,
h3,
h4,
p {
    margin-top: 0;
}

/* -------------------------
   LAYOUT GENERAL APP
   ------------------------- */
.app-shell {
    display: flex;
    min-height: 100vh;
}

/* -------------------------
   SIDEBAR
   ------------------------- */
.sidebar {
    width: var(--ancho-sidebar);
    min-height: 100vh;
    position: sticky;
    top: 0;
    background: linear-gradient(180deg, var(--color-sidebar-1) 0%, var(--color-sidebar-2) 100%);
    color: var(--color-texto-invertido);
    padding: 28px 20px;
}

.sidebar__brand {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 34px;
}

.sidebar__logo {
    width: 48px;
    height: 48px;
    border-radius: 16px;
    display: grid;
    place-items: center;
    font-weight: 800;
    font-size: 1.1rem;
    color: #fff;
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    box-shadow: 0 14px 30px rgba(99, 102, 241, 0.35);
    flex-shrink: 0;
}

.sidebar__title {
    font-size: 1rem;
    font-weight: 800;
    line-height: 1.2;
}

.sidebar__subtitle {
    font-size: 0.86rem;
    color: rgba(255, 255, 255, 0.65);
    margin-top: 4px;
}

.sidebar__nav {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.sidebar__link {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 13px 14px;
    border-radius: 14px;
    color: rgba(255, 255, 255, 0.88);
    transition: var(--transicion);
}

.sidebar__link:hover,
.sidebar__link--activo {
    background: rgba(255, 255, 255, 0.08);
    color: #fff;
}

.sidebar__link--danger:hover {
    background: rgba(220, 38, 38, 0.16);
}

/* -------------------------
   ÁREA PRINCIPAL
   ------------------------- */
.main {
    flex: 1;
    padding: 32px;
}

.topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 18px;
    margin-bottom: 24px;
}

.topbar h1 {
    margin: 0 0 6px;
    font-size: 2rem;
    letter-spacing: -0.03em;
}

.topbar p {
    margin: 0;
    color: var(--color-texto-suave);
}

/* -------------------------
   PANELES / TARJETAS
   ------------------------- */
.panel {
    background: var(--color-panel);
    backdrop-filter: blur(12px);
    border: 1px solid rgba(226, 232, 240, 0.8);
    border-radius: var(--radio-xl);
    box-shadow: var(--sombra-media);
    padding: 24px;
    margin-bottom: 24px;
}

.panel__header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    margin-bottom: 20px;
}

.panel__header h2,
.panel__header h3 {
    margin: 0;
    font-size: 1.1rem;
}

.panel__header p {
    margin: 4px 0 0;
    color: var(--color-texto-suave);
    font-size: 0.92rem;
}

/* -------------------------
   GRID DE ESTADÍSTICAS
   ------------------------- */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 18px;
    margin-bottom: 24px;
}

.stat-card {
    background: linear-gradient(180deg, rgba(255,255,255,.98), rgba(255,255,255,.88));
    border: 1px solid rgba(226, 232, 240, 0.85);
    border-radius: var(--radio-lg);
    box-shadow: var(--sombra-suave);
    padding: 22px;
}

.stat-card__label {
    display: block;
    color: var(--color-texto-suave);
    margin-bottom: 10px;
    font-size: 0.95rem;
}

.stat-card__value {
    font-size: 2rem;
    font-weight: 800;
    letter-spacing: -0.03em;
}

.stat-card__meta {
    margin-top: 10px;
    color: var(--color-texto-suave);
    font-size: 0.88rem;
}

/* -------------------------
   BOTONES
   ------------------------- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    border: none;
    border-radius: 14px;
    padding: 12px 18px;
    cursor: pointer;
    font-weight: 700;
    transition: var(--transicion);
    text-decoration: none;
}

.btn:hover {
    transform: translateY(-1px);
}

.btn--primary {
    background: linear-gradient(135deg, var(--color-primario), #7c3aed);
    color: #fff;
    box-shadow: 0 12px 28px rgba(79, 70, 229, 0.24);
}

.btn--primary:hover {
    filter: brightness(1.02);
}

.btn--secondary {
    background: var(--color-primario-suave);
    color: var(--color-primario);
}

.btn--secondary:hover {
    background: #e0e7ff;
}

.btn--ghost {
    background: #fff;
    color: var(--color-texto);
    border: 1px solid var(--color-borde);
}

.btn--ghost:hover {
    background: #f8fafc;
}

.btn--block {
    width: 100%;
}

/* -------------------------
   FORMULARIOS
   ------------------------- */
.form {
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.form__grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px;
}

.form__group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.form__group--full {
    grid-column: 1 / -1;
}

.form label {
    font-size: 0.94rem;
    font-weight: 700;
    color: var(--color-texto);
}

.form input,
.form select,
.form textarea {
    width: 100%;
    border: 1px solid var(--color-borde);
    background: rgba(255, 255, 255, 0.96);
    border-radius: 14px;
    padding: 14px 15px;
    outline: none;
    transition: var(--transicion);
    color: var(--color-texto);
}

.form input::placeholder,
.form textarea::placeholder {
    color: #94a3b8;
}

.form input:focus,
.form select:focus,
.form textarea:focus {
    border-color: rgba(79, 70, 229, 0.45);
    box-shadow: 0 0 0 4px rgba(79, 70, 229, 0.10);
}

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

.form__actions {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    flex-wrap: wrap;
}

.form__actions--inline {
    justify-content: flex-start;
    align-items: end;
}

.form--filters {
    display: grid;
    grid-template-columns: 1.4fr repeat(3, 1fr) auto;
    gap: 16px;
    align-items: end;
}

/* -------------------------
   TABLAS
   ------------------------- */
.table-wrapper {
    overflow-x: auto;
    border-radius: 16px;
}

.table {
    width: 100%;
    border-collapse: collapse;
    background: transparent;
}

.table th,
.table td {
    padding: 14px 12px;
    border-bottom: 1px solid var(--color-borde);
    text-align: left;
    vertical-align: middle;
    white-space: nowrap;
}

.table th {
    color: var(--color-texto-suave);
    font-size: 0.88rem;
    font-weight: 800;
}

.table td {
    font-size: 0.94rem;
}

.table tbody tr:hover {
    background: rgba(248, 250, 252, 0.85);
}

.table a {
    color: var(--color-primario);
    font-weight: 700;
}

/* -------------------------
   BADGES
   ------------------------- */
.badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 7px 11px;
    border-radius: 999px;
    font-size: 0.8rem;
    font-weight: 800;
    line-height: 1;
}

.badge--soft {
    background: #e2e8f0;
    color: #334155;
}

/* Estados */
.badge--estado-abierto {
    background: #dbeafe;
    color: #1d4ed8;
}

.badge--estado-en_progreso {
    background: #ede9fe;
    color: #6d28d9;
}

.badge--estado-pendiente_usuario {
    background: #fef3c7;
    color: #b45309;
}

.badge--estado-resuelto {
    background: #dcfce7;
    color: #15803d;
}

.badge--estado-cerrado {
    background: #e5e7eb;
    color: #374151;
}

/* Prioridades */
.badge--prioridad-baja {
    background: #e0f2fe;
    color: #0369a1;
}

.badge--prioridad-media {
    background: #fef3c7;
    color: #b45309;
}

.badge--prioridad-alta {
    background: #fee2e2;
    color: #b91c1c;
}

.badge--prioridad-urgente {
    background: #fecaca;
    color: #991b1b;
}

/* -------------------------
   ALERTAS
   ------------------------- */
.alert {
    padding: 14px 16px;
    border-radius: 14px;
    margin-bottom: 18px;
    font-weight: 700;
    border: 1px solid transparent;
}

.alert--success {
    background: var(--color-exito-suave);
    color: #166534;
    border-color: #bbf7d0;
}

.alert--error {
    background: var(--color-peligro-suave);
    color: #991b1b;
    border-color: #fecaca;
}

.alert--warning {
    background: var(--color-alerta-suave);
    color: #92400e;
    border-color: #fde68a;
}

.alert--info {
    background: var(--color-info-suave);
    color: #075985;
    border-color: #bae6fd;
}

/* -------------------------
   DETALLE DE TICKET
   ------------------------- */
.detail-grid {
    display: grid;
    grid-template-columns: 1.45fr 0.85fr;
    gap: 24px;
    margin-bottom: 24px;
}

.detail-meta {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
    margin-bottom: 22px;
}

.detail-meta__item {
    background: #f8fafc;
    border: 1px solid var(--color-borde);
    border-radius: 14px;
    padding: 14px;
}

.detail-meta__item span {
    display: block;
    color: var(--color-texto-suave);
    font-size: 0.9rem;
    margin-bottom: 6px;
}

.ticket-description h3 {
    margin-bottom: 10px;
}

.ticket-description p {
    color: #334155;
    line-height: 1.7;
}

/* -------------------------
   COMENTARIOS
   ------------------------- */
.comment-list {
    display: flex;
    flex-direction: column;
    gap: 14px;
    margin-bottom: 20px;
}

.comment {
    background: #f8fafc;
    border: 1px solid var(--color-borde);
    border-radius: 16px;
    padding: 16px;
}

.comment__meta {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 10px;
    color: var(--color-texto-suave);
    font-size: 0.9rem;
}

.comment__body {
    line-height: 1.65;
    color: #1e293b;
}

.empty-state {
    padding: 24px;
    text-align: center;
    border: 1px dashed var(--color-borde);
    border-radius: 16px;
    color: var(--color-texto-suave);
    background: rgba(255,255,255,0.55);
}

/* -------------------------
   LOGIN / AUTH
   ------------------------- */
.auth-layout {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 24px;
    background:
        radial-gradient(circle at top left, rgba(79,70,229,.16), transparent 28%),
        radial-gradient(circle at bottom right, rgba(124,58,237,.14), transparent 28%),
        linear-gradient(180deg, #eef2ff 0%, #f8fafc 100%);
}

.auth-card {
    width: 100%;
    max-width: 460px;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(14px);
    border: 1px solid rgba(226, 232, 240, 0.75);
    border-radius: 28px;
    box-shadow: var(--sombra-fuerte);
    padding: 32px;
}

.auth-card__header {
    text-align: center;
    margin-bottom: 22px;
}

.auth-card__header h1 {
    margin: 14px 0 8px;
    font-size: 1.7rem;
    letter-spacing: -0.03em;
}

.auth-card__header p {
    margin: 0;
    color: var(--color-texto-suave);
}

.auth-logo {
    width: 54px;
    height: 54px;
    border-radius: 18px;
    display: grid;
    place-items: center;
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    color: #fff;
    font-weight: 800;
    margin: 0 auto;
    box-shadow: 0 14px 30px rgba(99, 102, 241, 0.35);
}

.auth-demo {
    margin-top: 18px;
    color: var(--color-texto-suave);
    font-size: 0.92rem;
    text-align: center;
    line-height: 1.6;
}

/* -------------------------
   BLOQUES AUXILIARES
   ------------------------- */
.acciones-rapidas {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.kbd {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 26px;
    height: 26px;
    padding: 0 8px;
    border-radius: 8px;
    background: #111827;
    color: #fff;
    font-size: 0.78rem;
    font-weight: 700;
}

.separador {
    height: 1px;
    background: var(--color-borde);
    margin: 20px 0;
}

/* -------------------------
   RESPONSIVE
   ------------------------- */
@media (max-width: 1200px) {
    .stats-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .detail-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 960px) {
    .app-shell {
        flex-direction: column;
    }

    .sidebar {
        width: 100%;
        min-height: auto;
        position: relative;
    }

    .main {
        padding: 22px;
    }

    .form__grid {
        grid-template-columns: 1fr;
    }

    .form--filters {
        grid-template-columns: 1fr 1fr;
    }

    .detail-meta {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 640px) {
    .main {
        padding: 18px;
    }

    .topbar {
        flex-direction: column;
        align-items: flex-start;
    }

    .topbar h1 {
        font-size: 1.6rem;
    }

    .stats-grid {
        grid-template-columns: 1fr;
    }

    .form--filters {
        grid-template-columns: 1fr;
    }

    .panel {
        padding: 18px;
        border-radius: 20px;
    }

    .auth-card {
        padding: 24px;
        border-radius: 24px;
    }

    .table th,
    .table td {
        padding: 12px 10px;
    }
}

/* -------------------------
   DASHBOARD / MOCKUP CLASSES
   ------------------------- */
.hero {
    background: linear-gradient(135deg, rgba(91, 92, 240, 0.98), rgba(124, 58, 237, 0.95));
    color: #fff;
    border-radius: 26px;
    padding: 28px;
    box-shadow: 0 20px 50px rgba(91, 92, 240, 0.22);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    margin-bottom: 22px;
    overflow: hidden;
    position: relative;
}

.hero::after {
    content: "";
    position: absolute;
    right: -60px;
    top: -40px;
    width: 220px;
    height: 220px;
    background: rgba(255,255,255,.10);
    border-radius: 50%;
    filter: blur(8px);
}

.hero h2 {
    margin: 0 0 10px;
    font-size: 1.7rem;
    letter-spacing: -0.03em;
}

.hero p {
    margin: 0;
    max-width: 680px;
    color: rgba(255,255,255,.86);
    line-height: 1.55;
}

.btn--white {
    background: #fff;
    color: var(--color-primario);
    box-shadow: 0 10px 24px rgba(0,0,0,.14);
}

.btn--white:hover {
    background: #fff;
}

.content-grid {
    display: grid;
    grid-template-columns: 1.45fr 0.95fr;
    gap: 22px;
}

.dashboard-side {
    display: grid;
    gap: 22px;
}

.panel__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    margin-bottom: 18px;
}

.panel__head h3 {
    margin: 0;
    font-size: 1.08rem;
}

.panel__head p {
    margin: 4px 0 0;
    color: var(--color-texto-suave);
    font-size: 0.92rem;
}

.activity {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.activity__item {
    display: flex;
    gap: 12px;
    align-items: flex-start;
    padding: 12px;
    border-radius: 16px;
    background: rgba(248,250,252,.82);
    border: 1px solid var(--color-borde);
}

.activity__dot {
    width: 11px;
    height: 11px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--color-primario), #7c3aed);
    margin-top: 7px;
    box-shadow: 0 0 0 6px rgba(79,70,229,.10);
    flex: 0 0 auto;
}

.activity__item strong {
    display: block;
    margin-bottom: 4px;
    font-size: 0.94rem;
}

.activity__item p {
    margin: 0;
    color: var(--color-texto-suave);
    line-height: 1.5;
    font-size: 0.9rem;
}

.quick-form {
    display: grid;
    gap: 14px;
    margin-top: 6px;
}

.field {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.field label {
    font-size: 0.92rem;
    font-weight: 700;
}

.field input,
.field select,
.field textarea {
    width: 100%;
    border: 1px solid var(--color-borde);
    background: rgba(255,255,255,.95);
    border-radius: 15px;
    padding: 13px 14px;
    font: inherit;
    color: var(--color-texto);
    outline: none;
    transition: var(--transicion);
}

.field input:focus,
.field select:focus,
.field textarea:focus {
    border-color: rgba(79,70,229,.45);
    box-shadow: 0 0 0 4px rgba(79,70,229,.10);
}

.field textarea {
    resize: vertical;
    min-height: 115px;
}

.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding-top: 6px;
}

@media (max-width: 1200px) {
    .content-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 900px) {
    .hero {
        flex-direction: column;
        align-items: flex-start;
    }
}

/* -------------------------
   SIDEBAR ESTRUCTURA SUPERIOR / INFERIOR
   ------------------------- */
.sidebar {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.sidebar__top {
    display: flex;
    flex-direction: column;
}

.sidebar__bottom {
    display: flex;
    flex-direction: column;
    gap: 14px;
    margin-top: 24px;
}

.sidebar__footer-card {
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 16px;
    padding: 14px;
}

.sidebar__footer-card strong {
    display: block;
    color: #fff;
    margin-bottom: 4px;
}

.sidebar__footer-card span {
    color: rgba(255, 255, 255, 0.68);
    font-size: 0.88rem;
}

/* -------------------------
   CAMPO PASSWORD CON TOGGLE
   ------------------------- */
.password-field {
    position: relative;
}

.password-field input {
    padding-right: 52px;
}

.password-toggle {
    position: absolute;
    top: 50%;
    right: 12px;
    transform: translateY(-50%);
    border: 0;
    background: transparent;
    cursor: pointer;
    font-size: 1rem;
    line-height: 1;
    color: var(--color-texto-suave);
    padding: 6px;
    border-radius: 8px;
}

.password-toggle:hover {
    background: rgba(148, 163, 184, 0.12);
    color: var(--color-texto);
}

/* -------------------------
   PASSWORD TOGGLE
   ------------------------- */
.password-field {
    position: relative;
    width: 100%;
}

.password-field input {
    width: 100%;
    padding-right: 52px;
}

.password-toggle {
    position: absolute;
    top: 50%;
   