* {
    box-sizing: border-box;
}

:root {
    --bg: #f5f7fb;
    --panel: #ffffff;
    --border: #e5e9f2;
    --text: #172033;
    --muted: #72809a;
    --primary: #3157e8;
    --primary-dark: #2444bd;
    --danger: #db3d4b;
    --warning: #d38a12;
    --green: #24976c;
    --sidebar: #121a2b;
}

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family:
        Inter,
        -apple-system,
        BlinkMacSystemFont,
        "Segoe UI",
        sans-serif;
}

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

.layout {
    min-height: 100vh;
}

.sidebar {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    width: 245px;
    background: var(--sidebar);
    color: white;
    padding: 26px 18px;
    display: flex;
    flex-direction: column;
    z-index: 20;
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0 8px 25px;
}

.brand-mark,
.login-logo {
    width: 42px;
    height: 42px;
    border-radius: 13px;
    background: linear-gradient(
        135deg,
        #5275ff,
        #7555e9
    );
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 800;
    font-size: 20px;
}

.brand strong {
    display: block;
    font-size: 17px;
}

.brand small,
.sidebar-user small {
    display: block;
    color: #95a1b9;
    margin-top: 3px;
}

.sidebar nav {
    display: flex;
    flex-direction: column;
    gap: 5px;
    flex: 1;
}

.sidebar nav a {
    color: #cbd3e3;
    padding: 12px 13px;
    border-radius: 10px;
    font-size: 14px;
    transition: .15s;
}

.sidebar nav a:hover {
    color: white;
    background: rgba(255,255,255,.07);
}

.sidebar nav .nav-primary {
    color: white;
    background: var(--primary);
    margin: 8px 0 10px;
}

.sidebar-user {
    border-top: 1px solid rgba(255,255,255,.1);
    padding: 18px 4px 12px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: #26334d;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
}

.logout {
    border: none;
    background: transparent;
    color: #95a1b9;
    cursor: pointer;
    padding: 5px;
}

main {
    margin-left: 245px;
    padding: 34px;
    max-width: 1700px;
}

.main-login {
    margin-left: 0;
    padding: 0;
    max-width: none;
}

.page-header {
    display: flex;
    justify-content: space-between;
    gap: 20px;
    align-items: flex-start;
    margin-bottom: 26px;
}

.page-header h1 {
    margin: 4px 0 5px;
    font-size: 29px;
    letter-spacing: -.7px;
}

.page-header p {
    margin: 0;
    color: var(--muted);
}

.eyebrow {
    color: var(--primary);
    font-size: 11px;
    letter-spacing: 1.6px;
    font-weight: 800;
}

