:root {
    --tt-z: 2147483000 !important;
    --tt-bg: #faf6ff !important;
    --tt-surface: #ffffff !important;
    --tt-border: #d0d7de !important;
    --tt-accent: #f58318 !important;
    --tt-primary: #411870 !important;
    --tt-secondary: #f58318 !important;
    --tt-danger: #f58318 !important;
    --tt-radius: 6px !important;
    --tt-text: #24292f !important;
    --tt-font: -apple-system, BlinkMacSystemFont, Segoe UI, Roboto, Helvetica Neue, Arial, Noto Sans, sans-serif, Apple Color Emoji, Segoe UI Emoji, Segoe UI Symbol, Noto Color Emoji !important;
    --tt-transition: .15s ease !important;
    --tt-shadow: 0 1px 3px rgba(0, 0, 0, 0.3), 0 8px 24px rgba(0, 0, 0, 0.3) !important;
}

.tt-popup {
    position: fixed !important;
    background: var(--tt-surface) !important;

    right: 250px;
    bottom: 250px;

    font-size: 1.25rem;

    font-family: var(--tt-font) !important;
    border-radius: var(--tt-radius) !important;
    box-shadow: var(--tt-shadow) !important;
    overflow: hidden !important;
}

.tt-popup-title {
    font-weight: bold;
}

.tt-popup-content {
    padding: 20px;
}

.tt-dark {
    position: fixed;
    top: 50% !important;
    left: 50% !important;
    transform: translate(-50%, -50%) !important;
    background-color: rgba(0, 0, 0, 0.45);
    width: 100%;
    height: 100%;
    z-index: 999999999 !important;

    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

.tt-arrow {
    position: fixed !important;
    right: 100px;
    bottom: 100px;
    width: 150px;
    height: 150px;
    rotate: 90deg;
    z-index: 10000000000 !important;
}

.tt-highlight {
    box-shadow: 0 0 200px 80px var(--tt-accent) !important;
    transition: box-shadow var(--tt-transition) !important;
}

.tt-floating-button {
    position: fixed !important;
    bottom: 1.25rem !important;
    right: 1.25rem !important;
    width: 42px !important;
    height: 42px !important;
    border-radius: var(--tt-radius) !important;
    background: var(--tt-primary) !important;
    color: #fff !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    font-size: 13px !important;
    font-weight: 600 !important;
    padding: .25rem !important;
    cursor: pointer !important;
    z-index: var(--tt-z) !important;
    box-shadow: var(--tt-shadow);
    transition: background var(--tt-transition), transform var(--tt-transition);
    letter-spacing: .5px !important;
    z-index: 10000000000 !important;
}

.tt-floating-button:hover {
    background: var(--tt-accent) !important;
}

.tt-floating-button:active {
    transform: translateY(2px) !important;
}

.tt-panel {
    position: fixed !important;
    right: 1.25rem !important;
    bottom: 5rem !important;
    width: 420px !important;
    max-width: 95vw !important;
    max-height: 70vh !important;
    display: flex !important;
    flex-direction: column !important;
    background: var(--tt-surface) !important;
    color: var(--tt-text) !important;
    z-index: calc(var(--tt-z) + 1) !important;
    font-family: var(--tt-font) !important;
    border-radius: var(--tt-radius) !important;
    box-shadow: var(--tt-shadow) !important;
    overflow: hidden !important;
}

.tt-panel-overlay {
    position: absolute !important;
    left: 0;
    width: 100%;
    justify-content: center !important;
    text-align: center !important;
    background: none !important;
}

.tt-panel.hidden {
    display: none !important;
}

.tt-panel-header {
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    padding: .75rem 1rem !important;
    border-bottom: 1px solid var(--tt-border) !important;
    background: var(--tt-primary) !important;
}

.tt-panel-header h2 {
    margin: 0 !important;
    font-size: 16px !important;
    font-weight: 600 !important;
    color: var(--tt-bg) !important;
}

.tt-close {
    z-index: 2 !important;
    background: none !important;
    border: none !important;
    font-size: 20px !important;
    cursor: pointer !important;
    line-height: 1 !important;
    color: var(--tt-bg) !important;
}

.tt-close:hover {
    color: var(--tt-accent) !important;
}

.tt-fullarea {
    overflow-y: auto !important;
}

.tt-design-form {
    display: flex !important;
    flex-direction: column !important;
    gap: 1rem !important;
    padding: .85rem 1rem 1rem !important;
    overflow: auto !important;
}

.tt-section {
    border: 1px solid var(--tt-border) !important;
    border-radius: var(--tt-radius) !important;
    padding: .8rem .95rem 1rem !important;
    background: var(--tt-bg) !important;
}

.tt-section legend {
    padding: 0 .4rem !important;
    font-size: 11px !important;
    text-transform: uppercase !important;
    letter-spacing: .5px !important;
    font-weight: 600 !important;
}

.tt-grid-colors {
    display: grid !important;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)) !important;
    gap: .75rem !important;
}

