:root {
    --todox-bg: #05080d;
    --todox-bg-2: #080d14;
    --todox-surface: #111821;
    --todox-surface-2: #0b1119;
    --todox-border: rgba(255, 183, 0, .22);
    --todox-gold: #ffb700;
    --todox-gold-2: #ffd45a;
    --todox-text: #ffffff;
    --todox-muted: #aeb7c4;
    --todox-green: #4caf50;
    --todox-red: #ef4444;
}

html,
body {
    background: var(--todox-bg) !important;
    color: var(--todox-text) !important;
}

body,
.mud-typography,
.mud-input,
.mud-button,
.mud-table,
.mud-nav-link {
    font-family: "Segoe UI", "Inter", "Roboto", Arial, sans-serif !important;
}

.todox-shell {
    min-height: 100vh;
    background:
        radial-gradient(circle at 80% 5%, rgba(255, 183, 0, .12), transparent 30%),
        linear-gradient(145deg, #05080d 0%, #08111b 48%, #05070b 100%);
}

.todox-appbar {
    height: 72px !important;
    min-height: 72px !important;
    background: rgba(5, 8, 13, .96) !important;
    color: var(--todox-text) !important;
    border-bottom: 1px solid rgba(255, 255, 255, .08);
    box-shadow: none !important;
    backdrop-filter: blur(14px);
}

.todox-top-logo {
    display: flex;
    align-items: center;
    margin-left: 8px;
}

.todox-logo-text {
    display: inline-flex;
    align-items: baseline;
    color: #ffffff;
    font-size: 34px;
    font-weight: 900;
    letter-spacing: -1.4px;
    line-height: 1;
    text-decoration: none;
    white-space: nowrap;
}

.todox-logo-text span {
    color: var(--todox-gold);
}

.todox-user-hello {
    color: #ffffff !important;
    margin-right: 14px;
}

.todox-user-activator {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 4px 10px 4px 6px;
    border-radius: 999px;
    cursor: pointer;
    transition: background .18s ease;
}

.todox-activator {
    cursor: pointer;
    display: inline-flex;
    align-items: center;
}

.todox-prompt-box textarea {
    font-family: "Consolas", "Menlo", monospace !important;
    font-size: 12.5px !important;
    line-height: 1.5 !important;
}

.todox-error-pre {
    white-space: pre-wrap;
    word-break: break-word;
    user-select: all;
    font-family: "Consolas", "Menlo", monospace;
    font-size: 12px;
    margin: 6px 0 0 0;
    max-height: 260px;
    overflow: auto;
}

.todox-user-activator:hover {
    background: rgba(255, 183, 0, .10);
}

.todox-user-activator .todox-user-hello {
    margin-right: 4px;
}

.todox-notify-badge {
    margin-right: 4px;
}

.todox-notify-head,
.todox-user-menu-head {
    padding: 12px 16px 8px 16px;
}

.todox-notify-head {
    font-weight: 800;
    color: #ffffff;
}

.todox-user-menu-name {
    font-weight: 800;
    color: #ffffff;
}

.todox-user-menu-email {
    font-size: 13px;
    color: var(--todox-muted);
    margin-top: 2px;
}

.todox-user-menu-role {
    margin-top: 8px;
    display: inline-block;
    color: var(--todox-gold);
    background: rgba(255, 183, 0, .12);
    border: 1px solid rgba(255, 183, 0, .22);
    padding: 2px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 700;
}

.todox-avatar,
.todox-sidebar-avatar {
    background: var(--todox-gold) !important;
    color: #111111 !important;
    font-weight: 800 !important;
    overflow: hidden !important;
    flex: 0 0 auto;
}

.todox-avatar {
    width: 44px !important;
    height: 44px !important;
}

.todox-avatar-img,
.todox-avatar img,
.todox-avatar .mud-image-root {
    width: 100% !important;
    height: 100% !important;
    display: block !important;
    object-fit: cover !important;
    object-position: center !important;
    border-radius: 999px !important;
}

.todox-drawer {
    background: linear-gradient(180deg, #05080d 0%, #080d14 100%) !important;
    border-right: 1px solid rgba(255, 255, 255, .08);
}

.todox-sidebar-logo {
    height: 92px;
    display: flex;
    align-items: center;
    padding: 0 30px;
    border-bottom: 1px solid rgba(255, 255, 255, .08);
}

.todox-nav {
    padding-top: 14px;
    padding-bottom: 24px;
}

.todox-nav .mud-nav-link {
    min-height: 56px;
    margin: 5px 12px;
    padding-left: 18px;
    border-radius: 10px;
    color: rgba(255, 255, 255, .78) !important;
    font-size: 15px;
    font-weight: 650;
}

.todox-nav-loading {
    padding: 18px 16px;
}

.todox-nav .mud-nav-group > .mud-nav-link {
    min-height: 48px;
    margin-top: 10px;
    margin-bottom: 2px;
    padding-left: 18px;
    color: rgba(255, 255, 255, .9) !important;
    font-weight: 850;
    letter-spacing: 0;
}

.todox-nav .mud-nav-group .mud-collapse-container .mud-nav-link {
    min-height: 44px;
    margin-top: 3px;
    margin-bottom: 3px;
    padding-left: 42px;
    font-size: .92rem;
    font-weight: 650;
    opacity: .94;
}

.todox-nav .mud-nav-group .mud-collapse-container .mud-nav-link .mud-icon-root {
    margin-right: 10px;
}

.todox-nav .mud-nav-link .mud-icon-root {
    color: rgba(255, 255, 255, .76) !important;
    margin-right: 12px;
}

.todox-nav .mud-nav-link:hover {
    background: rgba(255, 183, 0, .11) !important;
    color: #ffffff !important;
}

.todox-nav .mud-nav-link.active:not(.mud-nav-link-disabled),
.todox-nav .mud-nav-link.mud-nav-link-active {
    background: linear-gradient(90deg, rgba(255, 183, 0, .30), rgba(255, 183, 0, .08)) !important;
    color: var(--todox-gold) !important;
    font-weight: 800 !important;
}

.todox-nav .mud-nav-link.active .mud-icon-root,
.todox-nav .mud-nav-link.mud-nav-link-active .mud-icon-root {
    color: var(--todox-gold) !important;
}

.todox-content {
    padding: 104px 32px 32px 32px !important;
    background: transparent !important;
}

.todox-breadcrumb {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    min-height: 42px;
    padding: 9px 14px;
    margin-bottom: 24px;
    color: var(--todox-gold);
    background: rgba(5, 8, 13, .52);
    border: 1px solid rgba(255, 183, 0, .22);
    border-radius: 10px;
    position: relative;
    z-index: 2;
}

.todox-breadcrumb .mud-icon-root {
    color: rgba(255, 255, 255, .80) !important;
}

.profile-avatar-card {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.profile-avatar-frame {
    width: 156px;
    height: 156px;
    border-radius: 999px;
    border: 2px solid rgba(255, 183, 0, .45);
    background: rgba(255, 183, 0, .12);
    color: #111111;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    overflow: hidden;
    cursor: default;
    box-shadow: 0 16px 42px rgba(0, 0, 0, .32);
}

.profile-avatar-frame.is-clickable {
    cursor: zoom-in;
}

.profile-avatar-frame:disabled {
    opacity: 1;
}

.profile-avatar-frame img {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: cover;
    object-position: center;
}

.profile-avatar-frame span {
    font-size: 58px;
    font-weight: 900;
    color: var(--todox-gold);
}

.profile-avatar-upload {
    position: relative;
    margin-top: 18px;
    min-height: 42px;
    padding: 0 18px;
    border-radius: 8px;
    border: 1px solid rgba(255, 183, 0, .72);
    color: var(--todox-gold);
    background: rgba(255, 183, 0, .08);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-weight: 800;
    cursor: pointer;
    transition: background .18s ease, border-color .18s ease;
}

.profile-avatar-upload:hover {
    background: rgba(255, 183, 0, .16);
    border-color: var(--todox-gold);
}

.profile-avatar-upload.is-disabled {
    pointer-events: none;
    opacity: .65;
}

.profile-avatar-upload input[type="file"] {
    position: absolute;
    inset: 0;
    opacity: 0;
    cursor: pointer;
}

.todox-mr-avatar-preview {
    width: 180px;
    height: 180px;
    border-radius: 24px;
    overflow: hidden;
    border: 1px solid rgba(255, 183, 0, 0.35);
    background: radial-gradient(circle at top, rgba(255, 183, 0, 0.18), rgba(8, 13, 20, 0.9));
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
}

.todox-mr-avatar-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.todox-mr-avatar-empty {
    color: rgba(255, 255, 255, 0.65);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    text-align: center;
    padding: 12px;
}

.todox-mr-avatar-form,
.service-thumbnail-fields {
    min-width: min(100%, 420px);
    flex: 1 1 420px;
}

.service-thumbnail-tool {
    border: 1px solid rgba(255, 183, 0, 0.22);
    background: rgba(5, 8, 13, 0.36) !important;
}

.service-thumbnail-preview {
    width: 132px;
    aspect-ratio: 9 / 16;
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid rgba(255, 183, 0, 0.35);
    background: radial-gradient(circle at top, rgba(255, 183, 0, 0.18), rgba(8, 13, 20, 0.9));
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
}

.service-thumbnail-preview img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    object-position: center;
    display: block;
}

.todox-render-preview-box {
    min-height: 460px;
    border: 1px solid rgba(255, 183, 0, 0.28);
    border-radius: 16px;
    background: rgba(6, 12, 22, 0.92);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    padding: 12px;
}

.todox-render-preview-box img {
    max-width: 100%;
    max-height: 560px;
    object-fit: contain;
    border-radius: 12px;
}

.todox-render-preview-placeholder {
    display: flex;
    width: 100%;
    height: 100%;
    min-height: 420px;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
}

.todox-ref-image-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(88px, 1fr));
    gap: 10px;
}

