/* RESET */
*,
*::before,
*::after {
    box-sizing: border-box;
}

html, body {
    height: 100%;
    margin: 0;
    font-family: var(--body-font);
    overflow: hidden; /* evita doble scroll global */
}

/* LAYOUT PRINCIPAL */
.containerTk {
    display: grid;
    grid-template-rows: auto 1fr;
    height: 100dvh; /* mejor que 100vh */
    padding: clamp(0.25rem, 0.5vw, 0.5rem);
    gap: clamp(0.25rem, 0.5vw, 0.5rem);
    background: var(--neutral-layer-1);
    overflow: hidden;
}

/* HEADER */
.top_tk {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: clamp(0.25rem, 0.5vw, 0.5rem);
    background: var(--neutral-layer-2);
    border-radius: 4px;
    border: 1px solid var(--neutral-stroke-divider-rest);
    flex-wrap: wrap;
    gap: 0.5rem;
}

/* ZONA INFERIOR */
.bottom_tk {
    display: grid;
    grid-template-columns: minmax(260px, 30%) 1fr;
    gap: clamp(0.5rem, 1vw, 0.75rem);
    min-height: 0;
    overflow: hidden;
}

/* PANELES */
.left_tk,
.right_tk {
    display: flex;
    flex-direction: column;
    min-height: 0;
    overflow: hidden;
    border-radius: 6px;
    border: 1px solid var(--neutral-stroke-divider-rest);
    background: var(--neutral-layer-2);
    padding: clamp(0.5rem, 1vw, 0.75rem);
}

    /* SCROLL INTERNO */
    .left_tk > *,
    .right_tk > * {
        flex: 1;
        min-height: 0;
        overflow: auto;
    }

    /* SCROLL ESTÉTICO */
    .left_tk::-webkit-scrollbar,
    .right_tk::-webkit-scrollbar {
        width: 6px;
    }

    .left_tk::-webkit-scrollbar-thumb,
    .right_tk::-webkit-scrollbar-thumb {
        background: var(--neutral-stroke-strong-rest);
        border-radius: 3px;
    }

/* TICKET */
.ticket-container {
    display: flex;
    flex-direction: column;
    height: 100%;
    min-height: 0;
}

.ticket-header {
    flex: 0 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.25rem;
    background: var(--neutral-layer-2);
    border: 1px solid var(--neutral-stroke-divider-rest);
    border-radius: 4px;
}

/* CUERPO SCROLL */
.ticket-body {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 0.5rem;
    border-radius: 4px;
}

/* FORMULARIOS */
.fila-flex {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 0.5rem;
}

.columna-flex {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.form-label {
    font-size: 0.75rem;
    font-weight: 600;
}

/* BOTONES */
.ticket-actions {
    display: flex;
    gap: 0.25rem;
    flex-wrap: wrap;
}

fluent-button {
    min-height: 28px;
}

/* INPUTS */
.ticket-body fluent-text-field,
.ticket-body fluent-text-area,
.ticket-body fluent-select {
    width: 100%;
}

/* DROPDOWNS (CLAVE) */
fluent-select::part(popup),
fluent-date-picker::part(popup),
fluent-combobox::part(popup) {
    position: fixed !important;
    z-index: 9999 !important;
    max-height: 300px;
    overflow-y: auto;
}

/* RESPONSIVE */
@container (max-width: 900px) {
    .bottom_tk {
        grid-template-columns: 1fr;
        grid-template-rows: auto 1fr;
    }
}

/* MOBILE */
@media (max-width: 700px) {
    .top_tk {
        flex-direction: column;
        align-items: stretch;
    }

    .ticket-actions {
        flex-direction: column;
    }

    fluent-button {
        width: 100%;
    }

    .fila-flex {
        grid-template-columns: 1fr;
    }
}

/* LANDSCAPE BAJO */
@media (max-height: 600px) {
    .top_tk {
        padding: 0.25rem;
    }
}

/* TOUCH */
@media (pointer: coarse) {
    fluent-button {
        min-height: 44px;
    }
}

/* ACCESIBILIDAD */
:focus-visible {
    outline: 2px solid var(--accent-fill-rest);
    outline-offset: 2px;
}

/* PERFORMANCE */
.left_tk,
.right_tk,
.ticket-body {
    contain: layout paint;
}
