/* Tapi Maintenance Launcher - all classes are prefixed to avoid Elementor/theme collisions. */
.tml-shell,
.tml-shell *,
.tml-shell *::before,
.tml-shell *::after {
    box-sizing: border-box;
}

.tml-shell {
    --tml-button-height: 64px;
    --tml-offset-side: 24px;
    --tml-offset-bottom: 24px;
    --tml-panel-width: 430px;
    --tml-panel-height: 690px;
    --tml-panel-gap: 14px;
    position: fixed;
    bottom: var(--tml-offset-bottom);
    z-index: 99990;
    width: max-content;
    max-width: calc(100vw - 20px);
    color: #172033;
    font-family: inherit;
    font-size: 14px;
    line-height: 1.5;
    isolation: isolate;
}

.tml-shell.tml-side-right { right: var(--tml-offset-side); }
.tml-shell.tml-side-left { left: var(--tml-offset-side); }

.tml-shell .tml-button {
    --tml-graphic-size: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: auto;
    min-width: var(--tml-button-height);
    height: var(--tml-button-height);
    min-height: 0;
    padding: 14px 19px;
    border: 0;
    border-radius: 999px;
    background: #1e293b;
    color: #fff;
    box-shadow: 0 10px 32px rgb(15 23 42 / 22%);
    cursor: pointer;
    font-family: inherit;
    font-size: 14px;
    font-weight: 600;
    line-height: 1.2;
    text-transform: none;
    text-decoration: none;
    white-space: nowrap;
    transition: transform 180ms ease, background-color 180ms ease, color 180ms ease, box-shadow 180ms ease;
    -webkit-tap-highlight-color: transparent;
}

.tml-shell .tml-button:hover,
.tml-shell .tml-button:focus-visible {
    background: #334155;
    color: #fff;
    transform: translateY(-2px);
}

.tml-shell .tml-button:focus-visible,
.tml-shell .tml-close:focus-visible {
    outline: 3px solid #3b82f6;
    outline-offset: 3px;
}

.tml-button-graphic {
    display: inline-flex;
    flex: 0 0 auto;
    align-items: center;
    justify-content: center;
    width: var(--tml-graphic-size);
    height: var(--tml-graphic-size);
    font-size: var(--tml-graphic-size);
    line-height: 1;
}

.tml-button-graphic svg,
.tml-button-graphic i,
.tml-button-graphic img {
    display: block;
    width: 100%;
    height: 100%;
    flex-shrink: 0;
}

.tml-button-graphic svg { fill: currentColor; }
.tml-button-graphic svg.tml-outline-icon { fill: none; }
.tml-button-graphic img.tml-button-image {
    object-fit: cover;
    object-position: center;
    border-radius: 50%;
}
.tml-button-label { display: inline-block; }

.tml-shell .tml-panel {
    position: absolute;
    bottom: calc(100% + var(--tml-panel-gap));
    width: min(var(--tml-panel-width), calc(100vw - var(--tml-offset-side) - 12px));
    height: var(--tml-panel-height);
    max-height: calc(100vh - var(--tml-offset-bottom) - var(--tml-button-height) - var(--tml-panel-gap) - 12px);
    max-height: calc(100dvh - var(--tml-offset-bottom) - var(--tml-button-height) - var(--tml-panel-gap) - 12px);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border: 1px solid #e2e8f0;
    border-radius: 18px;
    background: #fff;
    box-shadow: 0 22px 70px rgb(15 23 42 / 20%), 0 5px 18px rgb(15 23 42 / 8%);
    color: #172033;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transform: translateY(12px) scale(.985);
    transform-origin: bottom right;
    transition: opacity 200ms ease, visibility 200ms ease, transform 200ms ease;
}

.tml-side-right .tml-panel { right: 0; }
.tml-side-left .tml-panel {
    left: 0;
    transform-origin: bottom left;
}

.tml-shell.tml-open .tml-panel {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transform: translateY(0) scale(1);
}