.button {
    border: 1px solid var(--border);
    background: white;
    color: var(--text);
    padding: 10px 16px;
    border-radius: 9px;
    cursor: pointer;
    font-weight: 650;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.button-primary {
    color: white;
    border-color: var(--primary);
    background: var(--primary);
}

.button-primary:hover {
    background: var(--primary-dark);
}

.button-full {
    width: 100%;
}

.cards {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 14px;
}

.card,
.form-card,
.table-card {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 14px;
}

.metric {
    padding: 18px;
}

.metric span {
    display: block;
    color: var(--muted);
    font-size: 13px;
}

.metric strong {
    display: block;
    font-size: 30px;
    margin-top: 8px;
}

.metric.danger strong {
    color: var(--danger);
}

.metric.warning strong {
    color: var(--warning);
}

.muted-card {
    background: #f9fafc;
}

.section {
    margin-top: 30px;
}

.section-title {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    margin-bottom: 12px;
}

.section-title h2,
.form-card h2 {
    margin: 0 0 4px;
    font-size: 18px;
}

.section-title p {
    margin: 0;
    color: var(--muted);
    font-size: 13px;
}

.section-title a {
    color: var(--primary);
    font-weight: 650;
    font-size: 13px;
}

.table-card {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

th {
    text-align: left;
    background: #fafbfc;
    color: #6d7890;
    padding: 13px 15px;
    border-bottom: 1px solid var(--border);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: .5px;
}

td {
    padding: 14px 15px;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}

tbody tr:last-child td {
    border-bottom: none;
}

tbody tr:hover {
    background: #fafbff;
}

.row-danger {
    background: #fff7f8;
}

.ticket-code {
    color: var(--primary);
    font-weight: 750;
    white-space: nowrap;
}

.table-sub {
    display: block;
    color: var(--muted);
    margin-top: 4px;
}

.badge {
    display: inline-flex;
    padding: 5px 8px;
    background: #eef1f6;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 700;
    white-space: nowrap;
}

.priority-critica {
    background: #ffe3e6;
    color: #b91f31;
}

.priority-alta {
    background: #fff0dc;
    color: #a25d00;
}

.priority-normal {
    background: #e7efff;
    color: #3157b8;
}

.priority-baja {
    background: #e7f7ef;
    color: #257b59;
}

.overdue {
    display: block;
    color: var(--danger);
    font-weight: 700;
    margin-top: 4px;
}

.empty {
    text-align: center;
    color: var(--muted);
    padding: 35px !important;
}

.ticket-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
}

.ticket-card {
    background: white;
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 15px;
}

.ticket-card span {
    color: var(--primary);
    font-size: 11px;
    font-weight: 750;
}

.ticket-card strong {
    display: block;
    margin: 7px 0;
}

.ticket-card small {
    color: var(--muted);
}

.filters {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr auto;
    gap: 10px;
    margin-bottom: 15px;
}

input,
select,
textarea {
    width: 100%;
    border: 1px solid #dce1eb;
    background: white;
    border-radius: 8px;
    padding: 10px 11px;
    color: var(--text);
    font: inherit;
    outline: none;
}

input:focus,
select:focus,
textarea:focus {
    border-color: #7590f6;
    box-shadow: 0 0 0 3px rgba(49,87,232,.09);
}

textarea {
    resize: vertical;
}

label {
    display: block;
    margin-bottom: 6px;
    font-size: 12px;
    font-weight: 700;
    color: #4f5d75;
}

.form-card {
    padding: 22px;
}

.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 18px;
}

.span-2 {
    grid-column: span 2;
}

.form-grid small {
    color: var(--muted);
}

.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    border-top: 1px solid var(--border);
    margin-top: 22px;
    padding-top: 18px;
}

.field-error,
.error-box {
    color: var(--danger);
    margin-top: 5px;
    font-size: 12px;
}

.detail-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 330px;
    gap: 20px;
}

.description {
    margin: 17px 0 25px;
    line-height: 1.55;
}

.meta-grid {
    border-top: 1px solid var(--border);
    padding-top: 18px;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
}

.meta-grid span {
    display: block;
    color: var(--muted);
    font-size: 11px;
    margin-bottom: 5px;
}

.meta-grid strong {
    font-size: 13px;
}

.section-gap {
    margin-top: 18px;
}

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

.attachments a {
    color: var(--primary);
    font-size: 13px;
}

.comment {
    border-bottom: 1px solid var(--border);
    padding: 14px 0;
}

.comment-head {
    display: flex;
    justify-content: space-between;
    gap: 15px;
    margin-bottom: 6px;
}

.comment-head span {
    color: var(--muted);
    font-size: 11px;
}

.comment p {
    margin: 3px 0;
    line-height: 1.5;
}

.comment-form {
    margin-top: 18px;
    display: grid;
    gap: 10px;
}

.comment-form button {
    justify-self: flex-end;
}

.timeline {
    margin-top: 18px;
}

.timeline-item {
    display: grid;
    grid-template-columns: 16px 1fr;
    gap: 10px;
    padding-bottom: 18px;
}

.timeline-dot {
    width: 9px;
    height: 9px;
    margin-top: 5px;
    border-radius: 50%;
    background: var(--primary);
}

.timeline-item span {
    margin-left: 8px;
    color: var(--muted);
    font-size: 11px;
}

.timeline-item p {
    margin: 5px 0 0;
    color: #4f5d75;
    font-size: 13px;
}

.sticky-card {
    position: sticky;
    top: 25px;
}