.tt-grid-colors label {
    display: flex !important;
    flex-direction: column !important;
    gap: .35rem !important;
    font-size: 11px !important;
    font-weight: 600 !important;
    letter-spacing: .5px !important;
    position: relative !important;
}

.tt-grid-colors input[type=color] {
    width: 100% !important;
    height: 38px !important;
    padding: 0 !important;
    border: 1px solid var(--tt-border) !important;
    border-radius: 4px !important;
    background: #fff !important;
    cursor: pointer !important;
}

/* Compact icon reset buttons appended inside labels */
.tt-icon-btn,
.tt-reset-color,
.tt-reset-background {
    position: absolute !important;
    align-self: center !important;
    top: 50% !important;
    right: 4px !important;
    width: 22px !important;
    height: 22px !important;
    padding: 0 !important;
    margin: 0 !important;
    background: #fff !important;
    border: 0px !important;
    border-radius: 4px !important;
    cursor: pointer !important;
    font-size: 12px !important;
    line-height: 1 !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    color: var(--tt-text) !important;
    transition: background var(--tt-transition), color var(--tt-transition) !important;
}

.tt-icon-btn:hover,
.tt-reset-color:hover,
.tt-reset-background:hover {
    background: #f0f3f6 !important;
    color: var(--tt-accent) !important;
}

/* Ensure color input text (if UA shows text) not overlapped by button */
.tt-grid-colors input[type=color] {
    padding-right: 26px !important;
}

/* Background color label now lives inside #tt-dynamic-colors as first label */
/* No special max-width needed; inherits grid layout like others. */

.tt-full {
    display: flex !important;
    flex-direction: column !important;
    gap: .35rem !important;
    margin-top: .6rem !important;
    font-size: 11px !important;
    font-weight: 600 !important;
}

.tt-full input[type=text] {
    background: #fff !important;
    border: 1px solid var(--tt-border) !important;
    border-radius: 4px !important;
    padding: .5rem .6rem !important;
    color: var(--tt-text) !important;
    font-size: 13px !important;
}

.tt-full input[type=text]:focus {
    outline: 2px solid var(--tt-accent) !important;
}

.tt-hint {
    font-size: 11px !important;
    opacity: .65 !important;
    margin: .4rem 0 0 !important;
}

.tt-logo-row {
    display: flex !important;
    gap: 1rem !important;
    align-items: center !important;
    flex-wrap: wrap !important;
}

.tt-logo-preview {
    width: 140px !important;
    height: 70px !important;
    background: #fff !important;
    border: 1px solid var(--tt-border) !important;
    border-radius: 4px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    overflow: hidden !important;
    padding: 4px !important;
}

.tt-logo-preview img {
    max-width: 100% !important;
    max-height: 100% !important;
    object-fit: contain !important;
}

.tt-logo-actions {
    display: flex !important;
    flex-direction: column !important;
    gap: .4rem !important;
}

.tt-actions, .tt-popup-actions {
    padding: .75rem 1rem !important;
    display: flex !important;
    gap: .5rem !important;
    flex-wrap: wrap !important;
    border-top: 1px solid var(--tt-border) !important;
    background: var(--tt-bg) !important;
}