.todox-ref-image-item {
    position: relative;
    border-radius: 10px;
    border: 1px solid rgba(255, 183, 0, 0.25);
    overflow: hidden;
    background: #0a1220;
    padding: 6px;
}

.todox-ref-image-item img {
    width: 100%;
    height: 88px;
    object-fit: cover;
    border-radius: 8px;
    display: block;
}

.todox-ref-image-item .mud-icon-button {
    position: absolute;
    right: 2px;
    top: 2px;
    background: rgba(5, 8, 13, 0.78);
}

.todox-breadcrumb-muted {
    color: var(--todox-muted);
}

.todox-breadcrumb-separator {
    color: rgba(255, 255, 255, .42);
}

.todox-page-title,
.mud-typography-h4,
.mud-typography-h5,
.mud-typography-h6,
h1,
h2,
h3,
h4 {
    color: #ffffff !important;
    font-weight: 850 !important;
}

.todox-page-subtitle,
.mud-typography-body1,
.mud-typography-body2 {
    color: #c6d0dd !important;
}

.todox-card,
.todox-table-card,
.todox-auth-card,
.mud-card,
.mud-paper {
    background: linear-gradient(145deg, rgba(17, 24, 33, .96), rgba(8, 12, 18, .98)) !important;
    color: var(--todox-text) !important;
    border: 1px solid rgba(255, 183, 0, .20) !important;
    border-radius: 12px !important;
    box-shadow: 0 18px 45px rgba(0, 0, 0, .28) !important;
}

