.td-vip-error-retry-host {
    position: fixed;
    right: 18px;
    bottom: 86px;
    z-index: 10045;
    width: min(380px, calc(100vw - 24px));
}

.td-vip-error-retry-host.is-hidden {
    display: none;
}

.td-vip-error-retry-inner {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
    padding: 10px 14px;
    border-radius: 12px;
    background: #ffffff;
    border: 1px solid #fecaca;
    box-shadow: 0 12px 36px -16px rgba(185, 28, 28, 0.35);
}

.td-vip-error-retry-copy {
    display: grid;
    gap: 6px;
}

.td-vip-error-retry-msg {
    font-size: 13px;
    font-weight: 700;
    color: #991b1b;
}

.td-vip-error-retry-request {
    font-size: 11px;
    color: #b45309;
    word-break: break-all;
}

.td-vip-error-retry-actions,
.td-vip-diagnostics-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.td-vip-diagnostics-panel {
    display: grid;
    gap: 14px;
}

.td-vip-diagnostics-summary {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
}

.td-vip-diagnostics-stat,
.td-vip-diagnostics-item {
    border: 1px solid #e2e8f0;
    border-radius: 14px;
    background: #f8fafc;
}

.td-vip-diagnostics-stat {
    padding: 10px 12px;
}

.td-vip-diagnostics-stat span {
    display: block;
    margin-bottom: 4px;
    font-size: 11px;
    color: #64748b;
}

.td-vip-diagnostics-stat strong {
    display: block;
    font-size: 12px;
    color: #0f172a;
    word-break: break-all;
}

.td-vip-diagnostics-list {
    display: grid;
    gap: 10px;
}

.td-vip-diagnostics-item {
    padding: 12px;
}

.td-vip-diagnostics-item-head,
.td-vip-diagnostics-item-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.td-vip-diagnostics-item-head strong,
.td-vip-diagnostics-item-msg {
    color: #0f172a;
}

.td-vip-diagnostics-item-head span,
.td-vip-diagnostics-item-detail {
    color: #64748b;
}

.td-vip-diagnostics-item-msg {
    margin: 8px 0;
    font-size: 13px;
    line-height: 1.55;
}

.td-vip-diagnostics-chip {
    display: inline-flex;
    align-items: center;
    min-height: 24px;
    padding: 3px 8px;
    border-radius: 999px;
    border: 1px solid #dbe3ee;
    background: #ffffff;
    font-size: 11px;
    font-weight: 700;
    color: #475569;
}

.td-vip-diagnostics-item-detail {
    margin: 8px 0 0;
    white-space: pre-wrap;
    word-break: break-word;
    font-size: 11px;
    line-height: 1.55;
}

body.td-vip-body.is-night-mode .td-vip-error-retry-inner,
body.td-vip-body.is-night-mode .td-vip-diagnostics-stat,
body.td-vip-body.is-night-mode .td-vip-diagnostics-item {
    border-color: #243447;
    background: rgba(8, 18, 32, 0.96);
}

body.td-vip-body.is-night-mode .td-vip-error-retry-msg,
body.td-vip-body.is-night-mode .td-vip-diagnostics-item-head strong,
body.td-vip-body.is-night-mode .td-vip-diagnostics-item-msg,
body.td-vip-body.is-night-mode .td-vip-diagnostics-stat strong {
    color: #e2e8f0;
}

body.td-vip-body.is-night-mode .td-vip-error-retry-request,
body.td-vip-body.is-night-mode .td-vip-diagnostics-stat span,
body.td-vip-body.is-night-mode .td-vip-diagnostics-item-head span,
body.td-vip-body.is-night-mode .td-vip-diagnostics-item-detail,
body.td-vip-body.is-night-mode .td-vip-diagnostics-chip {
    color: #8ea2b8;
}

body.td-vip-body.is-night-mode .td-vip-diagnostics-chip {
    border-color: #243447;
    background: rgba(15, 23, 42, 0.9);
}

.td-vip-brand-toggle {
    appearance: none;
    cursor: pointer;
}