.sticky-card label {
    margin-top: 14px;
}

.sticky-card .button {
    margin-top: 18px;
}

.header-badges {
    display: flex;
    gap: 8px;
}

.message {
    margin-bottom: 18px;
    padding: 12px 15px;
    border: 1px solid #b9e6d4;
    background: #edf9f4;
    color: #257b59;
    border-radius: 10px;
}

.login-shell {
    min-height: 100vh;
    background:
        radial-gradient(
            circle at 15% 20%,
            #263c86,
            transparent 25%
        ),
        linear-gradient(
            135deg,
            #111a2d,
            #17213a
        );
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 30px;
}

.login-box {
    width: 410px;
    background: white;
    border-radius: 18px;
    padding: 38px;
    box-shadow: 0 20px 60px rgba(0,0,0,.25);
}

.login-logo {
    margin-bottom: 18px;
}

.login-box h1 {
    margin: 0 0 6px;
    font-size: 28px;
}

.login-box p {
    margin: 0 0 25px;
    color: var(--muted);
}

.login-box label {
    margin-top: 15px;
}

.login-box .button {
    margin-top: 22px;
}

@media (max-width: 1200px) {

    .cards {
        grid-template-columns: repeat(3, 1fr);
    }

    .meta-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .ticket-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 850px) {

    .sidebar {
        position: static;
        width: 100%;
    }

    main {
        margin-left: 0;
        padding: 20px;
    }

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

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

    .cards {
        grid-template-columns: repeat(2, 1fr);
    }

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

    .span-2 {
        grid-column: span 1;
    }
}


/* ============================================================
   MESA GEA V1.1
   ============================================================ */

.cards {
    grid-template-columns:
        repeat(
            auto-fit,
            minmax(170px, 1fr)
        );
}

.metric.info strong {
    color: #3157e8;
}

.metric.success strong {
    color: #24976c;
}

.response-card strong {
    color: #6d4bd1;
}

.nav-count {
    float: right;
    min-width: 22px;
    height: 22px;
    padding: 0 6px;
    border-radius: 999px;
    background: #e94057;
    color: white;
    font-size: 11px;
    font-weight: 800;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.nav-divider {
    height: 1px;
    background:
        rgba(
            255,
            255,
            255,
            .09
        );
    margin: 10px 5px;
}

.response-dot {
    margin-top: 6px;
    display: block;
    width: fit-content;
    padding: 3px 7px;
    border-radius: 999px;
    background: #f0eaff;
    color: #6540c2;
    font-size: 10px;
    font-weight: 800;
}

.pending-text {
    color: #8b96aa;
    font-size: 12px;
    font-weight: 600;
}

.attention-banner {
    border: 1px solid #d8ccff;
    background: #f5f1ff;
    color: #5238a5;
    padding: 14px 17px;
    border-radius: 12px;
    margin-bottom: 18px;
    display: flex;
    gap: 12px;
    align-items: center;
}

.attention-banner strong {
    white-space: nowrap;
}

.attention-banner span {
    color: #6f6398;
    font-size: 13px;
}

.warning-banner {
    border-color: #f2d99f;
    background: #fff9e9;
    color: #8f6405;
}

.warning-banner span {
    color: #8f7947;
}

.status-strip {
    display: grid;
    grid-template-columns:
        repeat(4, 1fr);
    gap: 1px;
    border: 1px solid var(--border);
    border-radius: 13px;
    overflow: hidden;
    background: var(--border);
    margin-bottom: 18px;
}

.status-strip > div {
    background: white;
    padding: 14px 17px;
}

.status-strip span {
    display: block;
    color: var(--muted);
    font-size: 11px;
    margin-bottom: 5px;
}

.status-strip strong {
    font-size: 13px;
}

.empty-card {
    background: white;
    border: 1px solid var(--border);
    border-radius: 12px;
    color: var(--muted);
    padding: 20px;
}

.yes {
    color: #1d8a61;
    font-weight: 750;
}

.no {
    color: #c53b4a;
    font-weight: 750;
}

.button-small {
    padding: 7px 11px;
    font-size: 12px;
}

.user-form-card {
    max-width: 950px;
}

input[type="checkbox"] {
    width: auto;
    transform: scale(1.15);
    margin-top: 9px;
}

@media (max-width: 950px) {

    .status-strip {
        grid-template-columns:
            repeat(2, 1fr);
    }

}

@media (max-width: 600px) {

    .status-strip {
        grid-template-columns: 1fr;
    }

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

}

/* ============================================================
   MESA GEA V1.2 DETAIL PREMIUM
   ============================================================ */

/* ============================================================
   MESA GEA V1.2 DETAIL PREMIUM
   ============================================================ */

.ticket-premium-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 25px;
    margin-bottom: 18px;
}