.todox-stat-value {
    color: #ffffff;
    font-size: 2.4rem;
    line-height: 1.1;
    font-weight: 900;
}

.todox-kv-table td {
    padding: 8px 4px;
    border: none !important;
    color: var(--todox-text);
}

.todox-kv-table td:first-child {
    color: var(--todox-muted);
    width: 42%;
}

.todox-setting-key {
    font-family: "Consolas", "Menlo", monospace;
    font-weight: 700;
    color: #ffffff;
}

.todox-setting-desc {
    font-size: 12px;
    color: var(--todox-muted);
    margin-top: 2px;
}

.todox-setting-value {
    font-family: "Consolas", "Menlo", monospace;
    color: #c6d0dd;
    word-break: break-all;
}

.todox-service-card {
    overflow: hidden;
    padding: 0 !important;
    display: flex;
    flex-direction: column;
    height: 100%;
    min-height: 100%;
}

.todox-service-grid {
    align-items: stretch;
}

.todox-service-media {
    position: relative;
    width: 100%;
    aspect-ratio: 9 / 16;
    max-height: 520px;
    display: flex;
    align-items: center;
    justify-content: center;
    background:
        radial-gradient(circle at center, rgba(255, 183, 0, .09), transparent 58%),
        linear-gradient(135deg, rgba(7, 13, 21, .98), rgba(2, 7, 13, .98));
    border-bottom: 1px solid rgba(255, 183, 0, .18);
    overflow: hidden;
}

.todox-service-favorite {
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 2;
}

.todox-service-favorite-btn {
    background: rgba(5, 8, 13, .7);
    backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 183, 0, .22);
}