.td-vip-brand-popover {
    position: absolute;
    top: calc(100% + 12px);
    left: 0;
    z-index: 35;
    width: min(304px, calc(100vw - 24px));
    padding: 10px 10px 12px;
    border: 1px solid rgba(226, 232, 240, 0.96);
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.98);
    box-shadow: 0 26px 60px -28px rgba(15, 23, 42, 0.26);
    opacity: 0;
    visibility: hidden;
    transform: translateY(8px) scale(0.985);
    transform-origin: top left;
    transition: opacity 0.18s ease, transform 0.18s ease, visibility 0.18s ease;
}

.td-vip-top-tool.is-open .td-vip-brand-popover:not(.td-vip-brand-popover--floating) {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
}

.td-vip-brand-popover.td-vip-brand-popover--floating:not(.is-hidden) {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
}

.td-vip-brand-popover.is-hidden {
    pointer-events: none;
}

.td-vip-brand-popover-head {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 6px 6px 12px;
}

.td-vip-brand-popover-avatar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    border-radius: 999px;
    overflow: hidden;
    background: linear-gradient(180deg, #ffffff, #f3f6fa);
    box-shadow: inset 0 0 0 1px rgba(203, 213, 225, 0.92);
    flex: 0 0 auto;
}

.td-vip-brand-popover-avatar img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.td-vip-brand-popover-copy {
    display: grid;
    gap: 3px;
    min-width: 0;
}

.td-vip-brand-popover-copy strong {
    color: #334155;
    font-size: 19px;
    font-weight: 650;
    letter-spacing: -0.025em;
    line-height: 1.05;
}

.td-vip-brand-popover-copy span {
    color: #94a3b8;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.16em;
    text-transform: uppercase;
}

.td-vip-brand-popover-list {
    display: grid;
    gap: 2px;
}

.td-vip-brand-popover-item {
    display: grid;
    grid-template-columns: 22px minmax(0, 1fr);
    align-items: center;
    gap: 12px;
    width: 100%;
    min-height: 42px;
    padding: 0 12px;
    border: 0;
    border-radius: 12px;
    background: transparent;
    color: #111827;
    font: inherit;
    font-size: 14px;
    font-weight: 500;
    text-align: left;
    text-decoration: none;
    cursor: pointer;
    transition: background-color 0.16s ease, color 0.16s ease;
}

.td-vip-brand-popover-item:hover,
.td-vip-brand-popover-item:focus-visible {
    background: #f3f6f9;
    color: #111827;
    outline: none;
}

.td-vip-brand-popover-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #111827;
    font-size: 18px;
    line-height: 1;
}

.td-vip-brand-popover-divider {
    height: 1px;
    margin: 10px 6px;
    background: rgba(226, 232, 240, 0.96);
}

.td-vip-brand-settings-host {
    display: grid;
    gap: 10px;
}

.td-vip-brand-settings-host .td-vip-settings-section {
    gap: 10px;
    padding: 12px 12px 10px;
    border-radius: 16px;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(247, 250, 253, 0.98));
    box-shadow: none;
}

.td-vip-brand-settings-host .td-vip-settings-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 10px;
}

.td-vip-brand-settings-host .td-vip-settings-copy strong {
    font-size: 15px;
    font-weight: 700;
    letter-spacing: -0.02em;
}

.td-vip-brand-settings-host .td-vip-settings-copy span {
    font-size: 12px;
    line-height: 1.4;
}

.td-vip-brand-settings-host .td-vip-settings-action,
.td-vip-brand-settings-host .td-vip-settings-theme-btn {
    min-height: 32px;
    padding: 0 10px;
    border-radius: 10px;
}

.td-vip-brand-settings-host .td-vip-settings-section--appearance .td-vip-appearance-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
}

.td-vip-brand-settings-host .td-vip-appearance-field span,
.td-vip-brand-settings-host .td-vip-appearance-check span {
    font-size: 12px;
}

.td-vip-brand-settings-host .td-vip-appearance-range-wrap {
    min-height: 38px;
}