.tml-panel-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    flex: 0 0 auto;
    gap: 16px;
    padding: 22px 22px 18px;
    border-bottom: 1px solid #e8edf2;
    background: #fff;
}

.tml-header-copy { min-width: 0; }
.tml-shell .tml-panel-title {
    margin: 0;
    padding: 0;
    border: 0;
    color: #0f172a;
    font-family: inherit;
    font-size: 19px;
    font-weight: 700;
    line-height: 1.25;
    letter-spacing: -.015em;
    text-transform: none;
}
.tml-shell .tml-panel-subtitle {
    margin: 5px 0 0;
    padding: 0;
    color: #64748b;
    font-family: inherit;
    font-size: 12px;
    line-height: 1.45;
}

.tml-shell .tml-close {
    display: grid;
    flex: 0 0 32px;
    place-items: center;
    width: 32px;
    height: 32px;
    padding: 7px;
    border: 0;
    border-radius: 50%;
    background: #f1f5f9;
    color: #334155;
    cursor: pointer;
    transition: background-color 140ms ease, color 140ms ease;
}
.tml-shell .tml-close:hover { filter: brightness(.94); }
.tml-shell .tml-close svg { display: block; width: 100%; height: 100%; }

.tml-panel-body {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    min-height: 0;
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: contain;
    scrollbar-width: thin;
}

.tml-notice {
    flex: 0 0 auto;
    margin: 15px 18px 7px;
    padding: 14px 15px;
    border-inline-start: 3px solid #ea580c;
    border-radius: 9px;
    background: #fff7ed;
    color: #7c2d12;
    font-family: inherit;
    font-size: 12px;
    line-height: 1.55;
    overflow-wrap: anywhere;
}
.tml-notice strong { font-weight: 700; }

.tml-embed-area {
    position: relative;
    display: flex;
    flex: 1 0 auto;
    flex-direction: column;
    min-height: 370px;
    padding: 8px 18px 16px;
    background: #fff;
}

/* Let Tapi own the internals; only ensure its outer container fits our panel. */
.tml-embed-area .tapi-embedded-request {
    display: block;
    width: 100%;
    min-width: 0;
    min-height: 340px;
    flex: 1 1 auto;
}

.tml-embed-area .tml-loader:not([hidden]) {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 11px;
    padding: 16px 0;
    color: #475569;
    font-size: 12px;
}
.tml-spinner {
    width: 20px;
    height: 20px;
    border: 2px solid #cbd5e1;
    border-top-color: #334155;
    border-radius: 50%;
    animation: tml-spin 850ms linear infinite;
}
@keyframes tml-spin { to { transform: rotate(360deg); } }

.tml-embed-area .tml-error:not([hidden]) {
    display: block;
    padding: 12px;
    margin: 8px 0;
    border-radius: 8px;
    background: #fef2f2;
    color: #991b1b;
    font-size: 12px;
}

.tml-editor-placeholder {
    display: flex;
    flex: 1 1 auto;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 11px;
    min-height: 260px;
    padding: 20px;
    border: 1px dashed #cbd5e1;
    border-radius: 10px;
    background: #f8fafc;
    color: #475569;
    text-align: center;
    font-size: 13px;
}
.tml-editor-placeholder strong { color: #1e293b; font-size: 15px; }
.tml-editor-placeholder-symbol { font-size: 30px; line-height: 1; }

@media (max-width: 767px) {
    .tml-shell {
        --tml-offset-side: 16px;
        --tml-offset-bottom: 16px;
    }
    .tml-shell .tml-panel { width: min(var(--tml-panel-width), calc(100vw - var(--tml-offset-side) - 12px)); }
    .tml-panel-header { gap: 10px; }
    .tml-notice { margin: 12px 13px 5px; }
    .tml-embed-area { min-height: 330px; }
}

@media (prefers-reduced-motion: reduce) {
    .tml-shell .tml-button,
    .tml-shell .tml-panel { transition: none; }
    .tml-spinner { animation-duration: 3s; }
}