.todox-service-media img {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: contain;
    object-position: center;
    background: #050b12;
}

.todox-service-media-empty {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: radial-gradient(circle at top, rgba(255, 183, 0, .16), rgba(8, 12, 18, .96));
}

.todox-service-status {
    position: absolute !important;
    top: 10px;
    right: 10px;
}

.todox-service-body {
    padding: 16px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    flex: 1 1 auto;
}

.todox-service-title {
    line-height: 1.2 !important;
    min-height: 2.4em;
}

.todox-service-desc {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    min-height: 40px;
}

.todox-service-price {
    color: var(--todox-gold);
    font-size: 1.35rem;
    font-weight: 900;
}

.todox-service-price-unit {
    color: var(--todox-muted);
    font-size: .8rem;
    margin-left: 4px;
}

.todox-service-actions {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    flex: 0 0 auto;
}

.todox-favorite-service-grid {
    align-items: stretch;
}

.todox-favorite-service-item {
    border: 1px solid rgba(255, 183, 0, .12);
    background: rgba(255, 255, 255, .02);
}

.todox-favorite-service-thumb {
    width: 48px;
    height: 64px;
    flex: 0 0 auto;
    border-radius: 6px;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 183, 0, .06);
    border: 1px solid rgba(255, 183, 0, .14);
}

.todox-favorite-service-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.todox-reference-video-main {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 260px;
}

.todox-reference-video-main img {
    width: 72px;
    height: 96px;
    object-fit: cover;
    border-radius: 8px;
    border: 1px solid rgba(255, 183, 0, .22);
    flex: 0 0 auto;
}

.todox-reference-video-title {
    color: #ffffff;
    font-weight: 800;
    max-width: 420px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.todox-reference-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    max-width: 240px;
}

.todox-reference-tags span {
    border: 1px solid rgba(255, 183, 0, .22);
    border-radius: 999px;
    color: var(--todox-gold);
    background: rgba(255, 183, 0, .08);
    padding: 2px 8px;
    font-size: 12px;
    font-weight: 700;
}

.todox-reference-thumb-button {
    position: relative;
    width: 72px;
    height: 96px;
    border: 1px solid rgba(255, 183, 0, 0.35);
    border-radius: 10px;
    overflow: hidden;
    padding: 0;
    background: #090f18;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
}

.todox-reference-thumb-button img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    border: 0;
    border-radius: 0;
    transition: transform 0.16s ease, filter 0.16s ease;
}

.todox-reference-thumb-button:hover img {
    transform: scale(1.04);
    filter: brightness(0.82);
}

.todox-reference-thumb-play {
    position: absolute;
    left: 6px;
    bottom: 6px;
    width: 28px;
    height: 28px;
    border-radius: 999px;
    background: rgba(255, 183, 0, 0.92);
    color: #111827;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 8px 22px rgba(0, 0, 0, 0.38);
}

.todox-video-preview-dialog .mud-dialog-content {
    padding-top: 8px;
}

.todox-video-preview-frame {
    width: 100%;
    min-height: 520px;
    border-radius: 18px;
    overflow: hidden;
    border: 1px solid rgba(255, 183, 0, 0.25);
    background: #05080d;
    display: flex;
    align-items: center;
    justify-content: center;
}

.todox-video-preview-frame iframe {
    width: 100%;
    height: 620px;
    border: 0;
    background: #05080d;
}

.todox-video-preview-fallback {
    width: 100%;
    min-height: 520px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 16px;
    padding: 24px;
}

.todox-video-preview-fallback img {
    max-width: 280px;
    max-height: 480px;
    object-fit: cover;
    border-radius: 18px;
    border: 1px solid rgba(255, 183, 0, 0.3);
}

@media (max-width: 768px) {
    .todox-video-preview-frame,
    .todox-video-preview-fallback {
        min-height: 420px;
    }

    .todox-video-preview-frame iframe {
        height: 480px;
    }
}

.todox-perm-table {
    background: transparent !important;
}

.todox-perm-table th {
    color: var(--todox-gold) !important;
    font-weight: 700;
    white-space: nowrap;
    padding: 10px 8px !important;
    position: sticky;
    top: 0;
    background: rgba(5, 8, 13, .9);
}

.todox-perm-table td {
    color: var(--todox-text) !important;
    padding: 4px 8px !important;
    border-bottom: 1px solid rgba(255, 255, 255, .05) !important;
}