.td-vip-brand-settings-host .td-vip-appearance-actions {
    margin-top: 2px;
}

body.td-vip-body .td-vip-brand-popover {
    border-color: rgba(226, 232, 240, 0.96);
    background: rgba(255, 255, 255, 0.99);
    box-shadow: 0 26px 60px -28px rgba(15, 23, 42, 0.26);
}

body.td-vip-body .td-vip-brand-settings-host .td-vip-settings-section {
    border-color: rgba(226, 232, 240, 0.92);
}

body.td-vip-body .td-vip-brand-popover-item {
    font-size: 14px;
}

body.td-vip-body.is-night-mode .td-vip-brand-popover {
    border-color: rgba(31, 41, 55, 0.96);
    background: linear-gradient(180deg, rgba(10, 20, 34, 0.99), rgba(7, 17, 30, 0.99));
    box-shadow: 0 26px 60px -28px rgba(2, 6, 23, 0.72);
}

body.td-vip-body.is-night-mode .td-vip-brand-popover-avatar {
    background: linear-gradient(180deg, rgba(15, 23, 42, 0.98), rgba(8, 18, 32, 0.98));
    box-shadow: inset 0 0 0 1px rgba(51, 65, 85, 0.92);
}

body.td-vip-body.is-night-mode .td-vip-brand-popover-copy strong {
    color: #dbe7f3;
}

body.td-vip-body.is-night-mode .td-vip-brand-popover-copy span {
    color: #73879f;
}

body.td-vip-body.is-night-mode .td-vip-brand-popover-item {
    color: #dbe7f3;
}

body.td-vip-body.is-night-mode .td-vip-brand-popover-item:hover,
body.td-vip-body.is-night-mode .td-vip-brand-popover-item:focus-visible {
    background: rgba(15, 23, 42, 0.96);
    color: #f8fafc;
}

body.td-vip-body.is-night-mode .td-vip-brand-popover-icon {
    color: #b8c7d9;
}

body.td-vip-body.is-night-mode .td-vip-brand-popover-divider {
    background: rgba(51, 65, 85, 0.92);
}

body.td-vip-body.is-night-mode .td-vip-brand-settings-host .td-vip-settings-section {
    border-color: rgba(51, 65, 85, 0.92);
    background: linear-gradient(180deg, rgba(11, 21, 36, 0.98), rgba(8, 18, 32, 0.98));
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.03);
}

body.td-vip-body.is-night-mode .td-vip-brand-settings-host .td-vip-settings-copy strong {
    color: #e2e8f0;
}

body.td-vip-body.is-night-mode .td-vip-brand-settings-host .td-vip-settings-copy span,
body.td-vip-body.is-night-mode .td-vip-brand-settings-host .td-vip-appearance-field span,
body.td-vip-body.is-night-mode .td-vip-brand-settings-host .td-vip-appearance-check span {
    color: #94a3b8;
}

.td-vip-tool-dialog--brand-help {
    width: min(660px, 100%);
}

.td-vip-tool-dialog--brand-support {
    width: min(430px, 100%);
}

.td-vip-brand-help-flow {
    display: grid;
    gap: 10px;
    margin-top: 18px;
}

.td-vip-brand-help-step {
    display: grid;
    grid-template-columns: 34px minmax(0, 1fr);
    gap: 12px;
    padding: 14px 15px;
    border: 1px solid rgba(226, 232, 240, 0.92);
    border-radius: 16px;
    background: rgba(248, 250, 252, 0.92);
}

.td-vip-brand-help-step-no {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border-radius: 999px;
    background: rgba(15, 23, 42, 0.92);
    color: #f8fafc;
    font-size: 13px;
    font-weight: 700;
}

.td-vip-brand-help-step-copy {
    display: grid;
    gap: 6px;
}

.td-vip-brand-help-step-copy strong,
.td-vip-brand-help-tips strong {
    color: #0f172a;
    font-size: 15px;
    font-weight: 700;
}

.td-vip-brand-help-step-copy p,
.td-vip-brand-help-tips p,
.td-vip-brand-support-note {
    margin: 0;
    color: #475569;
    font-size: 13px;
    line-height: 1.65;
}