.ticket-premium-code {
    color: var(--primary);
    font-size: 11px;
    letter-spacing: 1.3px;
    font-weight: 800;
}

.ticket-premium-header h1 {
    margin: 7px 0 4px;
    font-size: 30px;
    letter-spacing: -.7px;
}

.ticket-premium-header p {
    margin: 0;
    color: var(--muted);
    font-size: 15px;
}

.ticket-premium-header p span {
    padding: 0 5px;
}

.ticket-premium-header-badges {
    padding-top: 4px;
}


/* KPI SUPERIORES */

.ticket-kpi-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 14px;
    margin-bottom: 20px;
}

.ticket-kpi-card {
    min-height: 75px;
    padding: 14px 17px;
    border: 1px solid var(--border);
    background: white;
    border-radius: 13px;
    display: flex;
    align-items: center;
    gap: 13px;
    box-shadow: 0 4px 14px rgba(30, 48, 90, .025);
}

.ticket-kpi-icon {
    width: 42px;
    height: 42px;
    flex: 0 0 42px;
    border-radius: 50%;
    background: #f5f7ff;
    border: 1px solid #e0e6f8;
    color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    font-weight: 800;
}

.ticket-kpi-success {
    background: #e7faef;
    border-color: #d5f3e2;
    color: #1eaf70;
}

.ticket-kpi-card span {
    display: block;
    color: var(--muted);
    font-size: 11px;
    margin-bottom: 5px;
}

.ticket-kpi-card strong {
    display: block;
    font-size: 15px;
}


/* LAYOUT */

.ticket-premium-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 330px;
    gap: 18px;
    align-items: start;
}

.ticket-premium-main {
    min-width: 0;
}

.ticket-premium-sidebar {
    min-width: 0;
}

.premium-card {
    background: white;
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 21px;
    margin-bottom: 18px;
    box-shadow: 0 5px 16px rgba(36, 57, 100, .025);
}

.premium-card h2 {
    margin: 0;
    font-size: 17px;
    letter-spacing: -.2px;
}


/* SOLICITUD */

.premium-description {
    padding: 17px 0 19px;
    margin-bottom: 18px;
    border-bottom: 1px solid var(--border);
    line-height: 1.55;
}

.premium-description p {
    margin: 0;
}

.premium-meta-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 21px 18px;
}

.premium-meta-item span:first-child {
    display: block;
    color: var(--muted);
    font-size: 11px;
    margin-bottom: 6px;
}

.premium-meta-item strong {
    display: block;
    font-size: 13px;
}


/* CABECERAS INTERNAS */

.premium-section-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 15px;
}

.premium-counter {
    display: inline-flex;
    min-width: 22px;
    height: 22px;
    align-items: center;
    justify-content: center;
    padding: 0 6px;
    border-radius: 999px;
    background: #edf1fa;
    color: #61708d;
    font-size: 10px;
    font-weight: 800;
}


/* ARCHIVOS */

.premium-attachments {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
}

.premium-attachment {
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 11px;
    display: flex;
    gap: 10px;
    align-items: center;
    transition: .15s ease;
}

.premium-attachment:hover {
    border-color: #bfcaf1;
    background: #fafbff;
}

.premium-file-icon {
    width: 34px;
    height: 34px;
    border-radius: 8px;
    background: #edf2ff;
    color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
}