.todox-perm-na {
    color: rgba(255, 255, 255, .2);
}

.todox-gold {
    color: var(--todox-gold) !important;
}

.todox-badge {
    color: var(--todox-gold);
    background: rgba(255, 183, 0, .12);
    border: 1px solid rgba(255, 183, 0, .22);
    padding: 4px 10px;
    border-radius: 999px;
    font-size: .8rem;
}

.mud-card .mud-icon-root,
.mud-paper .mud-icon-root {
    color: var(--todox-gold) !important;
}

.mud-table,
.mud-table-container {
    background: transparent !important;
    color: var(--todox-text) !important;
}

.mud-table-head {
    background: rgba(5, 8, 13, .45) !important;
}

.mud-table-row {
    border-bottom: 1px solid rgba(255, 255, 255, .06) !important;
}

.todox-primary-btn,
.mud-button-filled-primary {
    background: linear-gradient(135deg, var(--todox-gold), var(--todox-gold-2)) !important;
    color: #111111 !important;
    font-weight: 850 !important;
}

.todox-auth-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background:
        radial-gradient(circle at 20% 20%, rgba(255, 183, 0, .18), transparent 30%),
        radial-gradient(circle at 80% 20%, rgba(255, 183, 0, .11), transparent 26%),
        #050608;
}

.todox-auth-grid {
    width: min(520px, 100%);
    display: grid;
    grid-template-columns: 1fr;
    gap: 0;
    align-items: stretch;
}

.todox-auth-hero {
    background: linear-gradient(180deg, rgba(255, 183, 0, .12), rgba(255, 183, 0, .02)), #0b0e14;
    border: 1px solid rgba(255, 183, 0, .18);
    border-radius: 18px;
    padding: 32px;
    overflow: hidden;
}

.todox-auth-hero img {
    width: 220px;
    max-width: 80%;
}

.todox-auth-card {
    width: 100%;
    border-radius: 18px !important;
    padding: 8px;
}

@media (max-width: 960px) {
    .todox-content {
        padding: 92px 18px 18px 18px !important;
    }

    .todox-logo-text {
        font-size: 28px;
    }

    .todox-sidebar-logo {
        height: 74px;
        padding: 0 22px;
    }

    .todox-stat-value {
        font-size: 2rem;
    }
}

/* Avatar Studio repair styles. Keep these in the theme layer so uploaded
   avatar/logo/product previews are never hidden by broad layout rules. */
.avatar-reference-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 10px;
    border: 1px solid rgba(255, 183, 0, 0.22);
    border-radius: 8px;
    background: rgba(8, 16, 24, 0.54);
    min-width: 0;
    width: 100%;
}

.avatar-reference-main {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
    flex: 1 1 auto;
}

.avatar-reference-copy {
    min-width: 0;
    overflow: hidden;
}

.avatar-reference-copy .mud-typography {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 100%;
}

.avatar-reference-copy .todox-page-subtitle {
    display: none;
}

.avatar-reference-actions {
    display: inline-flex;
    align-items: center;
    justify-content: flex-end;
    gap: 4px;
    flex: 0 0 auto;
}

.avatar-reference-thumb {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 52px;
    height: 52px;
    flex: 0 0 52px;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.16);
    border-radius: 8px;
    background: #121b25;
}

.avatar-reference-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block !important;
}