.td-vip-brand-help-tips {
    display: grid;
    gap: 6px;
    margin-top: 14px;
    padding: 14px 16px;
    border-radius: 16px;
    background: linear-gradient(180deg, rgba(239, 246, 255, 0.96), rgba(248, 250, 252, 0.96));
    border: 1px solid rgba(191, 219, 254, 0.92);
}

.td-vip-brand-support-stage {
    display: grid;
    justify-items: center;
    gap: 14px;
    padding-top: 10px;
}

.td-vip-brand-support-qr {
    display: grid;
    place-items: center;
    width: min(260px, 100%);
    padding: 12px;
    border-radius: 20px;
    background: #ffffff;
    border: 1px solid rgba(226, 232, 240, 0.92);
    box-shadow: 0 18px 34px -24px rgba(15, 23, 42, 0.28);
}

.td-vip-brand-support-qr img {
    display: block;
    width: 100%;
    height: auto;
    border-radius: 14px;
}

.td-vip-brand-support-note {
    max-width: 280px;
    text-align: center;
}

body.td-vip-body.is-night-mode .td-vip-brand-help-step,
body.td-vip-body.is-night-mode .td-vip-brand-support-qr,
body.td-vip-body.is-night-mode .td-vip-brand-help-tips {
    border-color: #243447;
    background: rgba(8, 18, 32, 0.96);
}

body.td-vip-body.is-night-mode .td-vip-brand-help-step-copy strong,
body.td-vip-body.is-night-mode .td-vip-brand-help-tips strong {
    color: #e2e8f0;
}

body.td-vip-body.is-night-mode .td-vip-brand-help-step-copy p,
body.td-vip-body.is-night-mode .td-vip-brand-help-tips p,
body.td-vip-body.is-night-mode .td-vip-brand-support-note {
    color: #94a3b8;
}

/* ============================================================
 *  Product modals, toasts, retry, skeleton, compact layout
 * ============================================================ */
.td-vip-product-modal {
    position: fixed;
    inset: 0;
    z-index: 10060;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
}

.td-vip-product-modal.is-hidden {
    display: none;
}

.td-vip-product-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.45);
}

.td-vip-product-modal-dialog {
    position: relative;
    z-index: 1;
    width: min(420px, 100%);
    max-height: min(80vh, 560px);
    overflow: auto;
    border-radius: 14px;
    background: #ffffff;
    border: 1px solid #e5e7eb;
    box-shadow: 0 24px 64px -24px rgba(15, 23, 42, 0.35);
}

.td-vip-product-modal-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 14px 16px;
    border-bottom: 1px solid #e5e7eb;
    font-size: 15px;
}

.td-vip-product-modal-close {
    border: none;
    background: transparent;
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
    color: #64748b;
}

.td-vip-product-modal-body {
    padding: 14px 16px;
}

.td-vip-product-modal-foot {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: flex-end;
    padding: 12px 16px 16px;
    border-top: 1px solid #f1f5f9;
}

.td-vip-toast-host {
    position: fixed;
    right: 16px;
    bottom: 16px;
    z-index: 10055;
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-width: min(360px, calc(100vw - 32px));
    pointer-events: none;
}

.td-vip-toast-item {
    pointer-events: none;
    padding: 10px 14px;
    border-radius: 10px;
    background: rgba(15, 23, 42, 0.92);
    color: #f8fafc;
    font-size: 13px;
    line-height: 1.45;
    box-shadow: 0 12px 32px -12px rgba(0, 0, 0, 0.35);
    opacity: 1;
    transform: translateY(0);
    transition: opacity 0.22s ease, transform 0.22s ease;
}

.td-vip-toast-item.is-out {
    opacity: 0;
    transform: translateY(6px);
}

#tdVipChartHost.is-td-vip-skeleton {
    position: relative;
}