.premium-attachment strong {
    display: block;
    font-size: 12px;
}

.premium-attachment small {
    display: block;
    margin-top: 3px;
    color: var(--muted);
}


/* CONVERSACIÓN */

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

.premium-comment {
    display: grid;
    grid-template-columns: 36px 1fr;
    gap: 10px;
}

.premium-comment-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: linear-gradient(
        135deg,
        #4768f1,
        #7459ed
    );
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 800;
}

.premium-comment-body {
    background: #f8f9fc;
    border: 1px solid #f0f2f7;
    border-radius: 10px;
    padding: 10px 12px;
}

.premium-comment-top {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 5px;
}

.premium-comment-top strong {
    font-size: 13px;
}

.premium-comment-top span {
    font-size: 10px;
    color: var(--muted);
}

.premium-comment-text {
    font-size: 13px;
    line-height: 1.45;
}

.premium-comment-text p {
    margin: 0;
}

.premium-empty {
    padding: 25px;
    color: var(--muted);
    text-align: center;
}


/* RESPUESTA */

.premium-response-form {
    margin-top: 18px;
    border-top: 1px solid var(--border);
    padding-top: 16px;
}

.premium-response-form textarea {
    min-height: 100px;
    padding: 13px;
}

.premium-response-actions {
    margin-top: 10px;
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    gap: 15px;
}

.premium-upload {
    flex: 1;
}

.premium-upload input {
    padding: 8px;
    font-size: 12px;
}

.premium-upload small {
    display: block;
    margin-top: 5px;
    color: var(--muted);
    font-size: 10px;
}

.premium-send {
    min-width: 165px;
}


/* HISTORIAL */

.premium-history {
    padding-top: 8px;
}

.premium-history-row {
    display: grid;
    grid-template-columns: 14px 1fr;
    gap: 10px;
    padding: 10px 0;
}

.premium-history-dot {
    width: 8px;
    height: 8px;
    margin-top: 5px;
    border-radius: 50%;
    background: var(--primary);
}

.premium-history-top {
    display: flex;
    justify-content: space-between;
    gap: 15px;
}

.premium-history-top strong {
    font-size: 12px;
}

.premium-history-top span {
    color: var(--muted);
    font-size: 10px;
}

.premium-history-row p {
    margin: 4px 0 0;
    color: #5b6980;
    font-size: 12px;
}


/* PANEL GESTIÓN */

.premium-sticky {
    position: sticky;
    top: 20px;
}

.premium-field {
    margin-top: 15px;
}

.premium-field label {
    margin-bottom: 6px;
}

.premium-field select,
.premium-field input {
    min-height: 40px;
}

.premium-save {
    margin-top: 17px;
}


/* INFO LATERAL */

.premium-info-card {
    margin-top: 0;
}

.premium-info-list {
    margin-top: 14px;
}

.premium-info-list > div {
    display: flex;
    justify-content: space-between;
    gap: 18px;
    padding: 10px 0;
    border-bottom: 1px solid #eef1f5;
}

.premium-info-list > div:last-child {
    border-bottom: none;
}

.premium-info-list span {
    color: var(--muted);
    font-size: 11px;
}

.premium-info-list strong {
    text-align: right;
    font-size: 11px;
}


/* ALERTAS */

.attention-banner {
    margin-bottom: 18px;
}


/* RESPONSIVE */

@media (max-width: 1250px) {

    .ticket-kpi-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .premium-meta-grid {
        grid-template-columns: repeat(2, 1fr);
    }

}

@media (max-width: 950px) {

    .ticket-premium-layout {
        grid-template-columns: 1fr;
    }

    .premium-sticky {
        position: static;
    }

}

@media (max-width: 650px) {

    .ticket-kpi-grid {
        grid-template-columns: 1fr;
    }

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

    .premium-attachments {
        grid-template-columns: 1fr;
    }

    .premium-response-actions {
        align-items: stretch;
        flex-direction: column;
    }

    .premium-send {
        width: 100%;
    }

    .ticket-premium-header {
        flex-direction: column;
    }

}