.logo-preview-bg {
    background-color: #e9eef3;
    background-image:
        linear-gradient(45deg, #c9d1d9 25%, transparent 25%),
        linear-gradient(-45deg, #c9d1d9 25%, transparent 25%),
        linear-gradient(45deg, transparent 75%, #c9d1d9 75%),
        linear-gradient(-45deg, transparent 75%, #c9d1d9 75%);
    background-size: 16px 16px;
    background-position: 0 0, 0 8px, 8px -8px, -8px 0;
}

.avatar-result-zone {
    position: relative;
    min-height: 240px;
    width: 100%;
}

.avatar-stage-frame {
    max-width: 520px;
}

.avatar-render-placeholder {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 220px;
    overflow: hidden;
    border: 1px dashed rgba(255, 183, 0, 0.22);
    border-radius: 8px;
    background: rgba(5, 12, 20, 0.42);
}

.avatar-render-card {
    position: relative;
    overflow: hidden;
    height: 100%;
    min-height: 240px;
    width: 100%;
}

.avatar-render-card.is-rendering {
    outline: 1px solid rgba(255, 183, 0, 0.65);
}

.avatar-render-image-shell {
    position: relative;
    overflow: hidden;
    border-radius: 8px;
    aspect-ratio: 1 / 1;
    width: 100%;
    max-width: 100%;
    background: rgba(5, 12, 20, 0.55);
}

.avatar-render-image-shell img,
.avatar-render-image-shell .mud-image-root,
.avatar-render-image {
    width: 100% !important;
    height: 100% !important;
    max-width: 100% !important;
    max-height: 100% !important;
    object-fit: cover;
    display: block !important;
    border-radius: 8px;
}

.avatar-render-image.is-clickable {
    cursor: zoom-in;
}

.avatar-render-card .mud-button-label,
.avatar-render-card .mud-typography {
    white-space: normal;
}

.avatar-render-card .mud-button {
    min-height: 40px;
}

.image-editor-dialog .mud-dialog {
    width: 100vw !important;
    height: 100vh !important;
    max-width: 100vw !important;
    max-height: 100vh !important;
    margin: 0 !important;
    border-radius: 0 !important;
}

.image-editor-title {
    width: 100%;
}

.image-editor-shell {
    display: grid;
    grid-template-rows: auto minmax(0, 1fr) auto;
    gap: 12px;
    height: calc(100vh - 96px);
    min-height: 0;
}

.avatar-template-upload {
    display: grid;
    grid-template-columns: 58px minmax(0, 1fr) auto;
    align-items: center;
    gap: 10px;
    min-height: 74px;
    padding: 10px;
    border: 1px solid rgba(255, 183, 0, 0.22);
    border-radius: 8px;
    background: rgba(8, 16, 24, 0.54);
}

.avatar-template-thumb,
.avatar-template-list-thumb {
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: 8px;
    background: #101923;
}

.avatar-template-thumb {
    width: 58px;
    height: 58px;
}

.avatar-template-thumb img,
.avatar-template-list-thumb img,
.avatar-template-card-media img,
.avatar-builder-result img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
}

.avatar-template-upload-copy {
    min-width: 0;
}

.avatar-template-upload-copy .mud-typography {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.avatar-template-upload-actions {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.avatar-template-list-item {
    display: grid;
    grid-template-columns: 58px minmax(0, 1fr);
    align-items: center;
    gap: 10px;
    padding: 10px;
    border: 1px solid rgba(255, 183, 0, 0.18);
    border-radius: 8px;
    cursor: pointer;
    background: rgba(8, 16, 24, 0.44);
}

.avatar-template-list-item.is-selected,
.avatar-template-card.is-selected {
    border-color: rgba(255, 183, 0, 0.78);
    box-shadow: 0 0 0 1px rgba(255, 183, 0, 0.22);
}

.avatar-template-list-thumb {
    width: 58px;
    height: 58px;
}

.avatar-template-list-copy {
    min-width: 0;
}

.avatar-template-list-copy .mud-typography {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.avatar-template-card {
    height: 100%;
    overflow: hidden;
}

.avatar-template-card-media {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    aspect-ratio: 1 / 1;
    overflow: hidden;
    background: rgba(5, 12, 20, 0.62);
}

.avatar-template-card-body {
    padding: 14px;
}

.avatar-template-desc {
    min-height: 42px;
}

.avatar-builder-result {
    width: 100%;
    max-width: 520px;
    aspect-ratio: 1 / 1;
    overflow: hidden;
    border: 1px solid rgba(255, 183, 0, 0.22);
    border-radius: 8px;
    background: rgba(5, 12, 20, 0.62);
}

.avatar-builder-result-link {
    display: block;
    width: 100%;
    max-width: 520px;
}

.avatar-builder-result.is-flashing {
    animation: avatar-preview-flash 0.18s ease-in-out 2;
    border-color: rgba(255, 196, 61, 0.72);
    box-shadow: 0 0 0 1px rgba(255, 196, 61, 0.22), 0 0 24px rgba(255, 196, 61, 0.3);
}

.avatar-builder-empty {
    display: flex;
    min-height: 280px;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    border: 1px dashed rgba(255, 183, 0, 0.22);
    border-radius: 8px;
    background: rgba(5, 12, 20, 0.42);
}

.avatar-builder-log {
    max-height: 320px;
    overflow: auto;
    margin: 0;
    padding: 12px;
    border: 1px solid rgba(255, 183, 0, 0.18);
    border-radius: 8px;
    background: rgba(5, 12, 20, 0.7);
    color: #e7eef7;
    white-space: pre-wrap;
}

@keyframes avatar-preview-flash {
    0% { opacity: 0.65; transform: scale(0.99); }
    50% { opacity: 1; transform: scale(1.01); }
    100% { opacity: 0.75; transform: scale(1); }
}

.avatar-public-hidden-input,
.avatar-public-upload-button input[type="file"],
.avatar-advanced-button input[type="file"] {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    overflow: hidden !important;
    opacity: 0 !important;
    pointer-events: none !important;
    clip: rect(0 0 0 0) !important;
    clip-path: inset(50%) !important;
}

.image-editor-toolbar {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
    padding: 8px;
    border: 1px solid rgba(255, 183, 0, 0.18);
    border-radius: 8px;
    background: rgba(8, 16, 24, 0.74);
}

.image-editor-stage {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 0;
    overflow: auto;
    border: 1px solid rgba(255, 183, 0, 0.18);
    border-radius: 8px;
    background: #050b12;
}

.image-editor-img {
    max-width: 92%;
    max-height: 92%;
    object-fit: contain;
    transform-origin: center center;
    transition: transform 120ms ease;
}

.image-editor-img.is-cropping {
    filter: brightness(0.84);
}

.image-editor-crop-box {
    position: absolute;
    width: min(62vh, 62vw);
    aspect-ratio: 1 / 1;
    pointer-events: none;
    border: 2px solid #ffb700;
    box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.42);
}

.image-editor-meta {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    color: rgba(236, 244, 255, 0.78);
    font-size: 13px;
}

.avatar-card-overlay {
    position: absolute;
    inset: 0;
    z-index: 3;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    background: rgba(8, 14, 22, 0.62);
    backdrop-filter: blur(1px);
    pointer-events: none;
}

.avatar-card-overlay::before {
    content: "";
    position: absolute;
    inset: -45%;
    background: linear-gradient(110deg, transparent 20%, rgba(255, 193, 7, 0.22) 45%, rgba(255, 255, 255, 0.34) 50%, rgba(255, 193, 7, 0.22) 55%, transparent 80%);
    animation: todox-render-flash 1.15s linear infinite;
}

.avatar-card-overlay::after {
    content: attr(data-status);
    position: relative;
    z-index: 2;
    padding: 7px 12px;
    border-radius: 999px;
    background: rgba(0, 0, 0, 0.44);
    color: #ffd56a;
    font-size: 13px;
    font-weight: 700;
}

.avatar-card-overlay:not([data-status])::after {
    content: "Dang xu ly...";
}

.avatar-card-overlay .mud-progress-circular,
.avatar-card-overlay .mud-typography {
    display: none !important;
}

@keyframes todox-render-flash {
    from { transform: translateX(-45%) rotate(8deg); }
    to { transform: translateX(45%) rotate(8deg); }
}

.activity-summary {
    display: inline-block;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    vertical-align: bottom;
}

.activity-detail-message,
.activity-detail-message .mud-typography,
.activity-detail-reason {
    white-space: normal !important;
    overflow: visible !important;
    text-overflow: clip !important;
    word-break: break-word;
    overflow-wrap: anywhere;
    line-height: 1.55;
}

.activity-json-pre {
    max-height: 62vh;
    overflow: auto;
    white-space: pre-wrap;
    word-break: break-word;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 8px;
    padding: 12px;
    background: rgba(0, 0, 0, 0.22);
}

.avatar-upload-btn {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    overflow: hidden;
    cursor: pointer;
    border: 1px solid rgba(255, 183, 0, 0.42);
    border-radius: 8px;
    color: #ffb700;
    background: rgba(255, 183, 0, 0.08);
}

.avatar-upload-btn:hover {
    border-color: rgba(255, 211, 106, 0.74);
    background: rgba(255, 183, 0, 0.14);
}

.avatar-hidden-file-input,
.avatar-upload-btn input[type="file"] {
    position: absolute !important;
    inset: 0 !important;
    width: 100% !important;
    height: 100% !important;
    opacity: 0 !important;
    cursor: pointer !important;
    font-size: 0 !important;
    color: transparent !important;
}

@media (max-width: 600px) {
    .todox-content {
        padding: 84px 14px 14px 14px !important;
    }

    .todox-logo-text {
        font-size: 24px;
    }

    .todox-breadcrumb {
        width: 100%;
        overflow-x: auto;
    }
}

/* TodoX Permission Matrix - sticky header, sticky first column, visible horizontal scroll */
.todox-perm-scroll {
    width: 100%;
    max-width: 100%;
    max-height: calc(100vh - 300px);
    min-height: 360px;
    overflow: auto;
    position: relative;
    border-radius: 8px;
    scrollbar-gutter: stable both-edges;
}

.todox-perm-table {
    border-collapse: separate;
    border-spacing: 0;
    min-width: 1320px;
    width: max-content;
    color: #ffffff;
}

.todox-perm-table th,
.todox-perm-table td {
    min-width: 86px;
    height: 56px;
    padding: 10px 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    background: #0b1118;
    text-align: center;
    white-space: nowrap;
}

.todox-perm-table thead th,
.todox-perm-sticky-head {
    top: 0;
    position: sticky;
    z-index: 6;
    background: #05080d !important;
    color: #ffb700;
    font-weight: 700;
    box-shadow: 0 1px 0 rgba(255, 183, 0, 0.22);
}

.todox-perm-sticky-col {
    position: sticky;
    left: 0;
    z-index: 5;
    min-width: 220px !important;
    max-width: 280px;
    text-align: left !important;
    background: #0b1118 !important;
    box-shadow: 1px 0 0 rgba(255, 255, 255, 0.08);
}

.todox-perm-sticky-head.todox-perm-sticky-col {
    z-index: 8;
    background: #05080d !important;
}

.todox-perm-module-cell {
    color: #ffffff;
    font-weight: 700;
}

.todox-perm-module-check,
.todox-perm-action-check {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.todox-perm-module-check {
    justify-content: flex-start;
}

.todox-perm-action-check {
    justify-content: center;
    flex-direction: column;
    gap: 2px;
}

.todox-perm-action-check span {
    font-size: 0.85rem;
    line-height: 1.15;
}

.todox-perm-na {
    color: rgba(255, 255, 255, 0.35);
}

.todox-perm-scroll::-webkit-scrollbar {
    height: 14px;
    width: 14px;
}

.todox-perm-scroll::-webkit-scrollbar-track {
    background: #070b10;
    border-radius: 999px;
}

.todox-perm-scroll::-webkit-scrollbar-thumb {
    background: #ffb700;
    border-radius: 999px;
    border: 3px solid #070b10;
}

.todox-perm-scroll::-webkit-scrollbar-thumb:hover {
    background: #ffd45a;
}

@media (max-width: 900px) {
    .todox-perm-scroll {
        max-height: calc(100vh - 240px);
    }

    .todox-perm-sticky-col {
        min-width: 180px !important;
    }
}

.character-thumb-wrap {
    width: 100%;
    max-width: 320px;
    min-height: 320px;
    max-height: 420px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.04);
}

.character-thumb {
    width: 100%;
    height: 100%;
    max-height: 420px;
    object-fit: contain;
    cursor: zoom-in;
}

.scene-thumb-cell {
    width: 160px;
    min-height: 240px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.04);
}

.scene-thumb {
    width: 100%;
    height: 100%;
    object-fit: contain;
    cursor: zoom-in;
}

.scene-thumb-placeholder {
    padding: 16px;
    text-align: center;
    color: var(--mud-palette-text-secondary);
}

.ai-character-detail-grid {
    display: grid;
    grid-template-columns: minmax(320px, 3fr) minmax(0, 7fr);
    gap: 16px;
    align-items: start;
}

.ai-character-master-image {
    width: 100%;
    min-height: 320px;
    max-height: 420px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    border: 1px solid rgba(255, 183, 0, .18);
    border-radius: 16px;
    background: rgba(255, 255, 255, .03);
}

.ai-character-master-image img {
    width: 100%;
    height: 100%;
    max-height: 420px;
    object-fit: contain;
    cursor: zoom-in;
}

.ai-character-render-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 16px;
}

.ai-character-render-card {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.ai-character-render-image {
    min-height: 240px;
    max-height: 320px;
    overflow: hidden;
    border-radius: 14px;
    border: 1px solid rgba(255, 183, 0, .18);
    background: rgba(255, 255, 255, .03);
}

.ai-character-render-image img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    cursor: zoom-in;
}

.ai-character-section-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.ai-character-form-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

@media (max-width: 960px) {
    .ai-character-detail-grid {
        grid-template-columns: 1fr;
    }
}