#tdVipChartHost.is-td-vip-skeleton::after {
    content: "";
    position: absolute;
    inset: 0;
    z-index: 3;
    pointer-events: none;
    background: linear-gradient(
        110deg,
        rgba(226, 232, 240, 0.2) 0%,
        rgba(226, 232, 240, 0.65) 42%,
        rgba(226, 232, 240, 0.2) 84%
    );
    background-size: 200% 100%;
    animation: td-vip-skeleton-shimmer 1.1s ease-in-out infinite;
}

@keyframes td-vip-skeleton-shimmer {
    0% { background-position: 100% 0; }
    100% { background-position: -100% 0; }
}

.td-vip-terminal.td-vip-layout-compact-side .td-vip-terminal-body {
    grid-template-columns: 54px minmax(0, 1fr) 6px 220px 44px;
}

.td-vip-terminal.td-vip-layout-compact-side .td-vip-watch-text span:last-child {
    display: none;
}

.td-vip-journal-form-actions {
    display: flex;
    gap: 8px;
    margin-top: 8px;
}

.td-vip-journal-stats-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    margin-bottom: 12px;
}

.td-vip-journal-stat {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 8px 10px;
    border-radius: 10px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    font-size: 12px;
}

.td-vip-journal-stat em {
    font-style: normal;
    color: #64748b;
}

.td-vip-journal-stat strong {
    font-size: 15px;
    color: #0f172a;
}

.td-vip-journal-item-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 4px;
}

.td-vip-journal-tag {
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 999px;
    background: #e2e8f0;
    color: #475569;
}

.td-vip-journal-tag--open {
    background: #dbeafe;
    color: #1d4ed8;
}

.td-vip-journal-tag--closed {
    background: #dcfce7;
    color: #166534;
}

.td-vip-journal-item-meta {
    font-size: 12px;
    color: #475569;
}

.td-vip-replay-virtual-summary {
    font-size: 11px;
    color: #64748b;
    margin-right: 6px;
    white-space: nowrap;
}

.td-vip-replay-stats-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.td-vip-replay-stats-table th,
.td-vip-replay-stats-table td {
    padding: 6px 8px;
    border-bottom: 1px solid #e5e7eb;
    text-align: left;
}

.td-vip-replay-stats-table th {
    width: 42%;
    color: #64748b;
    font-weight: 500;
}

.td-vip-replay-kp-list {
    margin-top: 12px;
    font-size: 12px;
}

.td-vip-replay-kp-list ul {
    margin: 6px 0 0;
    padding-left: 18px;
}

.td-vip-replay-kp-time {
    font-family: var(--td-vip-font-ui);
    color: #64748b;
}

body.td-vip-body.is-night-mode .td-vip-product-modal-dialog {
    background: #0f172a;
    border-color: #334155;
    color: #e2e8f0;
}

body.td-vip-body.is-night-mode .td-vip-product-modal-head {
    border-color: #334155;
}

body.td-vip-body.is-night-mode .td-vip-replay-stats-table th,
body.td-vip-body.is-night-mode .td-vip-replay-stats-table td {
    border-color: #334155;
}

body.td-vip-body.is-night-mode .td-vip-journal-stat {
    background: #0f172a;
    border-color: #334155;
}

body.td-vip-body.is-night-mode .td-vip-journal-stat strong {
    color: #f1f5f9;
}

body.td-vip-body.is-night-mode #tdVipChartHost.is-td-vip-skeleton::after {
    background: linear-gradient(
        110deg,
        rgba(30, 41, 59, 0.15) 0%,
        rgba(51, 65, 85, 0.55) 42%,
        rgba(30, 41, 59, 0.15) 84%
    );
    background-size: 200% 100%;
}

.td-vip-ext-subhead {
    font-size: 13px;
    font-weight: 600;
    margin: 10px 0 6px;
    color: #334155;
}

body.td-vip-body.is-night-mode .td-vip-ext-subhead {
    color: #cbd5e1;
}

@media (max-width: 680px) {
    .td-vip-error-retry-host {
        left: 12px;
        right: 12px;
        width: auto;
        bottom: 72px;
    }

    .td-vip-diagnostics-summary {
        grid-template-columns: 1fr;
    }
}