.tt-popup-actions {
    justify-content: flex-end !important;
}

.tt-button-primary,
.tt-button-secondary,
.tt-button-danger {
    cursor: pointer !important;
    border: 1px solid var(--tt-border) !important;
    font-size: 12px !important;
    font-weight: 600 !important;
    letter-spacing: .5px !important;
    padding: 8px 16px 8px 16px !important;
    border-radius: 8px !important;
    background: #f6f8fa !important;
    color: var(--tt-text) !important;
    line-height: 1.2 !important;
    font-family: var(--tt-font) !important;
    box-shadow: none !important;
    text-decoration: none !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
}

.tt-button-primary {
    background: var(--tt-accent) !important;
    color: #fff !important;
    border-color: var(--tt-accent) !important;
}

.tt-button-secondary {
    background: var(--tt-surface) !important;
}

.tt-button-secondary:hover {
    background: #f0f3f6 !important;
}

.tt-button-danger {
    background: #fff !important;
    color: var(--tt-secondary) !important;
    border-color: var(--tt-secondary) !important;
}

.tt-button-danger:hover {
    background: var(--tt-danger) !important;
    color: #fff !important;
}

@media (max-width:800px) {
    .tt-popup {
        left: 50% !important;
        top: 50% !important;
        right: auto !important;
        bottom: auto !important;
        transform: translate(-50%, -50%) !important;
        width: 95vw !important;
        max-width: 400px !important;
    }

    .tt-arrow {
        display: none !important;
    }
}


body .tt-panel .tt-actions .tt-button-primary,
html body .tt-panel .tt-actions .tt-button-primary {
    background: var(--tt-accent) !important;
    color: #fff !important;
    border-color: var(--tt-accent) !important;
}

body .tt-panel .tt-actions .tt-button-primary:hover,
html body .tt-panel .tt-actions .tt-button-primary:hover {
    background: #8f25a9 !important;
}

body .tt-panel .tt-actions .tt-button-secondary,
html body .tt-panel .tt-actions .tt-button-secondary {
    background: var(--tt-surface) !important;
    color: var(--tt-text) !important;
}

body .tt-panel .tt-actions .tt-button-secondary:hover,
html body .tt-panel .tt-actions .tt-button-secondary:hover {
    background: #f0f3f6 !important;
}

body .tt-panel .tt-actions .tt-button-danger,
html body .tt-panel .tt-actions .tt-button-danger {
    background: #fff !important;
    color: var(--tt-danger) !important;
    border-color: var(--tt-danger) !important;
}

body .tt-panel .tt-actions .tt-button-danger:hover,
html body .tt-panel .tt-actions .tt-button-danger:hover {
    background: var(--tt-danger) !important;
    color: #fff !important;
}

/* Preview toggle (state reinforcement) */
body #tt-preview-toggle.tt-preview-on,
html body #tt-preview-toggle.tt-preview-on {
    background: var(--tt-accent) !important;
    color: #fff !important;
    border-color: var(--tt-accent) !important;
}

body #tt-preview-toggle:not(.tt-preview-on),
html body #tt-preview-toggle:not(.tt-preview-on) {
    background: #fff !important;
    color: var(--tt-text) !important;
}

body #tt-preview-toggle:not(.tt-preview-on):hover,
html body #tt-preview-toggle:not(.tt-preview-on):hover {
    background: #f0f3f6 !important;
}

#tt-preview-toggle.tt-preview-on {
    background: var(--tt-accent) !important;
    color: #fff !important;
    border-color: var(--tt-accent) !important;
}

#tt-preview-toggle:not(.tt-preview-on) {
    background: #fff !important;
    color: var(--tt-text) !important;
}

#tt-preview-toggle:not(.tt-preview-on):hover {
    background: #f0f3f6 !important;
}

@media (max-width:800px) {
    .tt-panel {
        right: .75rem !important;
        left: .75rem !important;
        width: auto !important;
        bottom: 4.5rem !important;
    }

    .tt-design-form {
        max-height: 50vh !important;
    }
}