:root {
    --app-sidebar-w: 248px;
    --sb-bg: #ffffff;
    --sb-border: #e3e3e8;
    --sb-text: #171719;
    --sb-muted: #171719;
    --sb-hover: rgba(0, 0, 0, 0.06);
    --sb-active: rgba(0, 0, 0, 0.09);
    /* Monochrome accent system */
    --accent: #171719;
    --accent-rgb: 23, 23, 25;
    --accent-soft: rgba(0, 0, 0, 0.06);
    --accent-border: rgba(0, 0, 0, 0.18);
    --on-accent: #ffffff;
    --primary-bg: #171719;
    --primary-fg: #ffffff;
    /* Global standard button height. No button should exceed this. */
    --btn-h: 36px;
}

html[data-theme='dark'] {
    --sb-bg: #0f0f0f;
    --sb-border: rgba(255, 255, 255, 0.1);
    --sb-text: #ffffff;
    --sb-muted: rgba(255, 255, 255, 0.65);
    --sb-hover: rgba(255, 255, 255, 0.06);
    --sb-active: rgba(255, 255, 255, 0.1);
    --accent: #ffffff;
    --accent-rgb: 255, 255, 255;
    --accent-soft: rgba(255, 255, 255, 0.08);
    --accent-border: rgba(255, 255, 255, 0.22);
    --on-accent: #0f0f0f;
    --primary-bg: #ffffff;
    --primary-fg: #0f0f0f;
}

html[data-sidebar='collapsed'] {
    --app-sidebar-w: 72px;
}

.material-symbols-outlined {
    display: inline-block;
    font-size: 18px;
    font-variation-settings: 'FILL' 0, 'wght' 450, 'GRAD' 0, 'opsz' 20;
    line-height: 1;
    vertical-align: middle;
}

.google-icon {
    width: 18px;
    height: 18px;
    flex: 0 0 auto;
}

::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #dedee5; border-radius: 999px; }
::-webkit-scrollbar-thumb:hover { background: #aaaabc; }

html[data-theme='dark'] {
    color-scheme: dark;
    background: #0f0f0f !important;
}

html[data-theme='dark'] body,
html[data-theme='dark'] body[data-theme-root] {
    background: transparent !important;
    color: #f4f4f6;
}

@media (prefers-reduced-motion: no-preference) {
    html.theme-ready body,
    html.theme-ready .app-sidebar,
    html.theme-ready .app-topbar,
    html.theme-ready .app-main,
    html.theme-ready .panel,
    html.theme-ready .stat-card,
    html.theme-ready .auth-card,
    html.theme-ready .dropdown-panel,
    html.theme-ready .sample-card,
    html.theme-ready .sample-history-card,
    html.theme-ready .voice-picker,
    html.theme-ready .voice-tab,
    html.theme-ready .selected-voice-card,
    html.theme-ready .voice-row,
    html.theme-ready .voice-row-select,
    html.theme-ready .voice-card,
    html.theme-ready .voice-filter-bar,
    html.theme-ready .voice-capture-card,
    html.theme-ready .voice-preview-button,
    html.theme-ready .role-card,
    html.theme-ready .speech-upload-panel,
    html.theme-ready .speech-result-panel,
    html.theme-ready .speech-recorder-card,
    html.theme-ready .speech-file-pill,
    html.theme-ready .speech-metric-card,
    html.theme-ready .speech-recent-item,
    html.theme-ready .form-control,
    html.theme-ready .studio-textarea,
    html.theme-ready .upload-dropzone,
    html.theme-ready .message,
    html.theme-ready .nav-link,
    html.theme-ready .topbar-button,
    html.theme-ready .secondary-button,
    html.theme-ready .danger-button,
    html.theme-ready .prompt-chip,
    html.theme-ready .tool-pill,
    html.theme-ready .icon-button,
    html.theme-ready .theme-toggle,
    html.theme-ready .profile-trigger,
    html.theme-ready .password-toggle,
    html.theme-ready .dashboard-stat-card,
    html.theme-ready .dashboard-flow-step,
    html.theme-ready .dashboard-sample-card,
    html.theme-ready .dashboard-voice-card,
    html.theme-ready .dashboard-empty-card,
    html.theme-ready .bg-white,
    html.theme-ready .bg-surface,
    html.theme-ready .text-ink,
    html.theme-ready .text-muted,
    html.theme-ready .border-line {
        transition: background-color 260ms ease, border-color 260ms ease, color 260ms ease, box-shadow 260ms ease, opacity 220ms ease, transform 180ms ease;
    }

    html.theme-ready [data-theme-icon] {
        transition: transform 260ms ease;
    }

    html[data-theme='dark'].theme-ready [data-theme-icon] {
        transform: rotate(180deg);
    }
}

.app-sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 50;
    display: flex;
    width: var(--app-sidebar-w);
    flex-direction: column;
    border-right: 1px solid var(--sb-border);
    background: var(--sb-bg);
    padding: 12px 0 10px;
    color: var(--sb-text);
    overflow: hidden;
    transition: width 220ms cubic-bezier(0.22, 1, 0.36, 1);
}

/* --- sidebar head (logo + collapse) --- */
.sb-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 6px 14px 14px;
}

.sb-brand {
    display: flex;
    min-width: 0;
    align-items: center;
    height: 38px;
}

.sb-brand img {
    display: block;
    width: auto;
    object-fit: contain;
}

.sb-brand-full { height: 36px; max-width: 180px; }

.sb-collapse {
    display: inline-flex;
    height: 30px;
    width: 30px;
    flex: 0 0 auto;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    border: 0;
    background: transparent;
    color: var(--sb-muted);
    cursor: pointer;
    transition: background-color 160ms ease, color 160ms ease;
}

.sb-collapse:hover {
    background: var(--sb-hover);
    color: var(--sb-text);
}

.sb-collapse .material-symbols-outlined { font-size: 20px; }
.sb-collapse svg { width: 20px; height: 20px; }

/* --- sidebar nav --- */
.sb-nav {
    flex: 1;
    min-height: 0;
    overflow-x: hidden;
    overflow-y: auto;
    padding: 0 10px 10px;
    scrollbar-width: thin;
}

.sb-nav::-webkit-scrollbar { width: 5px; }
.sb-nav::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.12); border-radius: 999px; }

.sb-section {
    margin: 14px 0 4px;
    padding: 0 12px;
    font-size: 11.5px;
    font-weight: 600;
    letter-spacing: 0.02em;
    color: var(--sb-muted);
}

.sb-item {
    position: relative;
    display: flex;
    width: 100%;
    align-items: center;
    gap: 10px;
    border-radius: 10px;
    padding: 5.5px 12px;
    color: var(--sb-text);
    font-size: 13px;
    font-weight: 500;
    line-height: 1.2;
    white-space: nowrap;
    transition: background-color 160ms ease, color 160ms ease;
}

.sb-item + .sb-item { margin-top: 1px; }

.sb-item .material-symbols-outlined {
    flex: 0 0 auto;
    font-size: 18px;
    color: var(--sb-muted);
    transition: color 160ms ease;
}

.sb-item > svg {
    flex: 0 0 auto;
    width: 18px;
    height: 18px;
    color: var(--sb-muted);
    transition: color 160ms ease;
}

.sb-item:hover {
    background: var(--sb-hover);
    color: var(--sb-text);
}

.sb-item:hover .material-symbols-outlined { color: var(--sb-text); }

.sb-item.is-active {
    background: var(--sb-active);
    color: var(--sb-text);
}

.sb-item.is-active .material-symbols-outlined { color: var(--sb-text); }

.sb-item:active { transform: scale(0.99); }

.sb-item-button {
    border: 0;
    background: transparent;
    cursor: pointer;
    font-family: inherit;
    text-align: left;
}

.sb-label {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sb-badge {
    margin-left: auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    background: var(--accent);
    padding: 2.5px 7px;
    font-size: 9.5px;
    font-weight: 800;
    line-height: 1;
    letter-spacing: 0.06em;
    text-indent: 0.06em; /* compensate trailing letter-spacing gap */
    color: var(--on-accent);
}

.sb-item-locked {
    cursor: not-allowed;
    opacity: 0.55;
    pointer-events: none;
    user-select: none;
}

.sb-item-locked .sb-label { flex: 1 1 auto; }

.sb-lock {
    margin-left: auto;
    flex-shrink: 0;
    font-size: 16px;
    color: var(--sb-muted);
}

html[data-sidebar='collapsed'] .sb-lock { display: none; }

.sb-foot {
    border-top: 1px solid var(--sb-border);
    padding: 10px 10px 0;
}

/* --- sidebar credits card --- */
.sb-credits-card {
    margin: 0 10px 12px;
    padding: 14px;
    border-radius: 14px;
    border: 1px solid rgba(59, 130, 246, 0.25);
    background:
        radial-gradient(120% 140% at 100% 0%, rgba(59, 130, 246, 0.18), transparent 55%),
        linear-gradient(180deg, rgba(var(--accent-rgb), 0.05), rgba(var(--accent-rgb), 0.02));
}
.sb-credits-title { font-size: 13.5px; font-weight: 800; color: var(--sb-text); }
.sb-credits-sub { margin-top: 4px; font-size: 11.5px; line-height: 1.45; color: var(--sb-muted); }
.sb-credits-meter { margin-top: 12px; }
.sb-credits-meter-text { font-size: 11.5px; font-weight: 700; color: var(--sb-muted); margin-bottom: 6px; }
.sb-credits-bar {
    height: 10px;
    border-radius: 999px;
    background: rgba(var(--accent-rgb), 0.08);
    border: 1px solid var(--sb-border);
    overflow: hidden;
}
.sb-credits-fill {
    height: 100%;
    border-radius: 999px;
    background: var(--accent);
    transition: width 300ms ease;
}
html[data-sidebar='collapsed'] .sb-credits-card { display: none; }
.sb-foot-icons {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 4px;
}
.sb-foot-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    border-radius: 10px;
    color: var(--sb-muted);
    transition: background-color 140ms ease, color 140ms ease;
}
.sb-foot-icon:hover { background: var(--sb-hover); color: var(--sb-text); }
.sb-foot-icon .material-symbols-outlined { font-size: 20px; }

/* --- collapsed rail --- */
html[data-sidebar='collapsed'] .sb-head {
    flex-direction: column;
    justify-content: center;
    gap: 6px;
    padding: 6px 0 12px;
}

html[data-sidebar='collapsed'] .sb-label,
html[data-sidebar='collapsed'] .sb-badge {
    display: none;
}

html[data-sidebar='collapsed'] .sb-brand { display: none; }

html[data-sidebar='collapsed'] .sb-nav,
html[data-sidebar='collapsed'] .sb-foot {
    padding-left: 8px;
    padding-right: 8px;
}

html[data-sidebar='collapsed'] .sb-foot-icons {
    flex-direction: column;
    gap: 4px;
}

html[data-sidebar='collapsed'] .sb-item {
    justify-content: center;
    gap: 0;
    padding: 8px 0;
}

html[data-sidebar='collapsed'] .sb-section {
    margin: 14px 0 6px;
    padding: 0;
    height: 1px;
    overflow: hidden;
    color: transparent;
    background: var(--sb-border);
}

html[data-sidebar='collapsed'] .sb-item::after {
    content: attr(data-sb-tip);
    position: absolute;
    left: calc(100% + 10px);
    top: 50%;
    transform: translateY(-50%) scale(0.96);
    transform-origin: left center;
    z-index: 60;
    border: 1px solid var(--sb-border);
    border-radius: 8px;
    background: var(--sb-bg);
    padding: 5px 9px;
    font-size: 12px;
    font-weight: 600;
    color: var(--sb-text);
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 140ms ease, transform 140ms ease;
}

html[data-sidebar='collapsed'] .sb-item:hover::after {
    opacity: 1;
    transform: translateY(-50%) scale(1);
}

/* ---- themed tooltips (whole app) ----
   Native title attributes are converted to data-tip by app.js, which also
   renders a single floating .usa-tip element on <body> (positioned in JS so
   it can never be clipped by an ancestor's overflow). */
.usa-tip {
    position: fixed;
    top: 0;
    left: 0;
    max-width: 240px;
    padding: 6px 10px;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    background: #0b0b0e;
    color: rgba(255, 255, 255, 0.92);
    font-size: 11.5px;
    font-weight: 600;
    line-height: 1.35;
    letter-spacing: 0.01em;
    /* Wrap long tips instead of running off in one line. Do NOT add
       text-wrap: balance here — the box is already shrink-to-fit at
       max-width, so balancing only shortens every line and leaves a gap
       down the right-hand side. */
    white-space: normal;
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.45);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    z-index: 2000;
    transform: translateY(2px);
    transition: opacity 140ms ease, transform 140ms ease;
}
.usa-tip.is-shown {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

/* landing.css draws its own ::after tooltip for .lx-pop-row-label[data-tip].
   Dashboard pages load BOTH stylesheets plus app.js, so the same label showed
   two tooltips at once. app.css is dashboard-only (landing.html doesn't load
   it), so suppressing it here leaves the landing page untouched — and the
   floating .usa-tip is the better one anyway: it's on <body>, so the popover's
   own bounds can never clip it. */
.lx-pop-row-label[data-tip]::after { content: none !important; }

.app-topbar {
    position: fixed;
    left: var(--app-sidebar-w);
    right: 0;
    top: 0;
    z-index: 90;
    display: flex;
    height: 56px;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    border-bottom: 0;
    background: transparent;
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
    color: #171719;
    padding: 0 20px;
    isolation: isolate;
    transition: left 220ms cubic-bezier(0.22, 1, 0.36, 1);
}

html[data-theme='dark'] .app-topbar { color: #fff; }

/* --- Global image skeleton (shimmer until the img loads) --- */
.usa-skel { position: relative; }
.usa-skel::before {
    content: "";
    position: absolute;
    inset: 0;
    z-index: 1;
    border-radius: inherit;
    background: linear-gradient(110deg, rgba(255, 255, 255, 0.05) 25%, rgba(255, 255, 255, 0.12) 42%, rgba(255, 255, 255, 0.05) 60%);
    background-size: 220% 100%;
    animation: usa-skel-shimmer 1.4s linear infinite;
    opacity: 1;
    transition: opacity 320ms ease;
    pointer-events: none;
}
html:not([data-theme='dark']) .usa-skel::before {
    background: linear-gradient(110deg, rgba(0, 0, 0, 0.05) 25%, rgba(0, 0, 0, 0.1) 42%, rgba(0, 0, 0, 0.05) 60%);
    background-size: 220% 100%;
}
.usa-skel > img {
    opacity: 0;
    transition: opacity 360ms ease;
}
.usa-skel.is-loaded::before { opacity: 0; animation-play-state: paused; }
.usa-skel.is-loaded > img { opacity: 1; }
@keyframes usa-skel-shimmer {
    from { background-position: 130% 0; }
    to { background-position: -90% 0; }
}

.app-topbar.is-scrolled {
    background: rgba(255, 255, 255, 0.35);
    -webkit-backdrop-filter: blur(14px);
    backdrop-filter: blur(14px);
}
html[data-theme='dark'] .app-topbar.is-scrolled {
    background: rgba(10, 10, 16, 0.35);
}

.tb-page { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.tb-page-title {
    margin: 0;
    font-size: 15px;
    font-weight: 800;
    letter-spacing: -0.01em;
    line-height: 1.2;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.tb-page-sub {
    margin: 0;
    font-size: 11.5px;
    font-weight: 500;
    line-height: 1.2;
    color: rgba(0, 0, 0, 0.5);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
html[data-theme='dark'] .tb-page-sub { color: rgba(255, 255, 255, 0.55); }

.app-topbar > .flex.items-center.gap-2 { gap: 14px; }

.app-topbar .tb-icon {
    border-color: transparent;
    background: transparent;
    color: inherit;
}

.app-topbar .tb-icon:hover {
    background: rgba(0, 0, 0, 0.06);
}

html[data-theme='dark'] .app-topbar .tb-icon:hover {
    background: var(--sb-hover);
}

.app-topbar .mobile-nav-button {
    border-color: transparent;
    background: transparent;
    color: inherit;
}

.tb-upgrade {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: 32px;
    border-radius: 999px;
    border: 0;
    background: var(--accent);
    padding: 0 14px;
    font-size: 12.5px;
    font-weight: 700;
    color: var(--on-accent);
    transition: filter 160ms ease, transform 160ms ease;
}

.tb-upgrade:hover { filter: brightness(0.9); }
.tb-upgrade:active { transform: scale(0.98); }

/* ================= Upgrade / pricing modal ================= */
.up-modal-backdrop {
    position: fixed;
    inset: 0;
    z-index: 200;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: rgba(0, 0, 0, 0.5);
    -webkit-backdrop-filter: blur(4px);
    backdrop-filter: blur(4px);
    animation: up-modal-fade 160ms ease;
}
.up-modal-backdrop[hidden] { display: none !important; }
@keyframes up-modal-fade { from { opacity: 0; } to { opacity: 1; } }

.up-modal {
    width: min(960px, 100%);
    max-height: calc(100vh - 40px);
    overflow-y: auto;
    border-radius: 18px;
    border: 1px solid var(--sb-border);
    background: var(--sb-bg);
    color: var(--sb-text);
    box-shadow: 0 40px 120px rgba(0, 0, 0, 0.35);
    padding: 24px;
    animation: up-modal-pop 180ms ease;
}
@keyframes up-modal-pop { from { opacity: 0; transform: translateY(10px) scale(0.98); } to { opacity: 1; transform: none; } }

.up-modal-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 22px;
}
.up-modal-eyebrow {
    font-size: 12px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--sb-muted);
}
.up-modal-title { margin-top: 4px; font-size: 22px; font-weight: 800; letter-spacing: -0.3px; }
.up-modal-sub { margin-top: 6px; font-size: 13.5px; color: var(--sb-muted); }

.up-modal-close {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 36px;
    width: 36px;
    flex: 0 0 auto;
    border-radius: 10px;
    border: 1px solid var(--sb-border);
    background: transparent;
    color: var(--sb-text);
    transition: background-color 160ms ease;
}
.up-modal-close:hover { background: var(--sb-hover); }

.up-plan-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 14px;
}
@media (min-width: 760px) {
    .up-plan-grid { grid-template-columns: repeat(3, 1fr); }
}

.up-plan {
    display: flex;
    flex-direction: column;
    border-radius: 14px;
    border: 1px solid var(--sb-border);
    background: rgba(var(--accent-rgb), 0.02);
    padding: 18px;
}
.up-plan-popular {
    border-color: rgba(var(--accent-rgb), 0.45);
    box-shadow: 0 10px 30px rgba(var(--accent-rgb), 0.08);
}
.up-plan-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.up-plan-name { font-size: 16px; font-weight: 800; }
.up-plan-tag {
    font-size: 10.5px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    padding: 3px 8px;
    border-radius: 999px;
    background: var(--accent);
    color: var(--on-accent);
}
.up-plan-desc { margin-top: 6px; font-size: 12.5px; color: var(--sb-muted); min-height: 34px; }
.up-plan-amount { margin: 12px 0 14px; display: flex; align-items: baseline; gap: 6px; }
.up-plan-amount b { font-size: 30px; font-weight: 800; letter-spacing: -0.5px; }
.up-plan-amount span { font-size: 13px; color: var(--sb-muted); }

.up-plan-features { display: flex; flex-direction: column; gap: 9px; margin-bottom: 18px; flex: 1; }
.up-plan-features li { display: flex; align-items: center; gap: 8px; font-size: 12.5px; }
.up-plan-features li .material-symbols-outlined { font-size: 17px; color: var(--accent); }

.up-plan-btn {
    width: 100%;
    height: 42px;
    border-radius: 10px;
    border: 1px solid var(--sb-border);
    background: transparent;
    color: var(--sb-text);
    font-size: 13px;
    font-weight: 700;
    transition: background-color 160ms ease, filter 160ms ease;
}
.up-plan-btn:hover { background: var(--sb-hover); }
.up-plan-btn-primary {
    border: 0;
    background: var(--accent);
    color: var(--on-accent);
}
.up-plan-btn-primary:hover { filter: brightness(0.9); background: var(--accent); }

.up-modal-note { margin-top: 18px; font-size: 11.5px; color: var(--sb-muted); text-align: center; }

/* ================= Notifications dropdown ================= */
.tb-notif-count {
    position: absolute;
    right: -2px;
    top: -2px;
    display: flex;
    align-items: center;
    justify-content: center;
    height: 16px;
    min-width: 16px;
    padding: 0 4px;
    border-radius: 999px;
    background: var(--accent);
    color: var(--on-accent);
    font-size: 10px;
    font-weight: 900;
    line-height: 1;
}

.notif-panel {
    position: absolute;
    right: 0;
    top: calc(100% + 8px);
    z-index: 120;
    width: min(380px, calc(100vw - 24px));
    overflow: hidden;
    border: 1px solid var(--sb-border);
    border-radius: 16px;
    background: var(--sb-bg);
    color: var(--sb-text);
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.28);
}

.notif-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 16px 16px 10px;
}
.notif-title { font-size: 17px; font-weight: 800; letter-spacing: -0.2px; }
.notif-markread {
    font-size: 12px;
    font-weight: 700;
    color: var(--sb-muted);
    background: transparent;
    border: 0;
    transition: color 160ms ease;
}
.notif-markread:hover { color: var(--sb-text); }

.notif-tabs {
    display: flex;
    gap: 6px;
    margin: 0 16px 14px;
    padding: 4px;
    border-radius: 12px;
    background: rgba(var(--accent-rgb), 0.05);
    border: 1px solid var(--sb-border);
}
.notif-tab {
    flex: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    padding: 6px 12px;
    border-radius: 8px;
    border: 1px solid transparent;
    background: transparent;
    color: var(--sb-muted);
    font-size: 13px;
    font-weight: 700;
    transition: background-color 160ms ease, color 160ms ease, box-shadow 160ms ease;
}
.notif-tab .material-symbols-outlined { font-size: 18px; }
.notif-tab:hover { color: var(--sb-text); }
.notif-tab.is-active {
    background: #ffffff;
    color: #171719;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12);
}

.notif-body {
    max-height: 340px;
    overflow-y: auto;
    padding: 6px 10px 12px;
}
.notif-pane { display: flex; flex-direction: column; gap: 0; }

.notif-item {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 12px 6px;
    border-radius: 0;
    border: 0;
    border-bottom: 1px solid var(--sb-border);
    background: transparent;
}
.notif-pane .notif-item:last-child { border-bottom: 0; }
.notif-pane .notif-item:first-child { padding-top: 2px; }
.notif-item.is-unread { background: transparent; }
.notif-dot { display: none; }
.notif-item-body { min-width: 0; flex: 1; }
.notif-item-title {
    font-size: 13px;
    font-weight: 700;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.notif-item-text {
    margin-top: 1px;
    font-size: 12px;
    color: var(--sb-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.notif-item-time { margin-top: 4px; font-size: 10.5px; font-weight: 700; color: var(--sb-muted); }

.notif-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 56px 16px;
    color: var(--sb-muted);
}
.notif-empty .material-symbols-outlined { font-size: 30px; opacity: 0.6; }
.notif-empty p { font-size: 14px; font-weight: 600; }

.tb-upgrade-badge {
    position: absolute;
    bottom: -7px;
    left: 50%;
    transform: translateX(-50%);
    border-radius: 999px;
    border: 1px solid var(--sb-border);
    background: var(--sb-bg);
    padding: 1px 6px;
    font-size: 9.5px;
    font-weight: 800;
    color: var(--sb-text);
    white-space: nowrap;
}

.tb-avatar {
    display: inline-flex;
    height: 32px;
    width: 32px;
    flex: 0 0 auto;
    align-items: center;
    justify-content: center;
    border: 0;
    border-radius: 999px;
    background: var(--accent);
    font-size: 13px;
    font-weight: 800;
    color: var(--on-accent);
    cursor: pointer;
    transition: filter 160ms ease, transform 160ms ease;
}

.tb-avatar:hover { filter: brightness(1.1); }
.tb-avatar:active { transform: scale(0.96); }

/* --- topbar user menu (avatar dropdown) --- */
.tb-user-menu {
    position: absolute;
    right: 0;
    top: calc(100% + 8px);
    z-index: 110;
    width: 320px;
    padding: 14px;
    border-radius: 18px;
    border: 1px solid var(--sb-border);
    background: var(--sb-bg);
    box-shadow: 0 24px 70px rgba(0, 0, 0, 0.32);
    color: var(--sb-text);
}
.tb-user-menu.hidden { display: none !important; }
.tb-user-head { display: flex; align-items: center; gap: 12px; min-width: 0; }
.tb-user-avatar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
    flex: 0 0 auto;
    border-radius: 999px;
    background: #14b8a6;
    color: #ffffff;
    font-size: 16px;
    font-weight: 900;
}
.tb-user-id { min-width: 0; flex: 1; }
.tb-user-name {
    margin: 0;
    font-size: 15px;
    font-weight: 800;
    color: var(--sb-text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.tb-user-email {
    margin: 2px 0 0;
    font-size: 12.5px;
    font-weight: 500;
    color: var(--sb-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.tb-user-gear {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    flex: 0 0 auto;
    border-radius: 999px;
    border: 1px solid var(--sb-border);
    background: rgba(var(--accent-rgb), 0.04);
    color: var(--sb-text);
    transition: background-color 140ms ease;
}
.tb-user-gear:hover { background: var(--sb-hover); }
.tb-user-gear .material-symbols-outlined { font-size: 19px; }

.tb-user-profile-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    margin-top: 14px;
    height: var(--btn-h);
    border-radius: 10px;
    border: 1px solid var(--sb-border);
    background: rgba(var(--accent-rgb), 0.04);
    color: var(--sb-text);
    font-size: 13.5px;
    font-weight: 700;
    text-decoration: none;
    transition: background-color 140ms ease;
}
.tb-user-profile-btn:hover { background: var(--sb-hover); }
.tb-user-profile-btn .material-symbols-outlined { font-size: 19px; }

.tb-user-credits {
    display: flex;
    align-items: center;
    gap: 7px;
    margin: 16px 2px 12px;
}
.tb-user-credits b { font-size: 16px; font-weight: 800; }
.tb-credits-spark { font-size: 18px; }
.tb-credits-label { font-size: 13px; color: var(--sb-muted); font-weight: 600; }
.tb-credits-info { margin-left: 2px; font-size: 16px; color: var(--sb-muted); }

.tb-user-actions {
    display: flex;
    gap: 10px;
    margin-bottom: 6px;
    padding-bottom: 14px;
    border-bottom: 1px solid var(--sb-border);
}
.tb-user-action {
    flex: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: var(--btn-h);
    border-radius: 10px;
    border: 1px solid var(--sb-border);
    background: rgba(var(--accent-rgb), 0.04);
    color: var(--sb-text);
    font-size: 13px;
    font-weight: 700;
    text-decoration: none;
    cursor: pointer;
    transition: background-color 140ms ease;
}
.tb-user-action:hover { background: var(--sb-hover); }

.tb-user-items {
    display: flex;
    flex-direction: column;
    gap: 2px;
    margin-top: 8px;
}
.tb-user-item {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    padding: 10px 10px;
    border: 0;
    border-radius: 10px;
    background: transparent;
    color: var(--sb-text);
    font-size: 14px;
    font-weight: 600;
    text-align: left;
    text-decoration: none;
    cursor: pointer;
    transition: background 140ms ease, color 140ms ease;
}
.tb-user-item:hover { background: var(--sb-hover); }
.tb-user-item .material-symbols-outlined { font-size: 20px; }
.tb-user-badge {
    margin-left: auto;
    padding: 2px 7px;
    border-radius: 6px;
    background: rgba(139, 92, 246, 0.16);
    color: #a78bfa;
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 0.03em;
}
.tb-user-chevron { color: var(--sb-muted); }
.tb-user-badge + .tb-user-chevron { margin-left: 8px; }
.tb-user-item-danger:hover { background: rgba(220, 38, 38, 0.14); color: #ef4444; }

.tb-user-foot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 10px;
    padding-top: 12px;
    border-top: 1px solid var(--sb-border);
}
.tb-user-foot a {
    flex: 1;
    text-align: center;
    font-size: 13px;
    font-weight: 700;
    color: var(--sb-text);
    text-decoration: none;
    transition: color 140ms ease;
}
.tb-user-foot a:hover { color: var(--sb-muted); }
.tb-user-foot a + a { border-left: 1px solid var(--sb-border); }

/* --- usage analytics --- */
.ua-page { display: flex; flex-direction: column; gap: 16px; }
.ua-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
}
.ua-title-row { display: flex; align-items: center; gap: 10px; }
.ua-title { font-size: 17px; font-weight: 800; letter-spacing: -0.2px; }
.ua-plan-badge {
    padding: 3px 9px;
    border-radius: 7px;
    background: rgba(var(--accent-rgb), 0.1);
    color: var(--sb-text);
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.02em;
}
.ua-subtitle { margin-top: 3px; font-size: 12.5px; color: var(--sb-muted); }
.ua-head-actions { display: flex; align-items: center; gap: 10px; }
.ua-btn {
    height: var(--btn-h);
    padding: 0 16px;
    border-radius: 999px;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    transition: filter 140ms ease, background-color 140ms ease;
}
.ua-btn-ghost {
    border: 1px solid var(--sb-border);
    background: transparent;
    color: var(--sb-muted);
}
.ua-btn-ghost:disabled { cursor: not-allowed; opacity: 0.6; }
.ua-btn-primary { border: 0; background: var(--accent); color: var(--on-accent); }
.ua-btn-primary:hover { filter: brightness(1.08); }

.ua-period-row { display: flex; align-items: center; gap: 16px; }
.ua-period-line { flex: 1; height: 1px; background: var(--sb-border); }
.ua-period { position: relative; }
.ua-period-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    height: 38px;
    padding: 0 14px;
    border-radius: 10px;
    border: 1px solid var(--sb-border);
    background: rgba(var(--accent-rgb), 0.04);
    color: var(--sb-text);
    font-size: 13.5px;
    font-weight: 700;
    cursor: pointer;
}
.ua-period-btn .material-symbols-outlined { font-size: 18px; }
.ua-period-caret { color: var(--sb-muted); }
.ua-period-menu {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    z-index: 40;
    min-width: 100%;
    width: max-content;
    padding: 6px;
    border-radius: 12px;
    border: 1px solid var(--sb-border);
    background: var(--sb-bg);
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.25);
}
.ua-period-menu.hidden { display: none; }
.ua-period-item {
    display: block;
    width: 100%;
    padding: 9px 12px;
    border: 0;
    border-radius: 8px;
    background: transparent;
    font-size: 13.5px;
    font-weight: 600;
    color: var(--sb-text);
    text-align: left;
    white-space: nowrap;
    cursor: pointer;
    text-decoration: none;
}
.ua-period-item:hover { background: var(--sb-hover); }
.ua-period-item.is-active { background: var(--sb-hover); font-weight: 800; }

.ua-stat-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
}
@media (max-width: 900px) { .ua-stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 520px) { .ua-stat-grid { grid-template-columns: 1fr; } }
.ua-stat-card {
    padding: 14px;
    border-radius: 12px;
    border: 1px solid var(--sb-border);
    background: rgba(var(--accent-rgb), 0.02);
}
.ua-stat-label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    font-weight: 600;
    color: var(--sb-muted);
}
.ua-stat-info { font-size: 14px; cursor: help; }
.ua-stat-value { margin-top: 6px; font-size: 22px; font-weight: 800; letter-spacing: -0.3px; }

.ua-panel {
    border-radius: 14px;
    border: 1px solid var(--sb-border);
    background: var(--sb-bg);
    overflow: hidden;
}
.ua-panel-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 11px 16px;
    background: rgba(var(--accent-rgb), 0.03);
    border-bottom: 1px solid var(--sb-border);
}
.ua-panel-body { padding: 16px; min-height: 220px; }
.ua-panel-title { font-size: 14px; font-weight: 800; }
.ua-view-toggle {
    display: inline-flex;
    padding: 4px;
    gap: 4px;
    border-radius: 12px;
    background: rgba(var(--accent-rgb), 0.05);
    border: 1px solid var(--sb-border);
}
.ua-view-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 30px;
    border-radius: 8px;
    border: 0;
    background: transparent;
    color: var(--sb-muted);
    cursor: pointer;
}
.ua-view-btn .material-symbols-outlined { font-size: 19px; }
.ua-view-btn.is-active { background: var(--accent); color: var(--on-accent); box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12); }

.ua-chart { margin-top: 22px; }
.ua-bars { display: flex; flex-direction: column; gap: 16px; }
.ua-bar-row { display: grid; grid-template-columns: 120px 1fr auto; align-items: center; gap: 14px; }
.ua-bar-label { font-size: 13px; font-weight: 700; }
.ua-bar-track { height: 12px; border-radius: 999px; background: rgba(var(--accent-rgb), 0.08); overflow: hidden; }
.ua-bar-fill { height: 100%; border-radius: 999px; background: var(--accent); transition: width 400ms ease; }
.ua-bar-value { font-size: 13px; font-weight: 800; white-space: nowrap; }
.ua-bar-jobs { margin-left: 6px; font-size: 11.5px; font-weight: 600; color: var(--sb-muted); }

.ua-donut { display: flex; align-items: center; gap: 32px; flex-wrap: wrap; }
.ua-donut.hidden, .ua-bars.hidden { display: none; }
.ua-donut-ring {
    width: 180px;
    height: 180px;
    border-radius: 50%;
    background: var(--sb-hover);
    -webkit-mask: radial-gradient(farthest-side, transparent 58%, #000 59%);
    mask: radial-gradient(farthest-side, transparent 58%, #000 59%);
}
.ua-donut-legend { display: flex; flex-direction: column; gap: 10px; }
.ua-donut-legend li { display: flex; align-items: center; gap: 9px; font-size: 13px; font-weight: 600; }
.ua-donut-dot { width: 11px; height: 11px; border-radius: 3px; flex: 0 0 auto; }

.ua-empty {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 200px;
    color: var(--sb-muted);
    font-size: 14px;
    font-weight: 500;
}

.ua-summary { min-height: auto; }
.ua-summary-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.ua-summary-title-row { display: flex; align-items: center; gap: 10px; }
.ua-summary-period {
    padding: 3px 9px;
    border-radius: 8px;
    background: rgba(var(--accent-rgb), 0.08);
    color: var(--sb-text);
    font-size: 12px;
    font-weight: 700;
}
.ua-summary-legend-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-top: 14px; }
.ua-summary-metric { display: flex; align-items: center; gap: 8px; }
.ua-summary-metric b { font-size: 20px; font-weight: 800; letter-spacing: -0.3px; }
.ua-summary-metric-label { font-size: 13px; color: var(--sb-muted); }
.ua-summary-dot { width: 9px; height: 9px; border-radius: 999px; flex: 0 0 auto; }
.ua-dot-consumed { background: #c0616b; }
.ua-dot-added { background: #8b5cf6; }
.ua-line-chart { margin-top: 16px; width: 100%; position: relative; }
.ua-line-svg { width: 100%; height: 260px; display: block; }
.ua-line-svg text { font-family: inherit; }

.ua-tooltip {
    position: absolute;
    z-index: 5;
    min-width: 128px;
    padding: 8px 10px;
    border-radius: 10px;
    border: 1px solid var(--sb-border);
    background: var(--sb-bg);
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.25);
    pointer-events: none;
}
.ua-tooltip.hidden { display: none; }
.ua-tt-date { font-size: 12px; font-weight: 800; margin-bottom: 5px; }
.ua-tt-row { display: flex; align-items: center; gap: 7px; font-size: 12px; color: var(--sb-muted); }
.ua-tt-row b { margin-left: auto; color: var(--sb-text); font-weight: 800; }

.ua-page.is-loading { opacity: 0.55; transition: opacity 120ms ease; pointer-events: none; }

/* --- plan & billing --- */
.bl-page { display: flex; flex-direction: column; gap: 16px; }
.bl-head { display: flex; flex-direction: column; gap: 14px; }
.bl-title { font-size: 18px; font-weight: 800; letter-spacing: -0.2px; }
.bl-owner { display: flex; align-items: center; gap: 10px; }
.bl-owner-avatar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border-radius: 999px;
    background: #14b8a6;
    color: #fff;
    font-size: 13px;
    font-weight: 900;
}
.bl-owner-name { font-size: 13.5px; font-weight: 700; }
.bl-owner-role { font-size: 12px; color: var(--sb-muted); }

.bl-card {
    border-radius: 14px;
    border: 1px solid var(--sb-border);
    background: var(--sb-bg);
    overflow: hidden;
}
.bl-card-head {
    padding: 13px 16px;
    background: rgba(var(--accent-rgb), 0.03);
    border-bottom: 1px solid var(--sb-border);
    font-size: 12.5px;
    font-weight: 700;
    color: var(--sb-muted);
}
.bl-card-head-row { display: flex; align-items: center; justify-content: space-between; }
.bl-card-body { padding: 16px; }

.bl-sub-body { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.bl-sub-title-row { display: flex; align-items: center; gap: 10px; }
.bl-sub-plan { font-size: 15px; font-weight: 800; }
.bl-badge-active {
    padding: 2px 8px;
    border-radius: 6px;
    background: rgba(34, 197, 94, 0.14);
    color: #22c55e;
    font-size: 11px;
    font-weight: 800;
}
.bl-sub-meta { margin-top: 8px; font-size: 12.5px; color: var(--sb-text); }
.bl-sub-renews { margin-top: 6px; font-size: 12px; color: var(--sb-muted); }
.bl-sub-actions { display: flex; align-items: center; gap: 10px; }

.bl-btn {
    height: var(--btn-h);
    padding: 0 16px;
    border-radius: 10px;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    transition: background-color 140ms ease, filter 140ms ease;
}
.bl-btn-ghost { border: 1px solid var(--sb-border); background: rgba(var(--accent-rgb), 0.04); color: var(--sb-text); }
.bl-btn-ghost:hover { background: var(--sb-hover); }
.bl-btn-primary { border: 0; background: var(--accent); color: var(--on-accent); }
.bl-btn-primary:hover { filter: brightness(1.08); }

.bl-credits-row { display: flex; align-items: center; justify-content: space-between; gap: 20px; flex-wrap: wrap; }
.bl-credits-avail { display: flex; align-items: center; gap: 8px; }
.bl-credits-avail b { font-size: 18px; font-weight: 800; }
.bl-credits-spark { font-size: 20px; }
.bl-credits-label { font-size: 13px; color: var(--sb-muted); font-weight: 600; }
.bl-credits-info { font-size: 16px; color: var(--sb-muted); cursor: help; }
.bl-credits-used { flex: 1; min-width: 200px; max-width: 260px; }
.bl-credits-used-text { display: block; text-align: right; font-size: 12px; color: var(--sb-muted); margin-bottom: 8px; }
.bl-credits-bar { height: 3px; border-radius: 999px; background: rgba(var(--accent-rgb), 0.12); overflow: hidden; }
.bl-credits-fill { height: 100%; border-radius: 999px; background: var(--sb-text); }

.bl-topup {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-top: 20px;
    padding-top: 18px;
    border-top: 1px solid var(--sb-border);
    flex-wrap: wrap;
}
.bl-topup-title { font-size: 13.5px; font-weight: 700; }
.bl-topup-sub { margin-top: 3px; font-size: 12px; color: var(--sb-muted); }
.bl-topup-controls { display: flex; align-items: center; gap: 12px; }

.bl-switch { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; }
.bl-switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.bl-switch-track {
    position: relative;
    width: 40px;
    height: 22px;
    border-radius: 999px;
    background: rgba(var(--accent-rgb), 0.18);
    transition: background-color 160ms ease;
}
.bl-switch-thumb {
    position: absolute;
    top: 3px;
    left: 3px;
    width: 16px;
    height: 16px;
    border-radius: 999px;
    background: #fff;
    transition: transform 160ms ease;
}
.bl-switch input:checked + .bl-switch-track { background: var(--accent); }
.bl-switch input:checked + .bl-switch-track .bl-switch-thumb { transform: translateX(18px); }
.bl-switch-label { font-size: 13px; font-weight: 600; color: var(--sb-muted); }
.bl-icon-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border-radius: 999px;
    border: 1px solid var(--sb-border);
    background: transparent;
    color: var(--sb-text);
    cursor: pointer;
}
.bl-icon-btn:hover { background: var(--sb-hover); }
.bl-icon-btn .material-symbols-outlined { font-size: 18px; }

.bl-packs { margin-top: 20px; padding-top: 18px; border-top: 1px solid var(--sb-border); }
.bl-packs-head { display: flex; align-items: center; justify-content: space-between; }
.bl-packs-title { font-size: 13.5px; font-weight: 700; }
.bl-link {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 12.5px;
    font-weight: 700;
    color: var(--sb-muted);
    background: transparent;
    border: 0;
    cursor: pointer;
}
.bl-link:hover:not(:disabled) { color: var(--sb-text); }
.bl-link:disabled { opacity: 0.6; cursor: not-allowed; }
.bl-link .material-symbols-outlined { font-size: 16px; }

.bl-packs-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-top: 14px; }
@media (max-width: 760px) { .bl-packs-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 440px) { .bl-packs-grid { grid-template-columns: 1fr; } }
.bl-pack {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 7px;
    padding: 18px 12px;
    border-radius: 12px;
    border: 1px solid var(--sb-border);
    background: rgba(var(--accent-rgb), 0.03);
    cursor: pointer;
    transition: border-color 140ms ease, background-color 140ms ease;
}
.bl-pack:hover { border-color: rgba(var(--accent-rgb), 0.4); background: var(--sb-hover); }
.bl-pack-spark { font-size: 18px; color: var(--sb-muted); }
.bl-pack-credits { font-size: 14px; font-weight: 800; color: var(--sb-text); }
.bl-pack-price { font-size: 12px; color: var(--sb-muted); }

.bl-table { width: 100%; }
.bl-table-head {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--sb-border);
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--sb-muted);
}
.bl-col-center { text-align: center; }
.bl-col-right { text-align: right; }
.bl-table-empty { padding: 40px 16px 12px; text-align: center; }
.bl-empty-title { font-size: 14px; font-weight: 800; }
.bl-empty-sub { margin-top: 5px; font-size: 12.5px; color: var(--sb-muted); }

/* --- get help page --- */
.gh-page { display: flex; flex-direction: column; gap: 16px; }
.gh-hero { text-align: center; padding: 8px 0 4px; }
.gh-title { font-size: 24px; font-weight: 800; letter-spacing: -0.4px; }
.gh-sub { margin-top: 6px; font-size: 13.5px; color: var(--sb-muted); }

.gh-card {
    border-radius: 14px;
    border: 1px solid var(--sb-border);
    background: var(--sb-bg);
    overflow: hidden;
}
.gh-card-head {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 16px;
    background: rgba(var(--accent-rgb), 0.03);
    border-bottom: 1px solid var(--sb-border);
}
.gh-head-icon { font-size: 20px; }
.gh-card-title { font-size: 14px; font-weight: 800; }
.gh-card-sub { margin-top: 2px; font-size: 12px; color: var(--sb-muted); }
.gh-card-body { padding: 16px; }

.gh-videos-body { display: grid; gap: 14px; }
@media (min-width: 900px) { .gh-videos-body { grid-template-columns: 3fr 2fr; } }
.gh-video-frame {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    aspect-ratio: 16 / 9;
    border-radius: 12px;
    border: 1px solid var(--sb-border);
    background:
        linear-gradient(160deg, rgba(var(--accent-rgb), 0.08), rgba(var(--accent-rgb), 0.02));
}
.gh-video-play {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 54px;
    height: 54px;
    border-radius: 999px;
    background: var(--accent);
    color: var(--on-accent);
    font-size: 30px;
}
.gh-video-caption { position: absolute; left: 16px; bottom: 14px; }
.gh-video-eyebrow { font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: 0.05em; color: var(--sb-muted); }
.gh-video-title { font-size: 18px; font-weight: 800; letter-spacing: -0.2px; }
.gh-video-length {
    position: absolute;
    right: 12px;
    bottom: 12px;
    padding: 2px 7px;
    border-radius: 6px;
    background: rgba(0, 0, 0, 0.55);
    color: #fff;
    font-size: 11px;
    font-weight: 700;
}
.gh-video-list { display: flex; flex-direction: column; gap: 10px; }
.gh-video-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px;
    border-radius: 12px;
    border: 1px solid var(--sb-border);
    background: rgba(var(--accent-rgb), 0.02);
    text-align: left;
    cursor: pointer;
    transition: background-color 140ms ease, border-color 140ms ease;
}
.gh-video-item:hover:not(:disabled) { background: var(--sb-hover); }
.gh-video-item:disabled { cursor: default; }
.gh-video-thumb {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 74px;
    height: 46px;
    flex: 0 0 auto;
    border-radius: 8px;
    border: 1px solid var(--sb-border);
    background: rgba(var(--accent-rgb), 0.06);
    color: var(--sb-muted);
}
.gh-video-item-info { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.gh-video-item-info b { font-size: 13px; font-weight: 800; }
.gh-video-item-info span { font-size: 12px; color: var(--sb-muted); }

.gh-grid { display: grid; gap: 16px; }
@media (min-width: 900px) { .gh-grid { grid-template-columns: 1fr 1fr; align-items: start; } }
.gh-col { display: flex; flex-direction: column; gap: 12px; }

.gh-link-card {
    display: block;
    padding: 16px;
    text-decoration: none;
    color: var(--sb-text);
    transition: background-color 140ms ease, border-color 140ms ease;
}
.gh-link-card:hover { background: var(--sb-hover); }
.gh-link-head { display: flex; align-items: center; gap: 9px; }
.gh-link-head .material-symbols-outlined { font-size: 19px; }
.gh-link-sub { margin-top: 7px; font-size: 12.5px; color: var(--sb-muted); }

.gh-status-banner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    border-radius: 10px;
    margin-bottom: 10px;
    background: rgba(var(--accent-rgb), 0.06);
    font-size: 13px;
    font-weight: 800;
}
.gh-status-banner.is-ok { background: rgba(34, 197, 94, 0.12); color: #22c55e; }
.gh-status-banner .material-symbols-outlined { font-size: 18px; }
.gh-status-list { display: flex; flex-direction: column; gap: 9px; margin: 4px 2px 18px; }
.gh-status-row { display: flex; align-items: center; gap: 10px; }
.gh-status-name { font-size: 12.5px; font-weight: 600; }
.gh-status-dots { flex: 1; border-bottom: 1px dotted var(--sb-border); transform: translateY(3px); }
.gh-status-value { font-size: 12.5px; font-weight: 700; color: var(--sb-muted); }

.gh-footnote { text-align: center; font-size: 13px; color: var(--sb-muted); padding: 6px 0 12px; }
.gh-footnote a { font-weight: 800; color: var(--sb-text); text-decoration: none; }
.gh-footnote a:hover { text-decoration: underline; }

/* --- dashboard home grid --- */.dh-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 16px;
}

.dh-card {
    position: relative;
    display: block;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 16px;
    background: linear-gradient(150deg, rgba(255, 255, 255, 0.05), rgba(255, 255, 255, 0.015));
    color: #fff;
    transition: border-color 180ms ease, box-shadow 180ms ease, background 180ms ease;
}

.dh-card:hover {
    border-color: rgba(255, 255, 255, 0.28);
    box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.06), 0 10px 32px rgba(var(--accent-rgb), 0.14);
}

html:not([data-theme='dark']) .dh-card:hover {
    border-color: #cfcfda;
    box-shadow: 0 0 0 1px rgba(23, 23, 25, 0.04), 0 10px 28px rgba(23, 23, 25, 0.1);
}

html:not([data-theme='dark']) .dh-card {
    border-color: #e3e3e8;
    background: #fff;
    color: #171719;
}

.dh-card-feature {
    grid-column: span 2;
    min-height: 248px;
    background: linear-gradient(140deg, #241b3f 0%, #17122b 55%, #0f0c1d 100%);
}

/* --- dashboard card media layers --- */
.dh-media {
    position: absolute;
    inset: 0;
    z-index: 0;
    display: block;
    overflow: hidden;
    border-radius: inherit;
    pointer-events: none;
}

.dh-media-img,
.dh-media-video {
    position: absolute;
    inset: 0;
    height: 100%;
    width: 100%;
    object-fit: cover;
    opacity: 0;
    transition: opacity 400ms ease;
}

.dh-media-img.is-visible,
.dh-media-video.is-visible { opacity: 1; }

.dh-skeleton {
    position: absolute;
    inset: 0;
    background: linear-gradient(110deg, rgba(255, 255, 255, 0.04) 25%, rgba(255, 255, 255, 0.1) 42%, rgba(255, 255, 255, 0.04) 60%);
    background-size: 220% 100%;
    animation: dh-shimmer 1.4s linear infinite;
    opacity: 1;
    transition: opacity 320ms ease;
}

.dh-skeleton.is-hidden { opacity: 0; }

@keyframes dh-shimmer {
    from { background-position: 130% 0; }
    to { background-position: -90% 0; }
}

/* --- dashboard "what will you create today" section --- */
.dh-create {
    display: grid;
    grid-template-columns: 260px 1fr;
    gap: 24px;
    align-items: start;
    /* !important: the page container's Tailwind space-y rule otherwise wins. */
    margin-top: 56px !important;
    padding: 22px;
    border-radius: 18px;
    border: 1px solid var(--sb-border);
    background:
        radial-gradient(120% 160% at 0% 0%, rgba(var(--accent-rgb), 0.08), transparent 60%),
        var(--sb-bg);
    overflow: hidden;
}
@media (max-width: 860px) { .dh-create { grid-template-columns: 1fr; } }
.dh-create-title { font-size: 26px; font-weight: 800; letter-spacing: -0.5px; line-height: 1.15; }
.dh-create-title span { color: var(--sb-muted); }
.dh-create-sub { margin-top: 10px; font-size: 13px; color: var(--sb-muted); line-height: 1.5; }
.dh-create-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    height: var(--btn-h);
    margin-top: 16px;
    padding: 0 16px;
    border-radius: 999px;
    background: var(--accent);
    color: var(--on-accent);
    font-size: 13px;
    font-weight: 700;
    text-decoration: none;
    transition: filter 140ms ease;
}
.dh-create-btn:hover { filter: brightness(1.08); }
.dh-create-btn .material-symbols-outlined { font-size: 17px; }

.dh-create-scroller {
    display: flex;
    gap: 14px;
    overflow-x: auto;
    padding: 4px 2px 8px;
    scrollbar-width: none;
    -ms-overflow-style: none;
}
.dh-create-scroller::-webkit-scrollbar { display: none; }
.dh-tool-card {
    display: flex;
    flex-direction: column;
    flex: 0 0 210px;
    border-radius: 14px;
    border: 1px solid var(--sb-border);
    background: rgba(var(--accent-rgb), 0.03);
    overflow: hidden;
    text-decoration: none;
    color: var(--sb-text);
    transition: border-color 140ms ease, transform 140ms ease;
}
.dh-tool-card:hover { border-color: rgba(var(--accent-rgb), 0.4); transform: translateY(-2px); }
.dh-tool-media {
    position: relative;
    display: block;
    aspect-ratio: 1 / 1;
    background: rgba(var(--accent-rgb), 0.05);
    overflow: hidden;
}
.dh-tool-img { width: 100%; height: 100%; object-fit: cover; }
.dh-tool-foot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 11px 13px;
}
.dh-tool-name { font-size: 13.5px; font-weight: 800; }
.dh-tool-arrow { font-size: 18px; color: var(--sb-muted); transition: transform 140ms ease; }
.dh-tool-card:hover .dh-tool-arrow { transform: translateX(3px); }

/* --- dashboard gallery heading --- */
.dh-gallery-head { margin-top: 56px !important; }
.dh-gallery-title { font-size: 17px; font-weight: 800; letter-spacing: -0.2px; }
.dh-gallery-sub { margin-top: 8px; font-size: 13.5px; line-height: 1.55; color: var(--sb-muted); max-width: 1100px; }

.dh-feature-content {
    position: relative;
    z-index: 1;
    display: flex;
    height: 100%;
    min-height: 248px;
    flex-direction: column;
    align-items: flex-start;
    padding: 28px 30px;
}

.dh-feature-title {
    font-size: 26px;
    font-weight: 700;
    letter-spacing: -0.01em;
    color: #fff;
}

.dh-feature-sub {
    margin-top: 10px;
    font-size: 15px;
    font-weight: 500;
    line-height: 1.45;
    color: rgba(255, 255, 255, 0.88);
}

.dh-try-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-top: auto;
    border: 1px solid rgba(255, 255, 255, 0.45);
    border-radius: 12px;
    background: rgba(10, 10, 16, 0.35);
    padding: 10px 20px;
    font-size: 14.5px;
    font-weight: 600;
    color: #fff;
    backdrop-filter: blur(6px);
    transition: background-color 160ms ease, border-color 160ms ease;
}

.dh-card-feature:hover .dh-try-btn {
    background: rgba(255, 255, 255, 0.14);
    border-color: rgba(255, 255, 255, 0.7);
}

.dh-try-arrow { transition: transform 160ms ease; }
.dh-card-feature:hover .dh-try-arrow { transform: translateX(3px); }

.dh-card-media {
    min-height: 248px;
    background: linear-gradient(160deg, #141225 0%, #0d0c18 100%);
}

.dh-media-content {
    position: relative;
    z-index: 1;
    display: flex;
    height: 100%;
    min-height: 248px;
    flex-direction: column;
    justify-content: flex-end;
    padding: 22px 24px;
}

.dh-card-media::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(to top, rgba(5, 5, 10, 0.55), transparent 55%);
}

.dh-media-content .dh-card-icon { margin-bottom: auto; }

.dh-card-plain { min-height: 248px; }

.dh-plain-content {
    display: flex;
    height: 100%;
    min-height: 248px;
    flex-direction: column;
    justify-content: flex-end;
    padding: 22px 24px;
}

.dh-plain-content .dh-card-icon { margin-bottom: auto; }

.dh-card-icon {
    display: inline-flex;
    height: 28px;
    width: 28px;
    align-items: center;
    justify-content: center;
    color: inherit;
}

.dh-card-icon .material-symbols-outlined { font-size: 26px; }

.dh-card-title {
    margin-top: 14px;
    font-size: 19px;
    font-weight: 700;
    letter-spacing: -0.01em;
}

.dh-card-media .dh-card-title,
.dh-card-media .dh-card-sub { color: #fff; position: relative; z-index: 1; }

.dh-card-sub {
    margin-top: 6px;
    font-size: 14px;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.62);
}

.dh-card-media .dh-card-sub { color: rgba(255, 255, 255, 0.82); }

html:not([data-theme='dark']) .dh-card-plain .dh-card-sub,
html:not([data-theme='dark']) .dh-card-small .dh-card-sub { color: #666675; }

.dh-card-small {
    min-height: 112px;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    padding: 14px 18px;
    position: relative;
    overflow: hidden;
}
.dh-card-small::before {
    content: '';
    position: absolute;
    inset: 0;
    pointer-events: none;
    background: radial-gradient(90% 120% at 18% 0%, rgba(var(--accent-rgb), 0.09), transparent 60%);
}
.dh-card-small > * { position: relative; z-index: 1; }

.dh-card-small .dh-card-icon { margin-bottom: auto; }
.dh-card-small .dh-card-title { font-size: 15.5px; }
.dh-card-small .dh-card-sub { font-size: 13px; margin-top: 4px; }

.dh-card-locked {
    cursor: not-allowed;
    opacity: 0.55;
    pointer-events: none;
    user-select: none;
}

.dh-card-toprow {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: auto;
}
.dh-card-toprow .dh-card-icon { margin-bottom: 0; }

.dh-card-lock {
    font-size: 16px;
    color: var(--sb-muted);
}

@media (max-width: 1100px) {
    .dh-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .dh-card-feature { grid-column: span 2; }
}

@media (max-width: 640px) {
    .dh-grid { grid-template-columns: minmax(0, 1fr); }
    .dh-card-feature { grid-column: span 1; }
}

.app-main {
    margin-left: var(--app-sidebar-w);
    margin-top: 0;
    height: 100vh;
    padding-top: 56px;
    overflow-x: hidden;
    overflow-y: auto;
    transition: margin-left 220ms cubic-bezier(0.22, 1, 0.36, 1);
}

body[data-theme-root] {
    background: transparent;
    color: #171719;
}

html:not([data-theme='dark']) {
    background: #f6f6f9;
}

html[data-theme='dark'] body[data-theme-root] {
    background: transparent;
    color: #f4f4f6;
}

.app-main:has(.avatar-main-shell) {
    background: #fff;
}

.studio-main-shell {
    max-width: 100%;
    min-width: 0;
    width: min(100%, 1520px);
    margin-right: auto;
    margin-left: auto;
}

.avatar-main-shell {
    display: flex;
    min-height: calc(100vh - 56px);
    flex-direction: column;
    background: #fff;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 10px;
    border-radius: 7px;
    padding: 7px 10px;
    color: #666675;
    font-size: 12.5px;
    font-weight: 650;
    transition: background-color 160ms ease, color 160ms ease, transform 160ms ease;
}

.nav-link:hover,
.nav-link-active {
    background: #f1f1f4;
    color: #171719;
}

.nav-link:active { transform: scale(0.99); }

.panel,
.stat-card,
.auth-card {
    border: 1px solid #e3e3e8;
    border-radius: 8px;
    background: #fff;
    box-shadow: 0 1px 2px rgba(17, 17, 24, 0.04);
}

.job-progress-panel,
.job-inline-progress {
    max-width: 100%;
    min-width: 0;
    overflow: hidden;
    position: relative;
}

.job-inline-progress [data-job-detail] {
    max-width: 100%;
    overflow-wrap: anywhere;
}

.job-progress-track {
    height: 4px;
    overflow: hidden;
    border-radius: 999px;
    background: #ececf2;
}

.job-progress-track > span {
    display: block;
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, var(--accent), var(--accent));
    transition: width 280ms ease;
}

.job-inline-audio {
    display: none;
}

.speech-status-queued {
    background: var(--accent-soft);
    color: var(--accent);
}

.audio-recent-row {
    position: relative;
}

.audio-recent-row::before {
    position: absolute;
    inset: 10px auto 10px 0;
    width: 3px;
    content: '';
    border-radius: 999px;
    opacity: 0;
    transition: opacity 160ms ease;
}

.audio-recent-row-completed {
    border-color: rgba(34, 197, 94, 0.24);
    background: linear-gradient(90deg, rgba(236, 253, 245, 0.72), #ffffff 28%);
}

.audio-recent-row-completed::before {
    background: #22c55e;
    opacity: 1;
}

.audio-recent-row-processing,
.audio-recent-row-queued {
    border-color: rgba(var(--accent-rgb), 0.22);
    background: linear-gradient(90deg, rgba(238, 242, 255, 0.7), #ffffff 28%);
}

.audio-recent-row-processing::before,
.audio-recent-row-queued::before {
    background: var(--accent);
    opacity: 1;
}

.audio-recent-row-failed {
    border-color: rgba(220, 38, 38, 0.22);
    background: linear-gradient(90deg, rgba(254, 242, 242, 0.7), #ffffff 28%);
}

.audio-recent-row-failed::before {
    background: #dc2626;
    opacity: 1;
}

.audio-recent-row-completed [data-recent-row-player] {
    background: #ecfdf5;
    color: #16a34a;
}

.audio-recent-status {
    font-weight: 800;
}

.audio-recent-status-completed {
    color: #047857;
}

.audio-recent-status-processing,
.audio-recent-status-queued {
    color: var(--accent);
}

.audio-recent-status-failed {
    color: #b42318;
}

.audio-recent-status-pill-completed {
    background: #dcfce7;
    color: #166534;
}

.audio-recent-status-pill-processing,
.audio-recent-status-pill-queued {
    background: var(--accent-soft);
    color: var(--accent);
}

.audio-recent-status-pill-failed {
    background: #fef2f2;
    color: #b42318;
}

html[data-theme='dark'] .audio-recent-row {
    border-color: #292934;
    background: #121218;
}

html[data-theme='dark'] .audio-recent-row:hover {
    border-color: rgba(var(--accent-rgb), 0.45);
    background: #171722;
    box-shadow: 0 14px 32px rgba(0, 0, 0, 0.24);
}

html[data-theme='dark'] .audio-recent-row p:first-child {
    color: #f4f4f6;
}

html[data-theme='dark'] .audio-recent-row p:last-child {
    color: #a8a8b6;
}

html[data-theme='dark'] .audio-recent-row-completed {
    border-color: rgba(34, 197, 94, 0.36);
    background: linear-gradient(90deg, rgba(20, 83, 45, 0.42), #121218 34%);
}

html[data-theme='dark'] .audio-recent-row-processing,
html[data-theme='dark'] .audio-recent-row-queued {
    border-color: rgba(var(--accent-rgb), 0.34);
    background: linear-gradient(90deg, rgba(49, 46, 129, 0.34), #121218 34%);
}

html[data-theme='dark'] .audio-recent-row-failed {
    border-color: rgba(248, 113, 113, 0.35);
    background: linear-gradient(90deg, rgba(127, 29, 29, 0.32), #121218 34%);
}

html[data-theme='dark'] .audio-recent-row-completed [data-recent-row-player] {
    border-color: rgba(74, 222, 128, 0.35);
    background: rgba(22, 101, 52, 0.26);
    color: #86efac;
}

html[data-theme='dark'] .audio-recent-status-completed {
    color: #86efac;
}

html[data-theme='dark'] .audio-recent-status-processing,
html[data-theme='dark'] .audio-recent-status-queued {
    color: var(--accent);
}

html[data-theme='dark'] .audio-recent-status-failed {
    color: #fca5a5;
}

html[data-theme='dark'] .audio-recent-status-pill-completed {
    background: rgba(34, 197, 94, 0.18);
    color: #86efac;
}

html[data-theme='dark'] .audio-recent-status-pill-processing,
html[data-theme='dark'] .audio-recent-status-pill-queued {
    background: rgba(var(--accent-rgb), 0.18);
    color: var(--accent);
}

html[data-theme='dark'] .audio-recent-status-pill-failed {
    background: rgba(220, 38, 38, 0.18);
    color: #fca5a5;
}

html[data-theme='dark'] .audio-recent-row .icon-button {
    border-color: #292934;
    background: #0d0d10;
    color: #c7c7d4;
}

html[data-theme='dark'] .audio-recent-row .icon-button:hover {
    border-color: rgba(var(--accent-rgb), 0.45);
    background: #202028;
    color: #ffffff;
}

#voice-library {
    scroll-margin-top: 92px;
}

.auth-card {
    width: min(100%, 420px);
    padding: 24px;
}

.stat-card {
    display: flex;
    min-height: 96px;
    flex-direction: column;
    justify-content: center;
    padding: 16px;
}

.stat-label {
    color: #666675;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0;
    text-transform: uppercase;
}

.stat-value {
    margin-top: 8px;
    display: block;
    font-size: 22px;
    font-weight: 850;
}

.dashboard-hero {
    position: relative;
    overflow: hidden;
    background: linear-gradient(135deg, #fff 0%, #fbfbff 48%, #f7fffd 100%);
}

.dashboard-hero::after {
    position: absolute;
    right: -70px;
    bottom: -92px;
    width: 220px;
    height: 220px;
    border: 1px solid rgba(var(--accent-rgb), 0.16);
    border-radius: 999px;
    content: '';
}

.dashboard-kicker,
.dashboard-status {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    border-radius: 7px;
    padding: 5px 8px;
    font-size: 11px;
    font-weight: 850;
    text-transform: uppercase;
}

.dashboard-kicker {
    background: rgba(var(--accent-rgb), 0.08);
    color: var(--accent);
}

.dashboard-status {
    color: #666675;
    text-transform: none;
}

.dashboard-status span {
    height: 7px;
    width: 7px;
    border-radius: 999px;
    background: #10b981;
}

.dashboard-hero-actions {
    position: relative;
    z-index: 1;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
}

.dashboard-stat-card {
    position: relative;
    min-height: 128px;
    overflow: hidden;
    border: 1px solid #e3e3e8;
    border-radius: 8px;
    background: #fff;
    padding: 14px;
    box-shadow: 0 1px 2px rgba(17, 17, 24, 0.04);
}

.dashboard-stat-card::before {
    position: absolute;
    inset: 0 0 auto;
    height: 3px;
    background: var(--accent);
    content: '';
}

.dashboard-stat-card-voices::before { background: var(--accent); }
.dashboard-stat-card-generations::before { background: var(--accent); }
.dashboard-stat-card-completed::before { background: var(--accent); }
.dashboard-stat-card-credits::before { background: var(--accent); }
.dashboard-stat-card-stt::before { background: var(--accent); }
.dashboard-stat-card-tokens::before { background: var(--accent); }

.dashboard-stat-topline {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.dashboard-stat-icon {
    display: inline-flex;
    height: 32px;
    width: 32px;
    flex: 0 0 auto;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    background: #f1f1f4;
    color: var(--accent);
}

.dashboard-stat-card-generations .dashboard-stat-icon { color: var(--accent); }
.dashboard-stat-card-completed .dashboard-stat-icon { color: var(--accent); }
.dashboard-stat-card-credits .dashboard-stat-icon { color: var(--accent); }
.dashboard-stat-card-stt .dashboard-stat-icon { color: var(--accent); }
.dashboard-stat-card-tokens .dashboard-stat-icon { color: var(--accent); }

.dashboard-stat-value {
    display: block;
    margin-top: 12px;
    color: #171719;
    font-size: 26px;
    font-weight: 900;
    line-height: 1;
}

.dashboard-stat-note {
    margin-top: 9px;
    color: #666675;
    font-size: 11px;
    font-weight: 750;
}

.dashboard-stat-note-positive {
    color: #16a34a;
}

.dashboard-stat-note-small {
    margin-top: 2px;
    font-size: 10px;
}

.dashboard-flow-step,
.dashboard-sample-card,
.dashboard-voice-card,
.dashboard-empty-card {
    border: 1px solid #e3e3e8;
    border-radius: 8px;
    background: #fff;
}

.dashboard-flow-step {
    min-height: 112px;
    padding: 14px;
}

.dashboard-flow-icon {
    display: inline-flex;
    height: 34px;
    width: 34px;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    background: rgba(var(--accent-rgb), 0.08);
    color: var(--accent);
}

.dashboard-sample-card,
.dashboard-voice-card {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px;
}

.dashboard-sample-wave {
    display: block;
    width: 92px;
    height: 30px;
    flex: 0 0 auto;
    opacity: 0.84;
    background: repeating-linear-gradient(90deg, var(--accent) 0 3px, transparent 3px 7px);
    -webkit-mask: linear-gradient(90deg, transparent 0, #000 8px, #000 calc(100% - 8px), transparent 100%);
    mask: linear-gradient(90deg, transparent 0, #000 8px, #000 calc(100% - 8px), transparent 100%);
}

.dashboard-empty-card {
    border-style: dashed;
    padding: 16px;
    color: #666675;
    font-size: 13px;
    font-weight: 650;
}

.dashboard-voice-card:hover {
    border-color: rgba(var(--accent-rgb), 0.32);
    box-shadow: 0 10px 28px rgba(17, 17, 24, 0.07);
    transform: translateY(-1px);
}

.dashboard-voice-avatar {
    display: inline-flex;
    height: 42px;
    width: 42px;
    flex: 0 0 auto;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    border-radius: 999px;
    background: #f1f1f4;
    color: var(--accent);
}

.dashboard-voice-avatar-male {
    background: linear-gradient(135deg, var(--accent-soft) 0%, var(--accent-soft) 100%);
}

.dashboard-voice-avatar-female {
    background: linear-gradient(135deg, var(--accent-soft) 0%, var(--accent-soft) 100%);
}

.dashboard-voice-avatar-robot {
    background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
}

.dashboard-voice-icon {
    display: block;
    height: 32px;
    width: 32px;
    object-fit: contain;
}

.dashboard-voice-name {
    display: block;
    min-width: 0;
    overflow: hidden;
    color: #171719;
    font-size: 13px;
    font-weight: 850;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.dashboard-voice-name:hover {
    color: var(--accent);
}

.dashboard-voice-tags {
    display: flex;
    min-width: 0;
    flex-wrap: wrap;
    gap: 5px;
    margin-top: 6px;
}

.dashboard-voice-tags span {
    max-width: 100%;
    overflow: hidden;
    border-radius: 6px;
    background: #f1f1f4;
    padding: 3px 6px;
    color: #666675;
    font-size: 10px;
    font-weight: 800;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.dashboard-voice-actions {
    display: flex;
    flex: 0 0 auto;
    align-items: center;
    gap: 5px;
}

.dashboard-voice-generate,
.dashboard-voice-generate.icon-button {
    background: var(--accent);
    color: #fff;
}

.dashboard-voice-generate .material-symbols-outlined {
    font-size: 18px;
}

.dashboard-voice-generate:hover,
.dashboard-voice-generate.icon-button:hover {
    background: var(--accent);
    color: #fff;
}

.dashboard-voice-generate:active {
    transform: scale(0.98);
}

.topbar-button,
.secondary-button,
.danger-button,
.primary-button,
.tool-pill,
.prompt-chip,
.icon-button {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    border-radius: 7px;
    font-size: 12.5px;
    font-weight: 720;
    transition: background-color 160ms ease, color 160ms ease, border-color 160ms ease, transform 160ms ease, opacity 160ms ease;
}

.topbar-button,
.secondary-button,
.danger-button,
.prompt-chip {
    border: 1px solid #e3e3e8;
    background: #fff;
    color: #33333c;
    padding: 7px 11px;
}
.prompt-chip {
    min-height: 34px;
}

.topbar-button:hover,
.secondary-button:hover,
.prompt-chip:hover {
    background: #f1f1f4;
}

.danger-button {
    color: #b42318;
}

.danger-button:hover {
    border-color: #fecaca;
    background: #fff1f2;
}

.primary-button {
    background: var(--primary-bg);
    color: var(--primary-fg);
    padding: 8px 14px;
}

.primary-button:hover { background: var(--primary-bg); filter: brightness(0.92); }
.primary-button:disabled { cursor: not-allowed; opacity: 0.45; }
.primary-button:active,
.secondary-button:active,
.icon-button:active { transform: scale(0.98); }

.icon-button {
    position: relative;
    display: inline-flex;
    height: 32px;
    width: 32px;
    justify-content: center;
    padding: 0;
    color: #666675;
}

.icon-button:hover { background: #f1f1f4; color: #171719; }
.icon-button:disabled { cursor: not-allowed; opacity: 0.4; }

.theme-toggle {
    display: inline-flex;
    height: 32px;
    width: 32px;
    align-items: center;
    justify-content: center;
    border: 1px solid #e3e3e8;
    border-radius: 8px;
    background: #fff;
    color: #666675;
    transition: background-color 160ms ease, color 160ms ease, border-color 160ms ease, transform 160ms ease;
}

.theme-toggle:hover {
    background: #f1f1f4;
    color: #171719;
}

.theme-toggle:active { transform: scale(0.98); }

.auth-theme-toggle {
    position: fixed;
    right: 18px;
    top: 18px;
    z-index: 20;
}

/* ---- Split auth layout (login / register) ---------------------------- */
.auth-shell {
    display: grid;
    grid-template-columns: minmax(0, 1.02fr) minmax(0, 0.98fr);
    height: 100vh;
    height: 100dvh;
    overflow: hidden;
}

.auth-gallery {
    position: relative;
    overflow: hidden;
    background: #f1f1f4;
}

html[data-theme='dark'] .auth-gallery {
    background: #0b0b0e;
}

.auth-gallery-grid {
    position: absolute;
    inset: 12px;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    grid-auto-rows: minmax(0, 1fr);
    gap: 12px;
    overflow: hidden;
}

.auth-gallery-grid img {
    display: block;
    width: 100%;
    height: 100%;
    min-height: 0;
    min-width: 0;
    object-fit: cover;
    border-radius: 12px;
    background: #e3e3e8;
}

.auth-panel {
    display: grid;
    place-items: center;
    padding: 40px 24px;
    overflow-y: auto;
}

.auth-panel .auth-card {
    width: min(100%, 400px);
    border: 0;
    background: transparent;
    box-shadow: none;
    padding: 0;
}

html[data-theme='dark'] .auth-panel .auth-card {
    border: 0;
    background: transparent;
    box-shadow: none;
}

.auth-head {
    margin-bottom: 36px;
    text-align: center;
}

.auth-eyebrow {
    color: #666675;
    font-size: 14px;
    font-weight: 600;
}

.auth-title {
    margin-top: 6px;
    font-size: 34px;
    font-weight: 800;
    letter-spacing: -0.5px;
}

.auth-form {
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.auth-card .field-label {
    font-size: 13px;
    font-weight: 700;
}

html[data-theme='dark'] .auth-card .field-label {
    color: #ffffff;
}

.auth-card .password-field {
    display: flex;
    align-items: center;
}

.auth-card .password-field .form-control {
    flex: 1;
}

.auth-card .password-toggle {
    position: absolute;
    top: calc(50% + 3px);
    right: 10px;
    height: 32px;
    width: 32px;
    transform: translateY(-50%);
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.auth-card .password-toggle .material-symbols-outlined {
    display: block;
    font-size: 20px;
    line-height: 1;
}

/* input[type] qualifier + !important guard against Tailwind CDN's
   forms-plugin reset, which is injected after this stylesheet and
   otherwise overrides the global .form-control border/radius/bg. */
.auth-card input.form-control,
.auth-card .form-control {
    min-height: 48px;
    padding-left: 16px;
    padding-right: 16px;
    font-size: 14px;
    border: 1px solid #e3e3e8 !important;
    border-radius: 12px !important;
    background-color: #fff !important;
    color: #171719 !important;
    box-shadow: none !important;
}

.auth-card input.form-control:focus,
.auth-card .form-control:focus {
    border-color: rgba(var(--accent-rgb), 0.35) !important;
    box-shadow: 0 0 0 3px rgba(var(--accent-rgb), 0.06) !important;
    outline: none !important;
    --tw-ring-shadow: 0 0 #0000;
    --tw-ring-offset-shadow: 0 0 #0000;
}

.auth-card .password-field .form-control {
    padding-right: 48px;
}

html[data-theme='dark'] .auth-card input.form-control,
html[data-theme='dark'] .auth-card .form-control {
    border-color: rgba(255, 255, 255, 0.1) !important;
    background-color: rgba(255, 255, 255, 0.05) !important;
    color: #f4f4f6 !important;
}

.auth-card .password-toggle {
    right: 10px;
}

.auth-submit {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 50px;
    margin-top: 6px;
    border-radius: 999px;
    background: #171719;
    color: #fff;
    font-size: 14.5px;
    font-weight: 750;
    transition: opacity 160ms ease, transform 160ms ease;
}

.auth-submit:hover { opacity: 0.92; }
.auth-submit:active { transform: scale(0.99); }

.auth-submit-arrow {
    position: absolute;
    right: 7px;
    top: 50%;
    display: inline-flex;
    height: 36px;
    width: 36px;
    transform: translateY(-50%);
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    background: var(--accent);
    color: var(--on-accent);
    font-size: 18px;
}

html[data-theme='dark'] .auth-submit {
    background: #fff;
    color: #171719;
}

html[data-theme='dark'] .auth-divider span { background: #292934; }
html[data-theme='dark'] .auth-google {
    border-color: #292934;
    color: #f4f4f8;
}
html[data-theme='dark'] .auth-google:hover { background: #1a1a20; }

.auth-divider {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 22px 0;
}

.auth-divider span {
    height: 1px;
    flex: 1;
    background: #e3e3e8;
}

.auth-divider em {
    color: #666675;
    font-size: 11px;
    font-style: normal;
    font-weight: 800;
    letter-spacing: 1px;
    text-transform: uppercase;
}

.auth-google {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    min-height: 50px;
    border: 1px solid #e3e3e8;
    border-radius: 999px;
    background: transparent;
    color: #171719;
    font-size: 14px;
    font-weight: 700;
    transition: background-color 160ms ease, border-color 160ms ease;
}

.auth-google:hover {
    background: #f1f1f4;
}

.auth-footnote {
    margin-top: 28px;
    text-align: center;
    color: #666675;
    font-size: 13.5px;
    font-weight: 600;
}

.auth-footnote a {
    color: var(--accent);
    font-weight: 800;
}

@media (max-width: 900px) {
    .auth-shell {
        grid-template-columns: 1fr;
    }

    .auth-gallery {
        display: none;
    }

    .auth-panel {
        padding: 48px 20px;
    }
}

.profile-trigger {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    border-radius: 8px;
    padding: 4px 8px;
    transition: background-color 160ms ease, transform 160ms ease;
}

.profile-trigger:hover,
.profile-trigger[aria-expanded='true'] {
    background: #f1f1f4;
}

.profile-trigger:active { transform: scale(0.99); }

.dropdown-panel {
    position: absolute;
    right: 0;
    top: calc(100% + 8px);
    z-index: 120;
    width: min(360px, calc(100vw - 24px));
    overflow: hidden;
    border: 1px solid #e3e3e8;
    border-radius: 8px;
    background: #fff;
    box-shadow: 0 18px 50px rgba(17, 17, 24, 0.14);
}

.dropdown-panel-left {
    left: 0;
    right: auto;
}

.mobile-nav-button {
    display: none;
}

.mobile-nav-panel {
    width: min(300px, calc(100vw - 24px));
}

.sidebar-favorites-button {
    display: flex;
    width: 100%;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    border: 1px solid #e3e3e8;
    border-radius: 8px;
    background: #fff;
    padding: 8px;
    color: #171719;
    transition: background-color 160ms ease, border-color 160ms ease, transform 160ms ease;
}

.sidebar-favorites-button:hover,
.sidebar-favorites-button[aria-expanded='true'] {
    background: #f8f8fa;
}

.sidebar-favorites-button:active {
    transform: scale(0.99);
}

.sidebar-favorites-icon {
    display: inline-flex;
    height: 24px;
    width: 24px;
    align-items: center;
    justify-content: center;
    border-radius: 7px;
    background: #f7f7ff;
    color: var(--accent);
}

.sidebar-favorites-button.has-favorites .sidebar-favorites-icon {
    background: #fff1f2;
    color: #e11d48;
}

.sidebar-favorites-button.has-favorites .sidebar-favorites-icon .material-symbols-outlined {
    font-variation-settings: 'FILL' 1, 'wght' 650, 'GRAD' 0, 'opsz' 24;
}

.sidebar-favorites-count {
    display: inline-flex;
    min-width: 24px;
    height: 24px;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    background: #171719;
    padding: 0 7px;
    color: #fff;
    font-size: 11px;
    font-weight: 900;
}

.sidebar-favorites-panel {
    left: calc(100% + 10px);
    right: auto;
    top: 0;
    width: min(360px, calc(100vw - 260px));
}

.sidebar-favorites-list {
    display: grid;
    max-height: 340px;
    gap: 6px;
    overflow-y: auto;
    padding: 8px;
}

.sidebar-favorite-item {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto auto;
    align-items: center;
    gap: 8px;
    border: 1px solid #e3e3e8;
    border-radius: 8px;
    background: #fff;
    padding: 8px;
}

.sidebar-favorite-main {
    display: block;
    min-width: 0;
}

.sidebar-favorite-main span,
.sidebar-favorite-main small {
    display: block;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.sidebar-favorite-main span {
    color: #171719;
    font-size: 12.5px;
    font-weight: 850;
}

.sidebar-favorite-main small {
    margin-top: 2px;
    color: #666675;
    font-size: 10.5px;
    font-weight: 700;
}

.sidebar-favorite-item .voice-preview-button,
.sidebar-favorite-item .icon-button {
    min-width: 30px;
    height: 30px;
}

.sidebar-favorite-progress {
    grid-column: 1 / -1;
    display: block;
    height: 3px;
    overflow: hidden;
    border-radius: 999px;
    background: #eeeef3;
}

.sidebar-favorite-progress span {
    display: block;
    width: 0%;
    height: 100%;
    border-radius: inherit;
    background: var(--accent);
    transition: width 120ms linear;
}

.sidebar-favorites-empty {
    display: flex;
    min-height: 92px;
    align-items: center;
    justify-content: center;
    gap: 8px;
    border: 1px dashed #c8c8d2;
    border-radius: 8px;
    color: #666675;
    font-size: 12.5px;
    font-weight: 760;
}

.tool-pill {
    background: transparent;
    color: #666675;
    padding: 8px 10px;
    min-height: 34px;
}

.tool-pill:hover,
.tool-pill-active {
    background: #f1f1f4;
    color: #171719;
}

.sample-card,
.role-card {
    display: flex;
    min-height: 94px;
    cursor: pointer;
    flex-direction: column;
    gap: 6px;
    border: 1px solid #e3e3e8;
    border-radius: 8px;
    background: #fff;
    padding: 12px;
    transition: border-color 160ms ease, background-color 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}

.sample-history-card {
    display: flex;
    min-width: 0;
    cursor: pointer;
    align-items: center;
    gap: 10px;
    border: 1px solid #e3e3e8;
    border-radius: 8px;
    background: #fff;
    padding: 10px;
    transition: border-color 160ms ease, background-color 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}

.sample-history-card:hover,
.sample-history-card.is-active {
    border-color: rgba(var(--accent-rgb), 0.5);
    background: #f7f7ff;
    box-shadow: 0 10px 30px rgba(var(--accent-rgb), 0.08);
}

.sample-history-card:active { transform: scale(0.99); }
.sample-card .material-symbols-outlined,
.role-card .material-symbols-outlined {
    font-size: 18px;
}

.sample-card:hover,
.sample-card.is-active,
.role-card:hover,
.role-card.is-active {
    border-color: rgba(var(--accent-rgb), 0.45);
    background: #f7f7ff;
    box-shadow: 0 10px 30px rgba(var(--accent-rgb), 0.08);
}

.sample-card:active,
.role-card:active { transform: scale(0.99); }

.role-card:has(input:checked) {
    border-color: rgba(var(--accent-rgb), 0.55);
    background: #f7f7ff;
    box-shadow: 0 10px 30px rgba(var(--accent-rgb), 0.08);
}

.role-card-disabled {
    cursor: not-allowed;
    opacity: 0.58;
}

.role-card-disabled:hover {
    border-color: #e3e3e8;
    background: #fff;
    box-shadow: none;
}

.studio-workspace {
    display: grid;
    height: min(680px, calc(100vh - 174px));
    min-height: 560px;
    grid-template-columns: minmax(0, 1fr) minmax(430px, 500px);
    gap: 0;
    overflow: hidden;
}

.studio-compose-pane {
    display: flex;
    min-width: 0;
    min-height: 0;
    flex-direction: column;
    padding-right: 16px;
}

.studio-voice-pane {
    display: flex;
    height: 100%;
    min-width: 0;
    min-height: 0;
    flex-direction: column;
    border-left: 1px solid #e3e3e8;
    padding-left: 16px;
}

.studio-prompt-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding-top: 14px;
}

.studio-expression-panel {
    margin-top: 14px;
}

.studio-expression-heading {
    color: #666675;
    font-size: 12px;
    font-weight: 820;
    text-transform: uppercase;
}

.studio-settings-grid {
    margin-top: 8px;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
}

.studio-summary-grid {
    align-items: start;
}

.studio-preview-panel {
    min-height: 0;
}

.studio-preview-list {
    display: grid;
    max-height: 292px;
    align-content: start;
    gap: 8px;
    overflow-y: auto;
    padding-right: 4px;
}

.studio-generate-bar {
    margin-top: auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    border-top: 1px solid #e3e3e8;
    padding-top: 14px;
}

.studio-generation-context {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    color: #666675;
    font-size: 13px;
    font-weight: 740;
}

.selected-generation-voice {
    display: inline-flex;
    min-height: 28px;
    max-width: min(100%, 340px);
    align-items: center;
    gap: 6px;
    border: 1px solid #dadae5;
    border-radius: 999px;
    background: #fff;
    padding: 4px 8px;
    color: #33333c;
}

.selected-generation-voice strong {
    display: inline-block;
    max-width: 190px;
    overflow: hidden;
    color: #171719;
    font-weight: 900;
    text-overflow: ellipsis;
    vertical-align: bottom;
    white-space: nowrap;
}

.selected-generation-voice.is-empty {
    border-color: #f0c9c9;
    background: #fff8f8;
    color: #9f3434;
}

.speech-text-workspace {
    display: grid;
    grid-template-columns: minmax(400px, 0.78fr) minmax(0, 1.22fr);
    gap: 16px;
    align-items: stretch;
}

.speech-upload-panel,
.speech-result-panel {
    min-width: 0;
    border: 1px solid #e3e3e8;
    border-radius: 8px;
    background: #fff;
    padding: 18px;
}

.speech-panel-heading,
.speech-result-header,
.speech-recorder-header,
.speech-result-toolbar,
.speech-recent-item {
    display: flex;
    align-items: center;
    gap: 12px;
}

.speech-panel-heading,
.speech-result-header,
.speech-recorder-header,
.speech-result-toolbar {
    justify-content: space-between;
}

.speech-result-header > span:not(.speech-status-badge) {
    min-width: 0;
    flex: 1 1 auto;
}

.speech-panel-heading {
    justify-content: flex-start;
}

.speech-panel-heading strong,
.speech-result-header strong,
.speech-recorder-header strong,
.speech-recent-item strong {
    display: block;
    min-width: 0;
    overflow: hidden;
    color: #171719;
    font-weight: 880;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.speech-panel-heading small,
.speech-recorder-header small,
.speech-recent-item small {
    margin-top: 2px;
    display: block;
    min-width: 0;
    overflow: hidden;
    color: #666675;
    font-size: 12px;
    font-weight: 680;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.speech-eyebrow {
    display: block;
    color: #666675;
    font-size: 11px;
    font-weight: 840;
    text-transform: uppercase;
}

.speech-panel-icon,
.speech-upload-icon,
.speech-empty-icon,
.speech-recent-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    border-radius: 8px;
}

.speech-panel-icon {
    height: 40px;
    width: 40px;
    background: var(--accent-soft);
    color: var(--accent);
}

.speech-upload-dropzone {
    min-height: 168px;
    align-items: stretch;
    gap: 8px;
    border-color: #d4d4df;
    background: linear-gradient(180deg, #fbfbfd 0%, #f5f6fb 100%);
    padding: 18px;
}

.speech-upload-icon {
    margin: 0 auto;
    height: 42px;
    width: 42px;
    background: #fff;
    color: var(--accent);
    box-shadow: inset 0 0 0 1px #e3e3e8;
}

.speech-upload-title,
.speech-upload-meta {
    display: block;
    text-align: center;
}

.speech-upload-title {
    color: #171719;
    font-size: 15px;
    font-weight: 880;
}

.speech-upload-meta {
    color: #666675;
    font-size: 12px;
    font-weight: 680;
}

.speech-file-pill {
    margin-top: 8px;
    display: flex;
    min-height: 38px;
    align-items: center;
    gap: 8px;
    overflow: hidden;
    border: 1px solid #e3e3e8;
    border-radius: 8px;
    background: #fff;
    padding: 8px 10px;
    color: #666675;
    text-align: left;
}

.speech-file-pill strong {
    min-width: 0;
    overflow: hidden;
    color: #33333c;
    font-size: 12px;
    font-weight: 780;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.speech-recorder-card {
    margin-top: 12px;
    display: grid;
    gap: 12px;
    overflow: hidden;
    border: 1px solid #e3e3e8;
    border-radius: 8px;
    background: #f8f8fa;
    padding: 12px;
}

.speech-recorder-header {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    align-items: start;
    gap: 8px;
}

.speech-record-status,
.speech-status-badge {
    display: inline-flex;
    max-width: 100%;
    flex: 0 0 auto;
    min-height: 28px;
    align-items: center;
    border-radius: 999px;
    background: #fff;
    padding: 5px 9px;
    color: #666675;
    font-size: 11px;
    font-weight: 820;
    line-height: 1.25;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.speech-record-status {
    justify-self: start;
    max-width: 100%;
    white-space: normal;
}

.speech-record-status.is-recording {
    background: #fef2f2;
    color: #b42318;
}

.speech-record-status.is-attached {
    background: #ecfdf5;
    color: #047857;
}

.speech-status-completed {
    background: #ecfdf5;
    color: #047857;
}

.speech-status-failed {
    background: #fef2f2;
    color: #b42318;
}

.speech-record-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
}

.speech-record-actions .secondary-button {
    justify-content: center;
}

.speech-record-actions [data-record-start].is-recording {
    border-color: #dc2626;
    background: #dc2626;
    color: #fff;
    animation: speech-record-pulse 820ms ease-in-out infinite;
}

.speech-record-actions [data-record-stop].is-stop-cue {
    border-color: #dc2626;
    color: #dc2626;
    animation: speech-stop-cue-pulse 820ms ease-in-out infinite;
}

.speech-record-preview {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    height: 42px;
}

@keyframes speech-record-pulse {
    0%, 100% {
        box-shadow: 0 0 0 0 rgba(220, 38, 38, 0.32);
        transform: translateZ(0) scale(1);
    }

    50% {
        box-shadow: 0 0 0 7px rgba(220, 38, 38, 0);
        transform: translateZ(0) scale(0.985);
    }
}

@keyframes speech-stop-cue-pulse {
    0%, 100% {
        background: #fff;
        box-shadow: 0 0 0 0 rgba(220, 38, 38, 0.26);
    }

    50% {
        background: #fef2f2;
        box-shadow: 0 0 0 6px rgba(220, 38, 38, 0);
    }
}

.speech-submit-row {
    margin-top: 12px;
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(150px, auto);
    gap: 10px;
    align-items: end;
}

.speech-result-panel {
    display: flex;
    min-height: min(560px, calc(100vh - 220px));
    flex-direction: column;
}

.speech-result-toolbar {
    margin-top: 14px;
    color: #666675;
    font-size: 12px;
    font-weight: 760;
}

.speech-transcript-output {
    margin-top: 14px;
    min-height: 300px;
    flex: 1;
    width: 100%;
    resize: vertical;
    border: 1px solid #e3e3e8;
    border-radius: 8px;
    background: #fbfbfd;
    padding: 14px;
    color: #171719;
    font-size: 14px;
    font-weight: 560;
    line-height: 1.6;
}

.speech-metric-card {
    min-width: 0;
    border: 1px solid #e3e3e8;
    border-radius: 8px;
    background: #f8f8fa;
    padding: 12px;
}

.speech-failed-state {
    margin-top: 14px;
    display: flex;
    min-height: 180px;
    align-items: center;
    justify-content: center;
    gap: 8px;
    border: 1px solid #fecaca;
    border-radius: 8px;
    background: #fef2f2;
    padding: 18px;
    color: #b42318;
    text-align: center;
    font-size: 13px;
}

.speech-empty-result {
    margin-top: 14px;
    display: flex;
    min-height: 320px;
    flex: 1;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 7px;
    border: 1px dashed #e3e3e8;
    border-radius: 8px;
    background: #fbfbfd;
    color: #666675;
    padding: 18px;
    text-align: center;
    font-size: 13px;
    font-weight: 680;
}

.speech-empty-result strong {
    color: #171719;
    font-size: 15px;
    font-weight: 880;
}

.speech-empty-icon {
    height: 44px;
    width: 44px;
    background: #f1f1f4;
    color: var(--accent);
}

.speech-recent-panel {
    padding: 16px;
}

.speech-recent-list {
    display: grid;
    gap: 8px;
}

.speech-recent-item {
    min-width: 0;
    border: 1px solid #e3e3e8;
    border-radius: 8px;
    background: #fff;
    padding: 10px 12px;
    color: inherit;
}

.speech-recent-item:hover {
    border-color: rgba(var(--accent-rgb), 0.38);
    background: #f8f8fa;
}

.speech-recent-icon {
    height: 32px;
    width: 32px;
    background: #f1f1f4;
    color: var(--accent);
}

.clone-voice-workspace {
    display: grid;
    grid-template-columns: minmax(360px, 0.82fr) minmax(0, 1.18fr);
    gap: 16px;
    align-items: stretch;
}

.clone-sample-panel,
.clone-script-panel {
    min-width: 0;
}

.clone-script-panel {
    min-height: min(620px, calc(100vh - 190px));
}

.clone-textarea {
    margin-top: 14px;
    min-height: clamp(280px, 38vh, 420px);
}

.image-generation-workspace {
    display: grid;
    grid-template-columns: minmax(400px, 0.9fr) minmax(0, 1.1fr);
    gap: 16px;
    align-items: stretch;
}

.image-generation-form,
.image-preview-panel {
    display: flex;
    min-width: 0;
    flex-direction: column;
}

.image-generation-head,
.image-render-heading,
.image-generation-context,
.image-result-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.image-generation-head {
    padding-bottom: 14px;
    border-bottom: 1px solid #e3e3e8;
}

.image-generation-head strong {
    display: block;
    overflow: hidden;
    color: #171719;
    font-weight: 900;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.image-generation-head small {
    display: block;
    margin-top: 2px;
    overflow: hidden;
    color: #666675;
    font-size: 12px;
    font-weight: 680;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.image-generation-icon {
    display: inline-flex;
    height: 42px;
    width: 42px;
    flex: 0 0 auto;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    background: linear-gradient(135deg, var(--accent) 0%, var(--accent) 100%);
    color: #fff;
}

.image-generation-icon .material-symbols-outlined {
    font-size: 23px;
}

.image-model-pill {
    display: inline-flex;
    min-height: 28px;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    background: var(--accent-soft);
    padding: 4px 9px;
    color: var(--accent);
    font-size: 11px;
    font-weight: 900;
}

.image-prompt-label {
    display: block;
}

.image-generation-form textarea.form-control {
    min-height: clamp(210px, 29vh, 330px);
    resize: vertical;
    border-color: #dadae5;
    background: #fbfbfd;
    font-size: 14px;
    line-height: 1.55;
}

.image-generation-form textarea.form-control:focus {
    background: #fff;
}

.image-prompt-row {
    padding-top: 10px;
}

.image-render-panel {
    border: 1px solid #e3e3e8;
    border-radius: 8px;
    background: #f8f8fa;
    padding: 12px;
}

.image-render-heading {
    justify-content: space-between;
}

.image-render-heading span {
    color: #666675;
    font-size: 11px;
    font-weight: 800;
}

.image-settings-grid {
    margin-top: 10px;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
}

.image-settings-grid .control-label {
    border: 1px solid #e3e3e8;
    border-radius: 8px;
    background: #fff;
    padding: 9px;
}

.image-enhance-toggle {
    position: relative;
    margin-top: 10px;
    display: inline-flex;
    width: 100%;
    min-height: 42px;
    box-sizing: border-box;
    flex: 0 0 auto;
    align-items: center;
    gap: 9px;
    border: 1px solid #e3e3e8;
    border-radius: 8px;
    background: #fff;
    padding: 9px 10px;
    color: #171719;
    font-size: 13px;
    font-weight: 800;
    line-height: 1.2;
}

.image-enhance-toggle + .image-enhance-toggle {
    margin-top: 8px;
}

.image-enhance-toggle input,
.image-enhance-toggle input[type='checkbox'].form-control {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    min-height: 0;
    padding: 0;
}

.image-toggle-ui {
    position: relative;
    display: inline-flex;
    height: 22px;
    width: 40px;
    min-width: 40px;
    box-sizing: border-box;
    flex: 0 0 auto;
    align-items: center;
    border-radius: 999px;
    background: #dadae5;
    padding: 2px;
    transition: background-color 160ms ease;
}

.image-toggle-ui span {
    display: block;
    height: 18px;
    width: 18px;
    flex: 0 0 18px;
    border-radius: 999px;
    background: #fff;
    box-shadow: 0 1px 3px rgba(17, 17, 24, 0.22);
    transition: transform 160ms ease;
}

.image-enhance-toggle input:checked + .image-toggle-ui {
    background: var(--accent);
}

.image-enhance-toggle input:checked + .image-toggle-ui span {
    transform: translateX(18px);
}

.image-generation-context {
    flex-wrap: wrap;
    color: #666675;
    font-size: 12px;
    font-weight: 760;
}

.image-generation-context span {
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.image-generation-context .material-symbols-outlined {
    color: var(--accent);
    font-size: 17px;
}

.image-preview-panel {
    min-height: min(660px, calc(100vh - 182px));
}

.image-preview-header {
    padding-bottom: 14px;
    border-bottom: 1px solid #e3e3e8;
}

.image-preview-stage {
    display: flex;
    min-height: 360px;
    flex: 1 1 auto;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    border: 1px solid #e3e3e8;
    border-radius: 8px;
    background:
        linear-gradient(45deg, rgba(var(--accent-rgb), 0.06) 25%, transparent 25%, transparent 75%, rgba(var(--accent-rgb), 0.06) 75%),
        linear-gradient(45deg, rgba(var(--accent-rgb), 0.06) 25%, transparent 25%, transparent 75%, rgba(var(--accent-rgb), 0.06) 75%),
        #f8f8fa;
    background-position: 0 0, 12px 12px;
    background-size: 24px 24px;
    padding: 12px;
}

.image-preview-output {
    display: block;
    max-height: min(560px, calc(100vh - 315px));
    max-width: 100%;
    border-radius: 6px;
    object-fit: contain;
    box-shadow: 0 18px 44px rgba(17, 17, 24, 0.14);
}

.image-meta-grid {
    margin-top: 12px;
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 8px;
}

.image-result-actions {
    margin-top: 12px;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.image-empty-result {
    flex: 1 1 auto;
    min-height: 360px;
    justify-content: center;
    background:
        linear-gradient(180deg, rgba(var(--accent-rgb), 0.05), rgba(var(--accent-rgb), 0.05)),
        #f8f8fa;
}

.image-recent-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
}

.image-recent-card {
    display: block;
    min-width: 0;
    border: 1px solid #e3e3e8;
    border-radius: 8px;
    background: #fff;
    padding: 10px;
    color: inherit;
    transition: border-color 160ms ease, background-color 160ms ease, transform 160ms ease, box-shadow 160ms ease;
}

.image-recent-card:hover {
    border-color: rgba(var(--accent-rgb), 0.48);
    background: #fbfbfd;
    box-shadow: 0 12px 28px rgba(17, 17, 24, 0.08);
    transform: translateY(-1px);
}

.image-recent-thumb,
.image-recent-placeholder {
    display: flex;
    width: 100%;
    aspect-ratio: 16 / 9;
    margin-bottom: 10px;
    align-items: center;
    justify-content: center;
    border-radius: 7px;
    background: #f1f1f4;
    color: #666675;
}

.image-recent-thumb {
    display: block;
    object-fit: cover;
}

.avatar-page-panel {
    display: flex;
    flex: 1 1 auto;
    flex-direction: column;
    background: linear-gradient(180deg, #fff 0%, #fbfcff 100%);
}

.avatar-workspace {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(360px, 0.58fr);
    gap: 16px;
    flex: 1 1 auto;
    align-items: stretch;
    background: #fff;
}

.avatar-builder,
.avatar-result-panel {
    min-width: 0;
    border: 1px solid #e3e3e8;
    border-radius: 8px;
    background: #fff;
    padding: 16px;
}

.avatar-builder {
    display: grid;
    align-content: start;
    gap: 14px;
}

.avatar-result-panel {
    position: sticky;
    top: 16px;
    display: flex;
    min-height: 560px;
    flex-direction: column;
}

.avatar-native-fields {
    display: none;
}

.avatar-builder-head,
.avatar-step-heading,
.avatar-generate-bar,
.avatar-selected-strip,
.avatar-audio-card,
.avatar-audio-select,
.avatar-source-tabs {
    display: flex;
    align-items: center;
}

.avatar-builder-head {
    gap: 12px;
    border-bottom: 1px solid #e3e3e8;
    padding-bottom: 14px;
}

.avatar-builder-head strong {
    display: block;
    overflow: hidden;
    color: #171719;
    font-weight: 900;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.avatar-builder-head small {
    display: block;
    margin-top: 2px;
    overflow: hidden;
    color: #666675;
    font-size: 12px;
    font-weight: 680;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.avatar-builder-icon,
.avatar-step-number,
.avatar-audio-icon,
.avatar-empty-frame {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
}

.avatar-builder-icon {
    height: 42px;
    width: 42px;
    border-radius: 8px;
    background: linear-gradient(135deg, var(--accent) 0%, var(--accent) 100%);
    color: #fff;
}

.avatar-builder-icon .material-symbols-outlined {
    font-size: 23px;
}

.avatar-builder-model {
    border-radius: 999px;
    background: var(--accent-soft);
    padding: 5px 9px;
    color: var(--accent);
    font-size: 11px;
    font-weight: 900;
}

.avatar-step-card {
    border: 1px solid #e3e3e8;
    border-radius: 8px;
    background: #f8f8fa;
    padding: 13px;
}

.avatar-step-heading {
    gap: 10px;
}

.avatar-step-heading strong,
.avatar-audio-card strong,
.avatar-empty-choice strong {
    display: block;
    color: #171719;
    font-size: 13px;
    font-weight: 880;
}

.avatar-step-heading small,
.avatar-audio-card small {
    display: block;
    margin-top: 2px;
    overflow: hidden;
    color: #666675;
    font-size: 12px;
    font-weight: 650;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.avatar-step-number {
    height: 28px;
    width: 28px;
    border-radius: 999px;
    background: #171719;
    color: #fff;
    font-size: 12px;
    font-weight: 900;
}

.avatar-source-tabs {
    margin-top: 12px;
    gap: 8px;
    border-radius: 8px;
    background: #fff;
    padding: 4px;
}

.avatar-source-tab {
    display: inline-flex;
    min-height: 38px;
    flex: 1 1 0;
    cursor: pointer;
    align-items: center;
    justify-content: center;
    gap: 7px;
    border-radius: 6px;
    color: #666675;
    font-size: 12px;
    font-weight: 820;
    transition: background-color 160ms ease, color 160ms ease, box-shadow 160ms ease;
}

.avatar-source-tab:hover,
.avatar-source-tab.is-active {
    background: #171719;
    color: #fff;
    box-shadow: 0 8px 22px rgba(17, 17, 24, 0.13);
}

.avatar-choice-panel {
    margin-top: 12px;
    min-height: 150px;
}

.avatar-choice-panel[data-avatar-image-panel='library'] {
    display: flex;
    flex-direction: column;
    gap: 10px;
    min-height: 220px;
}

.avatar-choice-panel.hidden {
    display: none;
}

.avatar-audio-list {
    display: grid;
    max-height: 300px;
    gap: 8px;
    overflow-y: auto;
    padding-right: 3px;
}

.avatar-audio-card {
    gap: 8px;
    border: 1px solid #e3e3e8;
    border-radius: 8px;
    background: #fff;
    padding: 8px;
    transition: border-color 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}

.avatar-audio-card:hover,
.avatar-audio-card.is-active,
.avatar-profile-card:hover,
.avatar-profile-card.is-active {
    border-color: rgba(var(--accent-rgb), 0.5);
    box-shadow: 0 10px 24px rgba(17, 17, 24, 0.08);
}

.avatar-audio-card.is-active,
.avatar-profile-card.is-active {
    outline: 3px solid rgba(var(--accent-rgb), 0.5);
    outline-offset: 2px;
}

.avatar-audio-select {
    min-width: 0;
    flex: 1 1 auto;
    gap: 10px;
    border: 0;
    background: transparent;
    padding: 0;
    color: inherit;
}

.avatar-audio-icon {
    height: 36px;
    width: 36px;
    border-radius: 8px;
    background: var(--accent-soft);
    color: var(--accent);
}

.avatar-profile-grid {
    display: grid;
    max-height: 560px;
    overflow-y: auto;
    padding: 2px 4px 2px 2px;
    width: 100%;
    align-items: stretch;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    grid-auto-rows: minmax(188px, auto);
    gap: 10px;
    scroll-behavior: smooth;
}

.avatar-library-toolbar,
.avatar-filter-pills,
.avatar-library-pagination {
    display: flex;
    align-items: center;
}

.avatar-library-toolbar {
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 10px;
}

.avatar-search-field {
    display: inline-flex;
    min-height: 34px;
    min-width: min(100%, 220px);
    flex: 1 1 220px;
    align-items: center;
    gap: 7px;
    border: 1px solid #e3e3e8;
    border-radius: 999px;
    background: #fff;
    padding: 0 11px;
    color: #666675;
}

.avatar-search-field .material-symbols-outlined {
    flex: 0 0 auto;
    font-size: 18px;
}

.avatar-search-field input {
    min-width: 0;
    width: 100%;
    border: 0;
    background: transparent;
    color: #171719;
    font-size: 12px;
    font-weight: 760;
    outline: 0;
}

.avatar-search-field input::placeholder {
    color: #888897;
}

.avatar-filter-pills,
.avatar-library-pagination {
    flex-wrap: wrap;
    gap: 6px;
}

.avatar-filter-pill,
.avatar-page-link,
.avatar-library-count,
.avatar-page-ellipsis {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 850;
}

.avatar-filter-pill {
    min-height: 32px;
    border: 1px solid #e3e3e8;
    background: #fff;
    padding: 0 12px;
    color: #666675;
    transition: background-color 160ms ease, border-color 160ms ease, color 160ms ease, box-shadow 160ms ease;
}

.avatar-filter-pill:hover,
.avatar-filter-pill.is-active {
    border-color: #171719;
    background: #171719;
    color: #fff;
    box-shadow: 0 8px 22px rgba(17, 17, 24, 0.13);
}

.avatar-library-count {
    min-height: 30px;
    flex: 0 0 auto;
    background: #f1f5f9;
    padding: 0 10px;
    color: #334155;
}

.avatar-library-pagination {
    justify-content: center;
    border-top: 1px solid #e3e3e8;
    padding-top: 10px;
}

.avatar-page-link,
.avatar-page-ellipsis {
    min-height: 30px;
    min-width: 30px;
    color: #666675;
}

.avatar-page-link {
    border: 1px solid #e3e3e8;
    background: #fff;
    transition: background-color 160ms ease, border-color 160ms ease, color 160ms ease;
}

.avatar-page-link:hover,
.avatar-page-link.is-active {
    border-color: var(--accent);
    background: var(--accent-soft);
    color: var(--accent);
}

.avatar-page-link.is-disabled {
    cursor: not-allowed;
    opacity: 0.45;
}

.avatar-page-link .material-symbols-outlined {
    font-size: 18px;
}

.avatar-profile-card {
    position: relative;
    display: flex;
    min-width: 0;
    min-height: 188px;
    appearance: none;
    flex-direction: column;
    align-items: stretch;
    gap: 7px;
    overflow: hidden;
    cursor: pointer;
    border: 1px solid #e3e3e8;
    border-radius: 8px;
    background: #fff;
    padding: 8px;
    color: inherit;
    font: inherit;
    line-height: 1.2;
    text-align: left;
    transition: border-color 160ms ease, background-color 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}

.avatar-profile-card::after {
    position: absolute;
    top: 8px;
    right: 8px;
    display: inline-flex;
    height: 28px;
    width: 28px;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    background: var(--accent);
    color: var(--on-accent);
    content: "check";
    font-family: 'Material Symbols Outlined';
    font-size: 18px;
    font-variation-settings: 'FILL' 0, 'wght' 700, 'GRAD' 0, 'opsz' 20;
    line-height: 1;
    opacity: 0;
    transform: scale(0.78);
    transition: opacity 160ms ease, transform 160ms ease;
}

.avatar-profile-card.is-active {
    border-color: rgba(var(--accent-rgb), 0.78);
    background: linear-gradient(180deg, rgba(var(--accent-rgb), 0.1), rgba(var(--accent-rgb), 0.045)), #fff;
    box-shadow: 0 16px 34px rgba(var(--accent-rgb), 0.16);
    transform: translateY(-1px);
}

.avatar-profile-card.is-active::after {
    opacity: 1;
    transform: scale(1);
}

.avatar-profile-card.is-active .avatar-profile-thumb {
    box-shadow: 0 0 0 3px rgba(var(--accent-rgb), 0.25);
}

.avatar-profile-card.is-active .avatar-profile-name {
    color: var(--accent);
}

.avatar-profile-thumb {
    display: block;
    flex: 1 1 auto;
    overflow: hidden;
    width: 100%;
    min-height: 132px;
    height: clamp(132px, 16vw, 160px);
    border-radius: 7px;
    background: #f1f1f4;
}

.avatar-profile-thumb img {
    display: block;
    height: 100%;
    width: 100%;
    object-fit: cover;
}

.avatar-profile-name {
    display: block;
    flex: 0 0 auto;
    min-height: 18px;
    overflow: hidden;
    color: #171719;
    font-size: 12px;
    font-weight: 850;
    line-height: 1.25;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.avatar-empty-choice {
    display: flex;
    min-height: 118px;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    border: 1px dashed #c8c8d2;
    border-radius: 8px;
    background: #fff;
    color: #666675;
    padding: 16px;
    text-align: center;
}

.avatar-profile-grid .avatar-empty-choice {
    grid-column: 1 / -1;
    min-height: 220px;
}

.avatar-load-state {
    display: contents;
}

.avatar-load-state.hidden {
    display: none;
}

.avatar-load-sentinel {
    grid-column: 1 / -1;
    height: 1px;
}

.avatar-profile-skeleton {
    cursor: default;
    pointer-events: none;
}

.avatar-skeleton-thumb {
    display: block;
    width: 100%;
    aspect-ratio: 4 / 5;
    border-radius: 7px;
}

.avatar-skeleton-name {
    display: block;
    height: 13px;
    margin-top: 9px;
    width: 72%;
}

.avatar-load-more {
    align-self: center;
    justify-content: center;
}

.avatar-upload-layout {
    display: grid;
    grid-template-columns: minmax(0, 0.95fr) minmax(220px, 0.7fr);
    gap: 12px;
    align-items: stretch;
}

.avatar-upload-dropzone {
    min-height: 220px;
    border-color: rgba(var(--accent-rgb), 0.28);
    background:
        linear-gradient(180deg, rgba(var(--accent-rgb), 0.045), rgba(var(--accent-rgb), 0.055)),
        #fff;
}

.avatar-image-dropzone.has-file {
    border-color: rgba(var(--accent-rgb), 0.55);
    background:
        linear-gradient(180deg, rgba(var(--accent-rgb), 0.08), rgba(var(--accent-rgb), 0.045)),
        #fff;
    box-shadow: 0 12px 28px rgba(var(--accent-rgb), 0.08);
}

.avatar-upload-preview {
    position: relative;
    display: flex;
    min-height: 220px;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    border: 1px solid #e3e3e8;
    border-radius: 8px;
    background:
        linear-gradient(135deg, rgba(var(--accent-rgb), 0.07), rgba(var(--accent-rgb), 0.08)),
        #fff;
}

.avatar-upload-preview img {
    display: block;
    height: 100%;
    width: 100%;
    object-fit: cover;
}

.avatar-upload-preview img[hidden],
.avatar-upload-preview img.hidden {
    display: none;
}

.avatar-upload-preview.has-image {
    border-color: rgba(var(--accent-rgb), 0.4);
    background: #0a0a0c;
    box-shadow: 0 14px 30px rgba(17, 17, 24, 0.1);
}

.avatar-upload-preview-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 7px;
    padding: 18px;
    color: #666675;
    text-align: center;
}

.avatar-upload-preview-empty .material-symbols-outlined {
    display: inline-flex;
    height: 48px;
    width: 48px;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    background: var(--accent-soft);
    color: var(--accent);
    font-size: 25px;
}

.avatar-upload-preview-empty strong {
    color: #171719;
    font-size: 13px;
    font-weight: 900;
}

.avatar-upload-preview-empty small {
    max-width: 190px;
    color: #666675;
    font-size: 12px;
    font-weight: 650;
}

.avatar-prompt-label textarea.form-control {
    min-height: 92px;
    resize: vertical;
}

.avatar-settings-grid {
    margin-top: 10px;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 9px;
}

.avatar-settings-grid .control-label {
    border: 1px solid #e3e3e8;
    border-radius: 8px;
    background: #fff;
    padding: 9px;
}

.avatar-generate-bar {
    justify-content: space-between;
    gap: 12px;
    border: 1px solid #e3e3e8;
    border-radius: 8px;
    background: #fff;
    padding: 12px;
}

.avatar-selected-strip {
    min-width: 0;
    flex-wrap: wrap;
    gap: 8px;
}

.avatar-selected-strip > span {
    display: inline-flex;
    min-width: 0;
    max-width: 280px;
    align-items: center;
    gap: 6px;
    border-radius: 999px;
    background: #f1f5f9;
    padding: 6px 9px;
    color: #334155;
    font-size: 12px;
    font-weight: 780;
}

.avatar-selected-strip strong {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.avatar-result-header {
    border-bottom: 1px solid #e3e3e8;
    padding-bottom: 12px;
}

.avatar-video-stage,
.avatar-empty-result {
    overflow: hidden;
    border: 1px solid #e3e3e8;
    border-radius: 8px;
    background: #0a0a0c;
}

.avatar-video-stage {
    aspect-ratio: 16 / 9;
}

.avatar-video-stage video {
    display: block;
    height: 100%;
    width: 100%;
    object-fit: contain;
}

.avatar-empty-result {
    display: flex;
    min-height: 420px;
    flex: 1 1 auto;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    background:
        linear-gradient(135deg, rgba(var(--accent-rgb), 0.08), rgba(var(--accent-rgb), 0.08)),
        #f8f8fa;
    color: #666675;
    text-align: center;
}

.avatar-empty-result strong {
    color: #171719;
    font-size: 15px;
    font-weight: 900;
}

.avatar-empty-frame {
    height: 72px;
    width: 72px;
    border-radius: 999px;
    background: #fff;
    color: var(--accent);
    box-shadow: inset 0 0 0 1px #e3e3e8;
}

.avatar-empty-frame .material-symbols-outlined {
    font-size: 32px;
}

@media (max-width: 1180px) {
    .avatar-workspace {
        grid-template-columns: 1fr;
    }

    .avatar-result-panel {
        position: static;
        min-height: 440px;
    }
}

@media (max-width: 760px) {
    .avatar-profile-grid,
    .avatar-settings-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .avatar-upload-layout {
        grid-template-columns: 1fr;
    }

    .avatar-generate-bar {
        align-items: stretch;
        flex-direction: column;
    }

    .avatar-generate-bar .primary-button {
        width: 100%;
    }
}

.clone-saved-samples {
    display: grid;
    max-height: 276px;
    gap: 8px;
    overflow-y: auto;
    padding-right: 4px;
}

.clone-sample-item {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 74px 34px 34px 34px;
    align-items: center;
    gap: 7px;
    overflow: visible;
}

.clone-sample-item:has(input:checked) {
    border-color: rgba(var(--accent-rgb), 0.5);
    background: #f7f7ff;
    box-shadow: 0 10px 30px rgba(var(--accent-rgb), 0.08);
}

.clone-sample-choice {
    display: grid;
    grid-column: 1;
    grid-row: 1;
    min-width: 0;
    cursor: pointer;
    grid-template-columns: auto minmax(0, 1fr);
    align-items: center;
    gap: 10px;
}

.clone-sample-item > .voice-preview-inline {
    grid-column: 2;
    grid-row: 1;
}

.clone-sample-item > .voice-preview-button {
    grid-column: 3;
    grid-row: 1;
}

.clone-sample-action {
    min-height: 34px;
    width: 34px;
    height: 34px;
    padding: 0;
}

.clone-sample-item > [data-sample-rename-toggle] {
    grid-column: 4;
    grid-row: 1;
}

.clone-sample-action .material-symbols-outlined {
    font-size: 18px;
}

.clone-sample-delete {
    grid-column: 5;
    grid-row: 1;
}

.clone-sample-delete:hover {
    border-color: rgba(220, 38, 38, 0.25);
    background: #fef2f2;
    color: #dc2626;
}

.clone-sample-item > [data-sample-rename-toggle][aria-expanded='true'] {
    border-color: rgba(var(--accent-rgb), 0.35);
    background: var(--accent-soft);
    color: var(--accent);
}

.clone-sample-rename-panel {
    grid-column: 1 / -1;
    display: grid;
    width: 100%;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px;
    border: 1px solid #e3e3e8;
    border-radius: 8px;
    background: #f8f8fa;
    padding: 8px;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.7);
}

.clone-sample-rename-panel.hidden {
    display: none;
}

.clone-sample-rename-panel .form-control,
.clone-sample-rename-panel .secondary-button {
    min-height: 34px;
}

.history-workspace {
    display: grid;
    gap: 16px;
    align-items: start;
}

.history-panel {
    min-width: 0;
}

.voice-picker {
    display: flex;
    height: 100%;
    overflow: hidden;
    flex-direction: column;
    border: 1px solid #e3e3e8;
    border-radius: 8px;
    background: #f8f8fa;
    padding: 10px;
}

.voice-picker-header,
.voice-section-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.voice-count-pill,
.voice-tab-count {
    display: inline-flex;
    min-height: 24px;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    background: #fff;
    padding: 3px 8px;
    color: #666675;
    font-size: 11px;
    font-weight: 820;
}

.voice-tabs {
    margin-top: 10px;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 4px;
    border: 1px solid #e3e3e8;
    border-radius: 8px;
    background: #fff;
    padding: 3px;
}

.selected-voice-card {
    margin-top: 10px;
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    align-items: center;
    gap: 9px;
    border: 1px solid rgba(var(--accent-rgb), 0.28);
    border-radius: 8px;
    background: #fff;
    padding: 9px;
    box-shadow: 0 10px 28px rgba(var(--accent-rgb), 0.08);
}

.selected-voice-card.is-empty {
    border-color: #e7d4d4;
    box-shadow: none;
}

.selected-voice-card-icon {
    display: inline-flex;
    height: 34px;
    width: 34px;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    background: #f7f7ff;
    color: var(--accent);
}

.selected-voice-card-main {
    display: block;
    min-width: 0;
}

.selected-voice-eyebrow,
.selected-voice-card-main strong,
.selected-voice-card-main small {
    display: block;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.selected-voice-eyebrow {
    color: #666675;
    font-size: 10px;
    font-weight: 900;
    text-transform: uppercase;
}

.selected-voice-card-main strong {
    margin-top: 1px;
    color: #171719;
    font-size: 13px;
    font-weight: 900;
}

.selected-voice-card-main small {
    margin-top: 2px;
    color: #666675;
    font-size: 11px;
    font-weight: 700;
}

.voice-tab {
    display: inline-flex;
    min-height: 34px;
    cursor: pointer;
    align-items: center;
    justify-content: center;
    gap: 7px;
    border-radius: 6px;
    color: #666675;
    font-size: 12.5px;
    font-weight: 800;
    transition: background-color 160ms ease, color 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}

.voice-tab:hover,
.voice-tab.is-active {
    background: #171719;
    color: #fff;
    box-shadow: 0 7px 18px rgba(17, 17, 24, 0.1);
}

.voice-tab.is-active .voice-tab-count {
    background: rgba(255, 255, 255, 0.16);
    color: #fff;
}

.voice-tab:active { transform: scale(0.99); }

.voice-tab-panel {
    margin-top: 10px;
    min-height: 0;
}

.studio-voice-pane .voice-tab-panel:not(.hidden) {
    display: flex;
    min-height: 0;
    flex: 1;
    flex-direction: column;
}

.voice-filter-bar,
.voice-capture-card {
    border: 1px solid #e3e3e8;
    border-radius: 8px;
    background: #fff;
    padding: 10px;
}

.voice-filter-header {
    display: flex;
    width: 100%;
    min-height: 24px;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.voice-filter-title {
    min-width: 0;
    flex: 1 1 auto;
}

.voice-filter-clear {
    display: inline-flex;
    flex: 0 0 auto;
    margin-left: auto;
    min-height: 24px;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    background: #f7f7ff;
    padding: 3px 9px;
    color: var(--accent);
    font-size: 11px;
    font-weight: 900;
}

.voice-filter-grid {
    margin-top: 8px;
    display: grid;
    grid-template-columns: minmax(120px, 0.8fr) minmax(110px, 0.7fr) minmax(130px, 0.85fr) auto;
    gap: 7px;
}

.voice-filter-search-row {
    margin-top: 8px;
}

.voice-filter-search-row .form-control {
    width: 100%;
}

.studio-voice-pane .voice-filter-grid {
    grid-template-columns: minmax(0, 1fr) minmax(0, 0.92fr) minmax(0, 1.12fr) 36px;
    gap: 7px;
}

.studio-voice-pane .voice-filter-grid.voice-filter-grid-has-accent {
    grid-template-columns: minmax(0, 0.95fr) minmax(0, 0.88fr) minmax(0, 0.78fr) minmax(0, 1fr) 36px;
}

.studio-voice-pane .voice-filter-grid .secondary-button {
    min-height: 36px;
    min-width: 0;
    padding: 0;
}

.studio-voice-pane .voice-filter-grid .form-control {
    min-height: 36px;
    padding: 6px 9px;
    font-size: 12px;
    font-weight: 760;
}

.studio-voice-pane .voice-filter-search-row .form-control {
    min-height: 36px;
    padding: 6px 10px;
    font-size: 12px;
    font-weight: 760;
}

.studio-voice-pane .voice-filter-grid .voice-filter-button-label {
    display: none;
}

.voice-results {
    margin-top: 8px;
    display: grid;
    align-content: start;
    grid-auto-rows: max-content;
    max-height: 354px;
    gap: 6px;
    overflow-y: auto;
    padding-right: 4px;
}

.studio-voice-pane .voice-results {
    min-height: 0;
    max-height: none;
    flex: 1;
}

.my-voice-results {
    max-height: 268px;
}

.voice-row {
    display: grid;
    min-width: 0;
    min-height: 56px;
    cursor: pointer;
    grid-template-columns: auto minmax(0, 1fr) 82px auto auto;
    align-items: center;
    gap: 8px;
    border: 1px solid #e3e3e8;
    border-radius: 8px;
    background: #fff;
    padding: 8px;
    transition: border-color 160ms ease, background-color 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}

.studio-voice-pane .voice-row {
    grid-template-columns: auto minmax(0, 1fr) 66px 34px 34px;
    align-items: center;
}

.voice-changer-voice-list .voice-row {
    grid-template-columns: auto minmax(0, 1fr) 66px 34px 30px;
}

.voice-changer-voice-list {
    max-height: 260px;
}

.studio-voice-pane .voice-preview-inline {
    grid-column: auto;
    min-width: 0;
    width: 100%;
}

.voice-row:hover,
.voice-row.is-active,
.voice-row:has(input:checked) {
    border-color: rgba(var(--accent-rgb), 0.5);
    background: #f7f7ff;
    box-shadow: 0 10px 30px rgba(var(--accent-rgb), 0.08);
}

.voice-row:active { transform: scale(0.995); }

.voice-row-select {
    position: relative;
    display: inline-flex;
    min-height: 30px;
    width: 30px;
    align-items: center;
    justify-content: center;
    border: 1px solid #dadae5;
    border-radius: 7px;
    background: #fff;
    padding: 0;
    color: #666675;
}

.voice-row-select::after {
    position: absolute;
    left: 9px;
    top: 5px;
    width: 8px;
    height: 14px;
    content: '';
    opacity: 0;
    transform: rotate(45deg) scale(0.86);
    border: solid currentColor;
    border-width: 0 2px 2px 0;
    transition: opacity 140ms ease, transform 140ms ease;
}

.voice-row.is-active .voice-row-select,
.voice-row:has(input:checked) .voice-row-select {
    border-color: #171719;
    background: #171719;
    color: #fff;
}

.voice-row.is-active .voice-row-select::after,
.voice-row:has(input:checked) .voice-row-select::after {
    opacity: 1;
    transform: rotate(45deg) scale(1);
}

.voice-avatar {
    display: inline-flex;
    height: 30px;
    width: 30px;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    background: #f1f1f4;
    color: var(--accent);
}

.voice-row-main {
    display: block;
    min-width: 0;
}

.voice-row-title,
.voice-row-meta,
.voice-row-note {
    display: block;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.voice-row-title {
    color: #171719;
    font-size: 13px;
    font-weight: 840;
}

.voice-row-meta,
.voice-row-note {
    margin-top: 2px;
    color: #666675;
    font-size: 11px;
    font-weight: 680;
}

.voice-tags {
    margin-top: 3px;
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}

.studio-voice-pane .voice-tags {
    display: none;
}

.voice-tags span {
    border-radius: 999px;
    background: #f1f1f4;
    padding: 1px 5px;
    color: #666675;
    font-size: 9.5px;
    font-weight: 820;
}

.voice-preview-inline {
    min-width: 70px;
}

.voice-waveform {
    position: relative;
    display: block;
    height: 18px;
    overflow: hidden;
    border-radius: 5px;
    background: repeating-linear-gradient(90deg, #d9d9e4 0 3px, transparent 3px 7px);
    opacity: 0.9;
}

.voice-waveform::after {
    position: absolute;
    inset: 0;
    content: '';
    background: linear-gradient(180deg, transparent 0 18%, #fff 18% 28%, transparent 28% 46%, #fff 46% 57%, transparent 57% 72%, #fff 72% 82%, transparent 82% 100%);
    opacity: 0.72;
}

.voice-waveform > span {
    position: absolute;
    inset: 0 auto 0 0;
    z-index: 1;
    width: 0;
    border-radius: inherit;
    background: repeating-linear-gradient(90deg, var(--accent) 0 3px, transparent 3px 7px);
    transition: width 120ms linear;
}

.voice-preview-button {
    display: inline-flex;
    min-width: 34px;
    height: 34px;
    align-items: center;
    justify-content: center;
    gap: 0;
    border: 1px solid #e3e3e8;
    border-radius: 999px;
    background: #fff;
    padding: 0;
    color: #33333c;
    font-size: 0;
    font-weight: 800;
    transition: background-color 160ms ease, color 160ms ease, border-color 160ms ease, transform 160ms ease;
}

.voice-preview-button:hover,
.voice-preview-button.is-playing {
    border-color: #171719;
    background: #171719;
    color: #fff;
}

.voice-preview-button:active { transform: scale(0.98); }

.voice-preview-button [data-preview-label] {
    display: none;
}

.voice-empty-state {
    margin-top: 10px;
    display: flex;
    min-height: 118px;
    align-items: center;
    justify-content: center;
    gap: 8px;
    border: 1px dashed #c8c8d2;
    border-radius: 8px;
    background: #fff;
    color: #666675;
    font-size: 13px;
    font-weight: 720;
}

.voice-library-shell {
    display: grid;
    gap: 14px;
}

.voice-library-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 16px;
}

.voice-library-metrics {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 8px;
}

.voice-library-metrics span {
    display: inline-flex;
    min-height: 34px;
    align-items: center;
    gap: 5px;
    border: 1px solid #e3e3e8;
    border-radius: 7px;
    background: #f8f8fa;
    padding: 7px 10px;
    color: #666675;
    font-size: 12px;
    font-weight: 760;
}

.voice-library-metrics strong {
    color: #171719;
    font-weight: 900;
}

.voice-library-section {
    display: grid;
    gap: 10px;
}

.voice-library-section-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    color: #171719;
    font-size: 13px;
    font-weight: 880;
}

.voice-library-section-title a {
    color: var(--accent);
    font-size: 12px;
    font-weight: 800;
}

.voice-explore-panel {
    padding: 12px;
}

.voice-library-filter {
    display: grid;
    gap: 10px;
}

.voice-library-filter-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.voice-library-filter-grid {
    display: grid;
    grid-template-columns: minmax(220px, 1.3fr) repeat(4, minmax(140px, 0.72fr)) auto;
    gap: 8px;
}

.voice-favorite-filter {
    display: inline-flex;
    min-height: 34px;
    cursor: pointer;
    align-items: center;
    gap: 7px;
    border: 1px solid #e3e3e8;
    border-radius: 7px;
    background: #fff;
    padding: 7px 10px;
    color: #33333c;
    font-size: 12.5px;
    font-weight: 780;
}

.voice-favorite-filter input {
    height: 14px;
    width: 14px;
    border-radius: 4px;
    color: var(--accent);
}

.voice-card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(238px, 1fr));
    gap: 10px;
}

.voice-card-grid-compact {
    grid-template-columns: repeat(auto-fill, minmax(218px, 1fr));
}

.voice-library-results {
    margin-top: 12px;
    max-height: min(72vh, 760px);
    overflow-y: auto;
    padding-right: 4px;
}

.voice-card {
    display: grid;
    min-width: 0;
    gap: 10px;
    border: 1px solid #e3e3e8;
    border-radius: 8px;
    background: #fff;
    padding: 12px;
    box-shadow: 0 1px 2px rgba(17, 17, 24, 0.035);
}

.voice-card:hover {
    border-color: rgba(var(--accent-rgb), 0.42);
    box-shadow: 0 12px 28px rgba(var(--accent-rgb), 0.07);
}

.voice-card-topline,
.voice-card-preview,
.voice-card-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.voice-card-topline {
    justify-content: space-between;
}

.voice-card-title {
    min-width: 0;
    overflow: hidden;
    color: #171719;
    font-size: 14px;
    font-weight: 890;
    line-height: 1.25;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.voice-card-title:hover {
    color: var(--accent);
}

.voice-card-meta {
    min-width: 0;
    overflow: hidden;
    color: #666675;
    font-size: 11.5px;
    font-weight: 700;
    line-height: 1.35;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.voice-card-tags {
    display: flex;
    min-height: 20px;
    flex-wrap: wrap;
    gap: 4px;
}

.voice-card-tags span {
    border-radius: 999px;
    background: #f1f1f4;
    padding: 2px 6px;
    color: #666675;
    font-size: 10px;
    font-weight: 820;
}

.voice-card-preview .voice-waveform {
    flex: 1;
}

.voice-card-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
}

.voice-favorite-button.is-active {
    border-color: rgba(225, 29, 72, 0.36);
    background: #fff1f2;
    color: #e11d48;
}

.voice-favorite-button.is-active [data-favorite-icon] {
    color: #e11d48;
    font-variation-settings: 'FILL' 1, 'wght' 650, 'GRAD' 0, 'opsz' 24;
}

.voice-favorite-button:disabled {
    cursor: progress;
    opacity: 0.65;
}

.voice-library-load-state {
    display: contents;
}

.voice-library-load-state.hidden {
    display: none;
}

.voice-card-skeleton,
.voice-card-skeleton:hover {
    border-color: #e3e3e8;
    box-shadow: none;
    pointer-events: none;
}

.voice-load-more {
    grid-column: 1 / -1;
    width: 100%;
}

.voice-load-sentinel {
    grid-column: 1 / -1;
}

.is-shaking {
    animation: ui-shake 420ms ease;
}

@keyframes ui-shake {
    20%, 60% { transform: translateX(-2px); }
    40%, 80% { transform: translateX(2px); }
}

.voice-detail-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(280px, 360px);
    gap: 14px;
    align-items: start;
}

.voice-detail-main,
.voice-detail-side {
    padding: 16px;
}

.voice-detail-main {
    display: grid;
    gap: 18px;
}

.voice-detail-hero {
    display: flex;
    align-items: center;
    gap: 16px;
}

.voice-detail-avatar {
    display: inline-flex;
    height: 64px;
    width: 64px;
    flex: 0 0 auto;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    background: #f1f1f4;
    color: var(--accent);
}

.voice-detail-avatar .material-symbols-outlined {
    font-size: 30px;
}

.voice-detail-player {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 12px;
    align-items: center;
    border: 1px solid #e3e3e8;
    border-radius: 8px;
    background: #f8f8fa;
    padding: 12px;
}

.voice-detail-player .voice-waveform {
    height: 26px;
}

.voice-detail-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.voice-detail-side {
    display: grid;
    gap: 10px;
}

.voice-detail-stat {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    border-bottom: 1px solid #e3e3e8;
    padding-bottom: 10px;
}

.voice-detail-stat span {
    color: #666675;
    font-size: 12px;
    font-weight: 780;
}

.voice-detail-stat strong {
    color: #171719;
    font-size: 13px;
    font-weight: 880;
    text-align: right;
}

.voice-detail-filter-links {
    display: grid;
    gap: 7px;
    padding-top: 4px;
}

.voice-detail-filter-links a {
    display: flex;
    align-items: center;
    justify-content: space-between;
    border: 1px solid #e3e3e8;
    border-radius: 7px;
    padding: 8px 10px;
    color: #33333c;
    font-size: 12.5px;
    font-weight: 780;
}

.voice-detail-filter-links a:hover {
    background: #f1f1f4;
}

.voice-load-state {
    display: grid;
    gap: 6px;
}

.voice-load-state.hidden {
    display: none;
}

.voice-load-sentinel {
    min-height: 1px;
}

.voice-load-more {
    width: 100%;
}

.voice-row-skeleton,
.voice-row-skeleton:hover {
    cursor: default;
    border-color: #e3e3e8;
    background: #fff;
    box-shadow: none;
    pointer-events: none;
    transform: none;
}

.skeleton-block {
    position: relative;
    display: block;
    overflow: hidden;
    border-radius: 999px;
    background: #ececf2;
}

.skeleton-block::after {
    position: absolute;
    inset: 0;
    content: '';
    transform: translateX(-100%);
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.78), transparent);
    animation: voice-skeleton-shimmer 1.2s ease-in-out infinite;
}

.skeleton-avatar {
    height: 30px;
    width: 30px;
}

.skeleton-title {
    height: 12px;
    width: min(78%, 220px);
}

.skeleton-line {
    margin-top: 7px;
    height: 9px;
    width: min(58%, 170px);
}

.skeleton-wave {
    height: 18px;
    width: 100%;
    border-radius: 5px;
}

.skeleton-button {
    height: 34px;
    width: 34px;
}

@keyframes voice-skeleton-shimmer {
    100% {
        transform: translateX(100%);
    }
}

@media (prefers-reduced-motion: reduce) {
    .skeleton-block::after {
        animation: none;
    }
}

.voice-capture-grid {
    margin-top: 10px;
    display: grid;
    gap: 10px;
}

.studio-textarea {
    min-height: 150px;
    width: 100%;
    resize: vertical;
    border: 0;
    border-radius: 8px;
    background: #fff;
    padding: 2px 0 16px;
    font-size: 15.5px;
    line-height: 1.5;
    outline: none;
    transition: box-shadow 160ms ease;
}

.studio-textarea-large {
    min-height: clamp(220px, 34vh, 300px);
    flex: 1;
    padding: 4px 0 18px;
    font-size: 16px;
}

.studio-textarea:focus { box-shadow: none; }

.form-control,
.as-modal-input {
    width: 100%;
    border-radius: 12px;
    border: 1px solid #e3e3e8;
    background-color: #fff;
    color: #171719;
    font-size: 14px;
    font-weight: 500;
    transition: border-color 160ms ease, box-shadow 160ms ease;
    min-height: 42px;
    padding: 0 14px;
    outline: none;
    box-shadow: none;
    --tw-ring-shadow: 0 0 #0000;
    --tw-ring-offset-shadow: 0 0 #0000;
}

select.form-control {
    padding-right: 34px;
}

.search-datalist-control {
    position: relative;
    min-width: 0;
}

.search-datalist-input {
    padding-right: 34px;
}

.search-datalist-input::-webkit-calendar-picker-indicator {
    display: none !important;
    opacity: 0;
}

.search-datalist-icon {
    pointer-events: none;
    position: absolute;
    right: 9px;
    top: 50%;
    transform: translateY(-50%);
    color: #6f717d;
    font-size: 18px;
    line-height: 1;
}

textarea.form-control {
    min-height: 84px;
    padding-top: 10px;
    padding-bottom: 10px;
}

.form-control:focus,
.as-modal-input:focus {
    border-color: rgba(var(--accent-rgb), 0.35);
    box-shadow: 0 0 0 3px rgba(var(--accent-rgb), 0.06);
    outline: none;
}

/* Modal inputs always sit on a dark surface, regardless of theme.
   input[type] selectors + !important guard against Tailwind CDN's
   runtime-injected resets, which land after this stylesheet. */
input.as-modal-input,
.as-modal-input {
    width: 100%;
    min-height: 42px;
    padding: 0 14px;
    font-size: 14px;
    font-weight: 500;
    border: 1px solid rgba(255, 255, 255, 0.14) !important;
    border-radius: 12px !important;
    background: rgba(255, 255, 255, 0.05) !important;
    color: #fff !important;
    outline: none !important;
    box-shadow: none !important;
}
input.as-modal-input:focus,
.as-modal-input:focus,
input.as-modal-input:focus-visible,
.as-modal-input:focus-visible {
    border-color: rgba(255, 255, 255, 0.3) !important;
    outline: none !important;
    box-shadow: none !important;
    --tw-ring-shadow: 0 0 #0000;
    --tw-ring-offset-shadow: 0 0 #0000;
}
.as-modal-input[hidden] { display: none !important; }

/* =============================================================
   Global app modals (rename/delete/confirm) — single source of
   truth for .as-modal* (assets) and .ig-modal* (image/regional).
   ============================================================= */
.as-modal-backdrop,
.ig-modal-backdrop {
    position: fixed;
    inset: 0;
    z-index: 120;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: rgba(0, 0, 0, 0.6);
    -webkit-backdrop-filter: blur(4px);
    backdrop-filter: blur(4px);
    animation: app-modal-fade 160ms ease;
}
.as-modal-backdrop[hidden],
.ig-modal-backdrop[hidden] { display: none !important; }
@keyframes app-modal-fade { from { opacity: 0; } to { opacity: 1; } }

.as-modal,
.ig-modal {
    width: min(420px, 100%);
    border-radius: 16px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    background: #0f0f0f;
    box-shadow: 0 40px 120px rgba(0, 0, 0, 0.6);
    color: #fff;
    animation: app-modal-pop 180ms ease;
}
@keyframes app-modal-pop { from { opacity: 0; transform: translateY(10px) scale(0.98); } to { opacity: 1; transform: none; } }

.as-modal-head,
.ig-modal-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 18px 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}
.as-modal-head h3,
.ig-modal-head h3 { margin: 0; font-size: 15.5px; font-weight: 800; }

.as-modal-x,
.ig-modal-x {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: rgba(255, 255, 255, 0.55);
    cursor: pointer;
}
.as-modal-x:hover,
.ig-modal-x:hover { background: rgba(255, 255, 255, 0.1); color: #fff; }
.as-modal-x .material-symbols-outlined,
.ig-modal-x .material-symbols-outlined { font-size: 19px; }

.as-modal-body,
.ig-modal-body { padding: 16px 18px; }
.as-modal-text,
.ig-modal-text { margin: 0; font-size: 13.5px; font-weight: 500; line-height: 1.5; color: rgba(255, 255, 255, 0.75); }
.as-modal-text[hidden],
.ig-modal-text[hidden] { display: none !important; }

.as-modal-foot,
.ig-modal-foot {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding: 0 18px 16px;
}

.as-modal-btn,
.ig-modal-btn {
    height: 38px;
    padding: 0 16px;
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.06);
    color: #fff;
    font-size: 13.5px;
    font-weight: 700;
    cursor: pointer;
    transition: background 140ms ease, filter 140ms ease;
}
.as-modal-btn:hover,
.ig-modal-btn:hover { background: rgba(255, 255, 255, 0.12); }

.as-modal-btn-primary,
.ig-modal-btn-primary {
    border: 0;
    background: #ffffff;
    color: #0f0f0f;
}
.as-modal-btn-primary:hover,
.ig-modal-btn-primary:hover { filter: brightness(0.92); background: #ffffff; }

.as-modal-btn-danger,
.ig-modal-btn-danger { border: 0; background: #dc2626; color: #fff; }
.as-modal-btn-danger:hover,
.ig-modal-btn-danger:hover { filter: brightness(1.1); background: #dc2626; }

.password-field {
    position: relative;
    display: block;
    margin-top: 7px;
}

.password-field .form-control {
    margin-top: 0;
    padding-right: 42px;
}

.password-toggle {
    position: absolute;
    right: 6px;
    top: 50%;
    z-index: 2;
    display: inline-flex;
    height: 32px;
    width: 32px;
    transform: translateY(-50%);
    align-items: center;
    justify-content: center;
    border-radius: 7px;
    color: #666675;
    transition: background-color 160ms ease, color 160ms ease;
}

.password-toggle:hover {
    background: #f1f1f4;
    color: #171719;
}

.password-toggle .material-symbols-outlined { font-size: 18px; }

input[type='checkbox'].form-control {
    height: 18px;
    width: 18px;
    border-radius: 4px;
}

.field-label,
.control-label {
    display: block;
    color: #33333c;
    font-size: 12px;
    font-weight: 760;
}

.control-label .form-control { margin-top: 7px; }
.field-label .form-control { margin-top: 7px; }

.field-error {
    margin-top: 6px;
    color: #b42318;
    font-size: 12px;
    font-weight: 700;
}

.message {
    display: flex;
    align-items: center;
    gap: 8px;
    border-radius: 8px;
    border: 1px solid #e3e3e8;
    background: #fff;
    padding: 10px 12px;
    font-size: 12.5px;
    font-weight: 750;
}

.message-success { border-color: #bbf7d0; background: #f0fdf4; color: #166534; }
.message-error { border-color: #fecaca; background: #fef2f2; color: #b42318; }

.history-results.is-loading {
    opacity: 0.55;
    pointer-events: none;
}

.upload-dropzone {
    position: relative;
    display: flex;
    min-height: 116px;
    cursor: pointer;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    border: 1px dashed #c8c8d2;
    border-radius: 8px;
    background: #f8f8fa;
    padding: 16px;
    text-align: center;
    transition: border-color 160ms ease, background-color 160ms ease;
}

.upload-dropzone:hover {
    border-color: var(--accent);
    background: #f4f4ff;
}

.upload-dropzone input[type='file'] {
    position: absolute;
    inset: 0;
    cursor: pointer;
    opacity: 0;
}

.floating-player {
    position: fixed;
    bottom: 24px;
    left: 50%;
    z-index: 60;
    display: grid;
    grid-template-columns: 40px minmax(0, 1fr) max-content 28px 28px;
    width: min(92vw, 640px);
    transform: translateX(-50%);
    align-items: center;
    gap: 12px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 24px;
    background: #08080a;
    padding: 10px 12px;
    color: white;
    box-shadow: 0 24px 70px rgba(0, 0, 0, 0.26);
    transition: opacity 220ms ease, transform 220ms ease;
}

.floating-player.translate-y-24 {
    transform: translateX(-50%) translateY(96px) !important;
}

.floating-player.is-visible {
    transform: translateX(-50%) translateY(0) !important;
}

.floating-player-toggle,
.floating-player-action {
    justify-self: center;
    flex: 0 0 auto;
}

.floating-player .floating-player-toggle {
    border: 1px solid rgba(255, 255, 255, 0.82);
    background: #ffffff;
    color: #08080a;
}

.floating-player .floating-player-toggle:hover {
    background: #f4f4f6;
    color: #08080a;
}

html[data-theme='dark'] .floating-player .floating-player-toggle {
    border: 1px solid rgba(var(--accent-rgb), 0.6);
    background: #181820;
    color: #ffffff;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.06), 0 0 0 5px rgba(var(--accent-rgb), 0.18);
}

html[data-theme='dark'] .floating-player .floating-player-toggle:hover {
    background: #232333;
    color: #ffffff;
}

.floating-player-body {
    display: grid;
    min-width: 0;
    gap: 7px;
}

#floating-title {
    display: block;
    max-width: 100%;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    direction: auto;
    unicode-bidi: plaintext;
    line-height: 1.25;
}

.floating-player-time {
    min-width: 54px;
    text-align: right;
    white-space: nowrap;
}

.floating-player.is-visible {
    pointer-events: auto;
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}

.floating-player.is-auto-ready #floating-toggle {
    box-shadow: 0 0 0 5px rgba(var(--accent-rgb), 0.28);
}

[data-floating-progress-track]:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 3px;
}

[data-floating-progress-track] {
    touch-action: none;
    user-select: none;
}

#floating-progress {
    pointer-events: none;
    transition: width 80ms linear;
}

[data-floating-progress-track].is-scrubbing #floating-progress {
    transition: none;
}

.line-clamp-2 {
    display: -webkit-box;
    line-clamp: 2;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

html[data-theme='dark'] .panel,
html[data-theme='dark'] .stat-card,
html[data-theme='dark'] .auth-card,
html[data-theme='dark'] .dashboard-stat-card,
html[data-theme='dark'] .dashboard-flow-step,
html[data-theme='dark'] .dashboard-sample-card,
html[data-theme='dark'] .dashboard-voice-card,
html[data-theme='dark'] .dashboard-empty-card,
html[data-theme='dark'] .dropdown-panel,
html[data-theme='dark'] .sample-card,
html[data-theme='dark'] .sample-history-card,
html[data-theme='dark'] .voice-picker,
html[data-theme='dark'] .voice-tabs,
html[data-theme='dark'] .voice-tab,
html[data-theme='dark'] .voice-row,
html[data-theme='dark'] .voice-filter-bar,
html[data-theme='dark'] .voice-capture-card,
html[data-theme='dark'] .voice-empty-state,
html[data-theme='dark'] .voice-preview-button,
html[data-theme='dark'] .role-card,
html[data-theme='dark'] .speech-upload-panel,
html[data-theme='dark'] .speech-result-panel,
html[data-theme='dark'] .avatar-builder,
html[data-theme='dark'] .avatar-result-panel,
html[data-theme='dark'] .avatar-step-card,
html[data-theme='dark'] .avatar-source-tabs,
html[data-theme='dark'] .avatar-audio-card,
html[data-theme='dark'] .avatar-profile-card,
html[data-theme='dark'] .avatar-filter-pill,
html[data-theme='dark'] .avatar-page-link,
html[data-theme='dark'] .avatar-search-field,
html[data-theme='dark'] .avatar-empty-choice,
html[data-theme='dark'] .avatar-upload-preview,
html[data-theme='dark'] .avatar-generate-bar,
html[data-theme='dark'] .avatar-settings-grid .control-label,
html[data-theme='dark'] .image-render-panel,
html[data-theme='dark'] .image-settings-grid .control-label,
html[data-theme='dark'] .image-enhance-toggle,
html[data-theme='dark'] .image-preview-stage,
html[data-theme='dark'] .image-recent-card,
html[data-theme='dark'] .image-recent-thumb,
html[data-theme='dark'] .image-recent-placeholder,
html[data-theme='dark'] .speech-recorder-card,
html[data-theme='dark'] .speech-file-pill,
html[data-theme='dark'] .speech-record-status,
html[data-theme='dark'] .speech-status-badge,
html[data-theme='dark'] .speech-transcript-output,
html[data-theme='dark'] .speech-metric-card,
html[data-theme='dark'] .speech-empty-result,
html[data-theme='dark'] .speech-recent-item,
html[data-theme='dark'] .form-control,
html[data-theme='dark'] .studio-textarea,
html[data-theme='dark'] .upload-dropzone,
html[data-theme='dark'] .message {
    border-color: rgba(255, 255, 255, 0.1);
    background-color: rgba(255, 255, 255, 0.05);
    color: #f4f4f6;
}

html[data-theme='dark'] .app-topbar {
    background: transparent;
}

html[data-theme='dark'] .dashboard-hero {
    background: linear-gradient(135deg, #111115 0%, #141421 54%, #101f1d 100%);
}

html[data-theme='dark'] .dashboard-kicker {
    background: rgba(var(--accent-rgb), 0.16);
    color: var(--accent);
}

html[data-theme='dark'] .dashboard-stat-value,
html[data-theme='dark'] .dashboard-voice-name {
    color: #f4f4f6;
}

html[data-theme='dark'] .dashboard-stat-icon,
html[data-theme='dark'] .dashboard-flow-icon,
html[data-theme='dark'] .dashboard-voice-avatar,
html[data-theme='dark'] .dashboard-voice-tags span {
    background: #202028;
}

html[data-theme='dark'] .dashboard-voice-avatar-male {
    background: linear-gradient(135deg, #1e1b4b 0%, #172554 100%);
}

html[data-theme='dark'] .dashboard-voice-avatar-female {
    background: linear-gradient(135deg, #134e4a 0%, #083344 100%);
}

html[data-theme='dark'] .dashboard-voice-avatar-robot {
    background: linear-gradient(135deg, #1f2937 0%, #0f172a 100%);
}

html[data-theme='dark'] .dashboard-voice-generate {
    background: var(--accent);
    color: #101014;
}

html[data-theme='dark'] .dashboard-voice-generate:hover {
    background: var(--accent);
}

html[data-theme='dark'] .dashboard-voice-card:hover {
    border-color: rgba(var(--accent-rgb), 0.72);
    background: #17171c;
    box-shadow: 0 14px 34px rgba(0, 0, 0, 0.22);
}

html[data-theme='dark'] .app-main {
    background-color: transparent !important;
}

html[data-theme='dark'] .bg-surface {
    background-color: #0d0d10 !important;
}

html[data-theme='dark'] .bg-white,
html[data-theme='dark'] .bg-panel {
    background-color: #111115 !important;
}

html[data-theme='dark'] .bg-indigo-50,
html[data-theme='dark'] .bg-orange-100 {
    background-color: rgba(var(--accent-rgb), 0.16) !important;
}

html[data-theme='dark'] .text-ink {
    color: #f4f4f6 !important;
}

html[data-theme='dark'] .text-muted {
    color: #a8a8b6 !important;
}

html[data-theme='dark'] .border-line {
    border-color: #2a2a32 !important;
}

html[data-theme='dark'] .audio-recent-row-completed.border-line {
    border-color: rgba(34, 197, 94, 0.42) !important;
}

html[data-theme='dark'] .audio-recent-row-processing.border-line,
html[data-theme='dark'] .audio-recent-row-queued.border-line {
    border-color: rgba(var(--accent-rgb), 0.36) !important;
}

html[data-theme='dark'] .audio-recent-row-failed.border-line {
    border-color: rgba(248, 113, 113, 0.4) !important;
}

html[data-theme='dark'] .audio-recent-row-completed [data-recent-row-player].icon-button {
    border-color: rgba(74, 222, 128, 0.4);
    background-color: rgba(22, 101, 52, 0.28) !important;
    color: #86efac;
}

html[data-theme='dark'] .studio-voice-pane,
html[data-theme='dark'] .studio-generate-bar,
html[data-theme='dark'] .avatar-builder-head,
html[data-theme='dark'] .avatar-result-header,
html[data-theme='dark'] .image-generation-head,
html[data-theme='dark'] .image-preview-header {
    border-color: #2a2a32;
}

html[data-theme='dark'] .nav-link,
html[data-theme='dark'] .tool-pill,
html[data-theme='dark'] .icon-button,
html[data-theme='dark'] .theme-toggle,
html[data-theme='dark'] .password-toggle,
html[data-theme='dark'] .voice-tab,
html[data-theme='dark'] .voice-preview-button,
html[data-theme='dark'] .avatar-source-tab {
    color: #a8a8b6;
}

html[data-theme='dark'] .nav-link:hover,
html[data-theme='dark'] .nav-link-active,
html[data-theme='dark'] .tool-pill:hover,
html[data-theme='dark'] .tool-pill-active,
html[data-theme='dark'] .icon-button:hover,
html[data-theme='dark'] .theme-toggle:hover,
html[data-theme='dark'] .password-toggle:hover,
html[data-theme='dark'] .voice-tab:hover,
html[data-theme='dark'] .voice-tab.is-active,
html[data-theme='dark'] .avatar-source-tab:hover,
html[data-theme='dark'] .avatar-source-tab.is-active,
html[data-theme='dark'] .avatar-filter-pill:hover,
html[data-theme='dark'] .avatar-filter-pill.is-active,
html[data-theme='dark'] .avatar-page-link:hover,
html[data-theme='dark'] .avatar-page-link.is-active,
html[data-theme='dark'] .voice-preview-button:hover,
html[data-theme='dark'] .voice-preview-button.is-playing,
html[data-theme='dark'] .profile-trigger:hover,
html[data-theme='dark'] .profile-trigger[aria-expanded='true'] {
    background: #202028;
    color: #fff;
}

html[data-theme='dark'] .topbar-button,
html[data-theme='dark'] .secondary-button,
html[data-theme='dark'] .danger-button,
html[data-theme='dark'] .prompt-chip,
html[data-theme='dark'] .theme-toggle,
html[data-theme='dark'] .sidebar-favorites-button,
html[data-theme='dark'] .sidebar-favorite-item,
html[data-theme='dark'] .selected-voice-card,
html[data-theme='dark'] .selected-generation-voice,
html[data-theme='dark'] .voice-row-select {
    border-color: #2a2a32;
    background: #111115;
    color: #f4f4f6;
}

html[data-theme='dark'] .topbar-button:hover,
html[data-theme='dark'] .secondary-button:hover,
html[data-theme='dark'] .prompt-chip:hover,
html[data-theme='dark'] .sidebar-favorites-button:hover,
html[data-theme='dark'] .sidebar-favorites-button[aria-expanded='true'] {
    background: #202028;
}

html[data-theme='dark'] .sidebar-favorites-icon {
    background: #202028;
    color: #c7c7d4;
}

html[data-theme='dark'] .sidebar-favorites-button.has-favorites .sidebar-favorites-icon {
    background: rgba(225, 29, 72, 0.16);
    color: #fb7185;
}

html[data-theme='dark'] .sidebar-favorite-main span {
    color: #f4f4f6;
}

html[data-theme='dark'] .sidebar-favorite-main small,
html[data-theme='dark'] .sidebar-favorites-empty {
    color: #a8a8b6;
}

html[data-theme='dark'] .sidebar-favorite-progress {
    background: #272731;
}

html[data-theme='dark'] .voice-filter-clear {
    background: #202028;
    color: #c7c7d4;
}

html[data-theme='dark'] .selected-voice-card-icon {
    background: #202028;
    color: #c7c7d4;
}

html[data-theme='dark'] .selected-voice-card-main strong,
html[data-theme='dark'] .selected-generation-voice strong,
html[data-theme='dark'] .avatar-builder-head strong,
html[data-theme='dark'] .avatar-step-heading strong,
html[data-theme='dark'] .avatar-audio-card strong,
html[data-theme='dark'] .avatar-profile-name,
html[data-theme='dark'] .avatar-empty-choice strong,
html[data-theme='dark'] .avatar-empty-result strong {
    color: #f4f4f6;
}

html[data-theme='dark'] .selected-voice-eyebrow,
html[data-theme='dark'] .selected-voice-card-main small,
html[data-theme='dark'] .studio-generation-context,
html[data-theme='dark'] .avatar-builder-head small,
html[data-theme='dark'] .avatar-step-heading small,
html[data-theme='dark'] .avatar-audio-card small {
    color: #a8a8b6;
}

html[data-theme='dark'] .avatar-selected-strip > span,
html[data-theme='dark'] .avatar-library-count,
html[data-theme='dark'] .avatar-empty-frame,
html[data-theme='dark'] .avatar-audio-icon,
html[data-theme='dark'] .avatar-profile-thumb,
html[data-theme='dark'] .avatar-upload-preview-empty .material-symbols-outlined {
    background: #202028;
}

html[data-theme='dark'] .avatar-page-panel {
    background: linear-gradient(180deg, #111115 0%, #101014 100%);
}

html[data-theme='dark'] .avatar-main-shell,
html[data-theme='dark'] .app-main:has(.avatar-main-shell),
html[data-theme='dark'] .avatar-workspace {
    background: #0d0d10;
}

html[data-theme='dark'] .avatar-upload-preview-empty strong {
    color: #f4f4f6;
}

html[data-theme='dark'] .avatar-search-field input {
    color: #f4f4f6;
}

html[data-theme='dark'] .avatar-profile-card.is-active {
    border-color: rgba(var(--accent-rgb), 0.72);
    background: linear-gradient(180deg, rgba(var(--accent-rgb), 0.16), rgba(var(--accent-rgb), 0.1)), #111115;
    box-shadow: 0 16px 34px rgba(var(--accent-rgb), 0.14);
}

html[data-theme='dark'] .avatar-profile-card.is-active .avatar-profile-name {
    color: var(--accent);
}

html[data-theme='dark'] .sample-card:hover,
html[data-theme='dark'] .sample-card.is-active,
html[data-theme='dark'] .sample-history-card:hover,
html[data-theme='dark'] .sample-history-card.is-active,
html[data-theme='dark'] .clone-sample-item:has(input:checked),
html[data-theme='dark'] .voice-row:hover,
html[data-theme='dark'] .voice-row.is-active,
html[data-theme='dark'] .voice-row:has(input:checked),
html[data-theme='dark'] .role-card:hover,
html[data-theme='dark'] .role-card.is-active,
html[data-theme='dark'] .role-card:has(input:checked) {
    border-color: rgba(var(--accent-rgb), 0.72);
    background: #17171c;
    box-shadow: 0 14px 34px rgba(0, 0, 0, 0.22);
}

html[data-theme='dark'] .voice-row.is-active .voice-row-select,
html[data-theme='dark'] .voice-row:has(input:checked) .voice-row-select {
    border-color: var(--accent);
    background: var(--accent);
    color: #101014;
}

html[data-theme='dark'] .voice-count-pill,
html[data-theme='dark'] .voice-tab-count,
html[data-theme='dark'] .voice-avatar,
html[data-theme='dark'] .voice-tags span {
    background: #202028;
    color: #c7c7d4;
}

html[data-theme='dark'] .voice-tab.is-active .voice-tab-count {
    background: rgba(255, 255, 255, 0.14);
    color: #fff;
}

html[data-theme='dark'] .voice-row-title {
    color: #f4f4f6;
}

html[data-theme='dark'] .voice-library-metrics span,
html[data-theme='dark'] .voice-favorite-filter,
html[data-theme='dark'] .voice-card,
html[data-theme='dark'] .voice-detail-player,
html[data-theme='dark'] .voice-detail-filter-links a {
    border-color: #2a2a32;
    background: #111115;
    color: #f4f4f6;
}

html[data-theme='dark'] .voice-library-metrics strong,
html[data-theme='dark'] .voice-library-section-title,
html[data-theme='dark'] .voice-card-title,
html[data-theme='dark'] .voice-detail-stat strong {
    color: #f4f4f6;
}

html[data-theme='dark'] .voice-card-meta,
html[data-theme='dark'] .voice-detail-stat span {
    color: #a8a8b6;
}

html[data-theme='dark'] .voice-card-tags span,
html[data-theme='dark'] .voice-detail-avatar,
html[data-theme='dark'] .voice-favorite-button.is-active {
    background: #202028;
    color: #c7c7d4;
}

html[data-theme='dark'] .voice-favorite-button.is-active {
    background: rgba(225, 29, 72, 0.14);
    color: #fb7185;
}

html[data-theme='dark'] .voice-favorite-button.is-active [data-favorite-icon] {
    color: #fb7185;
}

html[data-theme='dark'] .voice-card:hover,
html[data-theme='dark'] .voice-favorite-button.is-active {
    border-color: rgba(251, 113, 133, 0.72);
}

html[data-theme='dark'] .voice-row-meta,
html[data-theme='dark'] .voice-row-note {
    color: #a8a8b6;
}

html[data-theme='dark'] .voice-row-skeleton,
html[data-theme='dark'] .voice-row-skeleton:hover {
    border-color: #2a2a32;
    background: #111115;
    box-shadow: none;
}

html[data-theme='dark'] .clone-sample-rename-panel {
    border-color: #292934;
    background: #181820;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

html[data-theme='dark'] .clone-sample-delete:hover {
    border-color: rgba(248, 113, 113, 0.35);
    background: rgba(127, 29, 29, 0.24);
    color: #fca5a5;
}

html[data-theme='dark'] .skeleton-block {
    background: #202028;
}

html[data-theme='dark'] .skeleton-block::after {
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.08), transparent);
}

html[data-theme='dark'] .voice-waveform {
    background: repeating-linear-gradient(90deg, #333340 0 3px, transparent 3px 7px);
}

html[data-theme='dark'] .voice-waveform::after {
    background: linear-gradient(180deg, transparent 0 18%, #111115 18% 28%, transparent 28% 46%, #111115 46% 57%, transparent 57% 72%, #111115 72% 82%, transparent 82% 100%);
}

html[data-theme='dark'] .form-control,
html[data-theme='dark'] .studio-textarea {
    background-color: rgba(255, 255, 255, 0.05);
}

html[data-theme='dark'] .speech-upload-dropzone {
    background: linear-gradient(180deg, #111115 0%, #15151d 100%);
}

html[data-theme='dark'] .speech-panel-icon,
html[data-theme='dark'] .speech-upload-icon,
html[data-theme='dark'] .speech-empty-icon,
html[data-theme='dark'] .speech-recent-icon {
    background: #17171c;
    color: var(--accent);
}

html[data-theme='dark'] .speech-panel-heading strong,
html[data-theme='dark'] .image-generation-head strong,
html[data-theme='dark'] .speech-result-header strong,
html[data-theme='dark'] .speech-recorder-header strong,
html[data-theme='dark'] .speech-recent-item strong,
html[data-theme='dark'] .speech-upload-title,
html[data-theme='dark'] .speech-file-pill strong,
html[data-theme='dark'] .speech-empty-result strong {
    color: #f4f4f6;
}

html[data-theme='dark'] .speech-status-completed {
    background: rgba(16, 185, 129, 0.14);
    color: #6ee7b7;
}

html[data-theme='dark'] .speech-record-status.is-attached {
    background: rgba(16, 185, 129, 0.14);
    color: #6ee7b7;
}

html[data-theme='dark'] .speech-record-status.is-recording {
    background: rgba(248, 113, 113, 0.12);
    color: #fca5a5;
}

html[data-theme='dark'] .speech-record-actions [data-record-stop].is-stop-cue {
    border-color: #fca5a5;
    color: #fca5a5;
}

html[data-theme='dark'] .image-generation-head small,
html[data-theme='dark'] .image-prompt-label .field-label,
html[data-theme='dark'] .image-render-heading span,
html[data-theme='dark'] .image-generation-context,
html[data-theme='dark'] .image-recent-card p:last-child {
    color: #a8a8b6;
}

html[data-theme='dark'] .image-model-pill {
    background: rgba(var(--accent-rgb), 0.14);
    color: var(--accent);
}

html[data-theme='dark'] .image-generation-form textarea.form-control {
    border-color: #2a2a32;
    background: #0d0d10;
}

html[data-theme='dark'] .image-preview-stage {
    background:
        linear-gradient(45deg, rgba(var(--accent-rgb), 0.07) 25%, transparent 25%, transparent 75%, rgba(var(--accent-rgb), 0.07) 75%),
        linear-gradient(45deg, rgba(var(--accent-rgb), 0.06) 25%, transparent 25%, transparent 75%, rgba(var(--accent-rgb), 0.06) 75%),
        #0d0d10;
    background-position: 0 0, 12px 12px;
    background-size: 24px 24px;
}

html[data-theme='dark'] .image-preview-output {
    box-shadow: 0 18px 44px rgba(0, 0, 0, 0.38);
}

html[data-theme='dark'] .image-recent-card:hover {
    border-color: rgba(var(--accent-rgb), 0.52);
    background: #17171c;
}

html[data-theme='dark'] .speech-status-failed,
html[data-theme='dark'] .speech-failed-state {
    border-color: rgba(248, 113, 113, 0.34);
    background: rgba(248, 113, 113, 0.12);
    color: #fca5a5;
}

html[data-theme='dark'] .form-control::placeholder,
html[data-theme='dark'] .studio-textarea::placeholder {
    color: #797988;
}

html[data-theme='dark'] .upload-dropzone:hover {
    border-color: var(--accent);
    background: #17171c;
}

html[data-theme='dark'] .message-success {
    border-color: rgba(34, 197, 94, 0.32);
    background: rgba(34, 197, 94, 0.12);
    color: #86efac;
}

html[data-theme='dark'] .message-error,
html[data-theme='dark'] .danger-button:hover {
    border-color: rgba(248, 113, 113, 0.34);
    background: rgba(248, 113, 113, 0.12);
    color: #fca5a5;
}

@media (max-width: 1180px) {
    .studio-workspace {
        height: auto;
        min-height: 0;
        overflow: visible;
        grid-template-columns: 1fr;
    }

    .studio-compose-pane {
        min-height: 520px;
        padding-right: 0;
    }

    .studio-voice-pane {
        margin-top: 16px;
        border-left: 0;
        border-top: 1px solid #e3e3e8;
        padding-left: 0;
        padding-top: 16px;
    }

    .studio-voice-pane .voice-picker {
        min-height: 560px;
    }

    .studio-voice-pane .voice-results {
        max-height: min(52vh, 520px);
    }

    .speech-text-workspace {
        grid-template-columns: minmax(0, 1fr);
    }

    .clone-voice-workspace {
        grid-template-columns: minmax(0, 1fr);
    }

    .image-generation-workspace {
        grid-template-columns: minmax(0, 1fr);
    }

    .image-preview-panel {
        min-height: 0;
    }

    .speech-result-panel {
        min-height: 0;
    }

    .speech-submit-row {
        grid-template-columns: minmax(0, 1fr);
    }
}

@media (min-width: 1280px) {
    .history-workspace {
        grid-template-columns: minmax(0, 1.08fr) minmax(420px, 0.92fr);
    }
}

@media (max-width: 900px) {
    .app-sidebar {
        display: none;
    }

    .app-topbar {
        left: 0;
        padding: 0 12px;
    }

    .app-main {
        margin-left: 0;
    }

    .mobile-nav-button {
        display: inline-flex;
    }

    .topbar-button {
        display: none;
    }

    .voice-filter-grid {
        grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    }

    .voice-filter-grid .secondary-button {
        justify-content: center;
    }

    .studio-settings-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .image-recent-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

}

@media (max-width: 640px) {
    .app-topbar {
        gap: 8px;
    }

    .auth-card {
        padding: 20px;
    }

    .dropdown-panel {
        position: fixed;
        left: 12px;
        right: 12px;
        top: 64px;
        width: auto;
    }

    .floating-player {
        bottom: 12px;
        grid-template-columns: 40px minmax(0, 1fr) 28px 28px;
        width: calc(100vw - 24px);
        gap: 10px;
    }

    .floating-player-time {
        display: none;
    }

    .voice-picker {
        padding: 10px;
    }

    .studio-compose-pane {
        min-height: 0;
    }

    .studio-textarea-large {
        min-height: clamp(210px, 32dvh, 260px);
    }

    .studio-settings-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .image-settings-grid,
    .image-meta-grid,
    .image-recent-grid {
        grid-template-columns: 1fr;
    }

    .image-generation-head {
        align-items: flex-start;
    }

    .image-model-pill {
        display: none;
    }

    .image-preview-stage,
    .image-empty-result {
        min-height: 260px;
    }

    .studio-generate-bar {
        flex-direction: column;
        align-items: stretch;
    }

    .studio-generation-context,
    .selected-generation-voice {
        width: 100%;
    }

    .selected-generation-voice strong {
        max-width: min(260px, 52vw);
    }

    .studio-generate-bar .primary-button {
        width: 100%;
    }

    .voice-tabs {
        grid-template-columns: 1fr;
    }

    .voice-filter-grid {
        grid-template-columns: 1fr;
    }

    .studio-voice-pane .voice-filter-grid,
    .studio-voice-pane .voice-filter-grid.voice-filter-grid-has-accent {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .studio-voice-pane .voice-filter-grid .secondary-button {
        padding: 7px 11px;
    }

    .studio-voice-pane .voice-filter-grid .voice-filter-button-label {
        display: inline;
    }

    .sidebar-favorites-panel {
        left: 0;
        top: calc(100% + 8px);
        width: min(360px, calc(100vw - 24px));
    }

    .voice-row {
        grid-template-columns: auto minmax(0, 1fr) auto auto;
        align-items: start;
    }

    .studio-voice-pane .voice-row {
        grid-template-columns: auto minmax(0, 1fr) auto auto;
    }

    .voice-row-select {
        width: 32px;
    }

    .voice-library-heading,
    .voice-library-filter-header,
    .voice-detail-hero {
        align-items: stretch;
        flex-direction: column;
    }

    .voice-library-filter-grid,
    .voice-detail-layout,
    .voice-detail-player {
        grid-template-columns: 1fr;
    }

    .voice-library-results {
        max-height: 620px;
    }

    .voice-preview-inline {
        grid-column: 2 / -1;
        width: 100%;
    }

    .studio-voice-pane .voice-preview-inline {
        grid-column: 2 / -1;
    }

    .voice-preview-button {
        min-width: 36px;
        padding: 7px;
    }

    .voice-preview-button [data-preview-label] {
        display: none;
    }
}

@media (max-width: 640px) {
    html,
    body {
        max-width: 100%;
        overflow-x: hidden;
    }

    body {
        -webkit-text-size-adjust: 100%;
    }

    .app-main {
        height: calc(100dvh - 56px);
        overflow-x: hidden;
        -webkit-overflow-scrolling: touch;
    }

    .app-main > div,
    .studio-main-shell,
    .studio-summary-grid,
    .voice-library-shell,
    .history-workspace,
    .speech-text-workspace,
    .clone-voice-workspace,
    .image-generation-workspace,
    .voice-detail-layout {
        min-width: 0;
    }

    .studio-summary-grid {
        grid-template-columns: minmax(0, 1fr) !important;
    }

    .studio-summary-grid > * {
        min-width: 0;
    }

    .app-main > div {
        padding-right: 12px;
        padding-left: 12px;
    }

    .panel,
    .auth-card,
    .voice-library-heading,
    .voice-explore-panel,
    .voice-detail-main,
    .voice-detail-side,
    .speech-upload-panel,
    .speech-result-panel {
        border-radius: 10px;
    }

    .app-topbar {
        min-width: 0;
    }

    .app-topbar > div:first-child {
        min-width: 0;
        flex: 1 1 auto;
    }

    .app-topbar > div:last-child {
        flex: 0 0 auto;
        gap: 6px;
    }

    .profile-trigger span:not(.material-symbols-outlined):not(:first-child),
    .profile-trigger .truncate {
        display: none;
    }

    .profile-trigger {
        padding: 4px;
    }

    .mobile-nav-panel {
        max-height: calc(100dvh - 82px);
        overflow-y: auto;
    }

    .tool-nav {
        position: sticky;
        top: 0;
        z-index: 12;
        flex-wrap: nowrap !important;
        overflow-x: auto;
        overflow-y: hidden;
        padding: 8px 10px;
        scroll-padding-inline: 10px;
        scroll-snap-type: x proximity;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
    }

    .tool-nav::-webkit-scrollbar {
        display: none;
    }

    .tool-nav .tool-pill {
        min-height: 34px;
        flex: 0 0 auto;
        justify-content: center;
        padding: 7px 11px;
        scroll-snap-align: start;
        white-space: nowrap;
    }

    .tool-nav .tool-pill .material-symbols-outlined {
        font-size: 17px;
    }

    .form-control,
    .studio-textarea,
    .speech-transcript-output,
    .primary-button,
    .secondary-button,
    .danger-button,
    .icon-button,
    .voice-preview-button,
    .prompt-chip,
    .tool-pill {
        min-height: 40px;
    }

    .primary-button,
    .secondary-button,
    .danger-button {
        min-width: 0;
    }

    .studio-prompt-row,
    .image-prompt-row {
        display: flex;
        flex-wrap: nowrap;
        gap: 8px;
        overflow-x: auto;
        overflow-y: hidden;
        padding-bottom: 2px;
        scroll-padding-inline: 2px;
        scroll-snap-type: x proximity;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
    }

    .studio-prompt-row::-webkit-scrollbar,
    .image-prompt-row::-webkit-scrollbar {
        display: none;
    }

    .prompt-chip {
        flex: 0 0 auto;
        justify-content: center;
        max-width: min(220px, 74vw);
        scroll-snap-align: start;
        white-space: nowrap;
        text-align: center;
    }

    .speech-upload-panel,
    .speech-result-panel,
    .voice-detail-main,
    .voice-detail-side,
    .voice-explore-panel,
    .voice-library-heading {
        padding: 14px;
    }

    .speech-recorder-header,
    .speech-result-header,
    .image-generation-head,
    .image-render-heading,
    .voice-library-section-title,
    .voice-detail-actions,
    .image-result-actions {
        align-items: stretch;
        flex-direction: column;
    }

    .speech-record-actions,
    .voice-detail-actions,
    .image-result-actions,
    .job-result-actions,
    .panel form.flex {
        display: grid;
        grid-template-columns: 1fr;
        width: 100%;
    }

    .speech-record-actions .secondary-button,
    .voice-detail-actions .primary-button,
    .voice-detail-actions .secondary-button,
    .image-result-actions .primary-button,
    .image-result-actions .secondary-button,
    .job-result-actions .secondary-button,
    .panel form.flex .primary-button,
    .panel form.flex .secondary-button,
    .panel form.flex .danger-button,
    .panel form.flex select {
        width: 100%;
        justify-content: center;
    }

    .panel form.flex select {
        min-width: 0 !important;
    }

    .speech-record-preview,
    audio,
    .voice-detail-player,
    .voice-waveform {
        width: 100%;
        min-width: 0;
    }

    .speech-file-pill {
        width: 100%;
        max-width: 100%;
    }

    .speech-file-pill strong {
        min-width: 0;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .studio-generate-bar,
    .image-generate-bar,
    .speech-submit-row {
        gap: 10px;
    }

    .studio-generate-bar .primary-button,
    .image-generate-bar .primary-button,
    .speech-submit-row .primary-button {
        min-height: 44px;
    }

    .voice-row,
    .studio-voice-pane .voice-row {
        grid-template-columns: auto minmax(0, 1fr) auto;
        gap: 9px;
    }

    .studio-voice-pane .voice-filter-grid,
    .studio-voice-pane .voice-filter-grid.voice-filter-grid-has-accent {
        display: flex;
        grid-template-columns: none !important;
        flex-wrap: nowrap;
        gap: 6px;
        overflow-x: auto;
        overflow-y: hidden;
        padding-bottom: 2px;
        scroll-padding-inline: 2px;
        scroll-snap-type: x proximity;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
    }

    .studio-voice-pane .voice-filter-grid::-webkit-scrollbar {
        display: none;
    }

    .studio-voice-pane .voice-filter-grid > *,
    .studio-voice-pane .voice-filter-grid .form-control {
        flex: 0 0 118px;
        min-width: 0;
        scroll-snap-align: start;
    }

    .studio-voice-pane .voice-filter-grid .form-control,
    .studio-voice-pane .voice-filter-search-row .form-control {
        min-height: 32px;
        padding: 5px 8px;
        font-size: 11.5px;
    }

    .studio-voice-pane .voice-filter-grid .secondary-button {
        flex: 0 0 34px;
        min-height: 32px;
        width: 34px;
        padding: 0;
    }

    .studio-voice-pane .voice-filter-grid .voice-filter-button-label {
        display: none;
    }

    .studio-voice-pane .voice-results {
        gap: 5px;
    }

    .studio-voice-pane .voice-row {
        min-height: 44px;
        grid-template-columns: 26px minmax(0, 1fr) 30px 28px;
        align-items: center;
        gap: 6px;
        padding: 6px;
    }

    .studio-voice-pane .voice-avatar {
        width: 26px;
        height: 26px;
    }

    .studio-voice-pane .voice-avatar .material-symbols-outlined {
        font-size: 16px;
    }

    .studio-voice-pane .voice-row-title {
        font-size: 12.2px;
        line-height: 1.2;
    }

    .studio-voice-pane .voice-row-meta,
    .studio-voice-pane .voice-row-note {
        margin-top: 1px;
        font-size: 10.5px;
        line-height: 1.25;
    }

    .studio-voice-pane .voice-preview-inline {
        display: none;
    }

    .studio-voice-pane .voice-preview-button {
        grid-column: auto;
        min-height: 30px;
        min-width: 30px;
        width: 30px;
        height: 30px;
        padding: 0;
    }

    .studio-voice-pane .voice-row-select {
        grid-column: auto;
        min-height: 28px;
        width: 28px;
    }

    .voice-row > .voice-row-select {
        grid-column: 3;
    }

    .voice-row .voice-preview-button {
        grid-column: 3;
    }

    .studio-voice-pane .voice-row > .voice-row-select {
        grid-column: 4;
        grid-row: 1;
    }

    .studio-voice-pane .voice-row .voice-preview-button {
        grid-column: 3;
        grid-row: 1;
    }

    .voice-preview-inline {
        grid-column: 2 / -1;
    }

    .clone-sample-item {
        grid-template-columns: minmax(0, 1fr) 32px 32px 32px;
        gap: 6px;
        padding: 7px;
    }

    .clone-sample-item .voice-preview-inline {
        display: none;
    }

    .clone-sample-item > .voice-preview-button {
        grid-column: 2;
    }

    .clone-sample-item > [data-sample-rename-toggle] {
        grid-column: 3;
    }

    .clone-sample-delete {
        grid-column: 4;
    }

    .clone-sample-action,
    .clone-sample-item .voice-preview-button {
        min-height: 32px;
        width: 32px;
        height: 32px;
    }

    .clone-sample-choice {
        gap: 7px;
    }

    .clone-sample-rename-panel {
        grid-template-columns: minmax(0, 1fr);
        gap: 6px;
    }

    .clone-sample-rename-panel .secondary-button {
        width: 100%;
        justify-content: center;
    }

    .voice-card-grid,
    .voice-card-grid-compact,
    .voice-library-results,
    .dashboard-stat-grid,
    .dashboard-flow-grid,
    .image-recent-grid {
        grid-template-columns: 1fr;
    }

    .voice-card,
    .dashboard-voice-card,
    .dashboard-sample-card,
    .dashboard-flow-step,
    .dashboard-stat-card,
    .image-recent-card,
    .speech-recent-item {
        min-width: 0;
    }

    .dashboard-hero-actions,
    .voice-library-metrics,
    .voice-library-filter-header > div:last-child {
        width: 100%;
    }

    .dashboard-hero-actions,
    .voice-library-metrics {
        display: grid;
        grid-template-columns: 1fr;
    }

    .dashboard-hero-actions .primary-button,
    .dashboard-hero-actions .secondary-button,
    .voice-library-filter-header .secondary-button {
        width: 100%;
        justify-content: center;
    }

    .dashboard-voice-card {
        display: grid;
        grid-template-columns: auto minmax(0, 1fr) auto;
        align-items: center;
    }

    .dashboard-voice-actions {
        grid-column: 3;
        flex-direction: column;
    }

    .history-panel > .mb-5,
    .image-recent-panel > .mb-3,
    .speech-recent-panel > .mb-3,
    .panel > .mb-3,
    .panel > .mb-5 {
        align-items: flex-start;
    }

    .history-panel form,
    .panel form[method='get'],
    .voice-library-filter-grid,
    .voice-filter-grid,
    .image-settings-grid,
    .image-meta-grid,
    .studio-voice-pane .studio-settings-grid {
        grid-template-columns: 1fr !important;
    }

    [data-audio-recent-row] {
        display: grid;
        grid-template-columns: auto minmax(0, 1fr);
        align-items: start;
    }

    [data-audio-recent-row] > div:last-child {
        grid-column: 2;
        width: 100%;
        justify-content: flex-start;
    }

    [data-audio-recent-row] .icon-button {
        min-width: 36px;
    }

    .floating-player {
        bottom: max(12px, env(safe-area-inset-bottom));
        border-radius: 18px;
        padding: 8px 9px;
    }
}

@media (max-width: 480px) {
    .app-topbar {
        height: 52px;
    }

    .app-main {
        margin-top: 52px;
        height: calc(100dvh - 52px);
    }

    .app-main > div {
        padding: 10px;
    }

    .tool-nav .tool-pill {
        flex-basis: auto;
    }

    .panel,
    .auth-card,
    .voice-library-heading,
    .voice-explore-panel,
    .voice-detail-main,
    .voice-detail-side,
    .speech-upload-panel,
    .speech-result-panel {
        border-radius: 9px;
    }

    .voice-detail-hero h1,
    .voice-library-heading h1 {
        font-size: 1.5rem;
        line-height: 1.15;
    }

    .dashboard-voice-card {
        grid-template-columns: auto minmax(0, 1fr);
    }

    .dashboard-voice-actions {
        grid-column: 1 / -1;
        flex-direction: row;
        justify-content: flex-start;
        padding-left: 54px;
    }

    .voice-card-topline,
    .speech-panel-heading,
    .speech-result-toolbar {
        align-items: flex-start;
        flex-direction: column;
    }

    .speech-result-toolbar .secondary-button {
        width: 100%;
        justify-content: center;
    }

    .floating-player {
        grid-template-columns: 36px minmax(0, 1fr) 28px;
    }

    .floating-player-action:not(#floating-download) {
        display: none;
    }
}
/* Doodle Explainer builder */
.doodle-workspace {
    display: grid;
    grid-template-columns: minmax(420px, 1fr) minmax(0, 1fr);
    gap: 16px;
    align-items: start;
}

.doodle-builder-form,
.doodle-result-panel {
    display: flex;
    min-width: 0;
    flex-direction: column;
}

.doodle-result-panel {
    position: sticky;
    top: 0;
    min-height: 0;
}

.doodle-name-field {
    display: block;
}

.doodle-scenes {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.doodle-scene-card {
    border: 1px solid #e3e3e8;
    border-radius: 8px;
    background: #f8f8fa;
    padding: 12px;
}

.doodle-scene-head {
    display: flex;
    align-items: center;
    gap: 8px;
}

.doodle-scene-number {
    color: #171719;
    font-size: 13px;
    font-weight: 900;
}

.doodle-scene-duration {
    border-radius: 999px;
    background: var(--accent-soft);
    padding: 2px 8px;
    color: var(--accent);
    font-size: 11px;
    font-weight: 900;
}

.doodle-scene-actions {
    margin-left: auto;
    display: inline-flex;
    gap: 4px;
}

.doodle-scene-grid {
    margin-top: 10px;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

.doodle-scene-column {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.doodle-scene-label {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: #666675;
    font-size: 11px;
    font-weight: 800;
    text-transform: uppercase;
}

.doodle-scene-label .material-symbols-outlined {
    font-size: 16px;
    color: var(--accent);
}

.doodle-file-field {
    position: relative;
    display: inline-flex;
    width: 100%;
    min-height: 40px;
    align-items: center;
    gap: 8px;
    overflow: hidden;
    cursor: pointer;
    border: 1px dashed #c9c9d6;
    border-radius: 8px;
    background: #fff;
    padding: 8px 10px;
    color: #171719;
    font-size: 12px;
    font-weight: 760;
}

.doodle-file-field input[type='file'] {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
}

.doodle-file-field .material-symbols-outlined {
    font-size: 18px;
    color: var(--accent);
}

.doodle-file-field span:last-child {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.doodle-pick-select {
    font-size: 12px;
}

.doodle-point-stage {
    position: relative;
    overflow: hidden;
    border: 1px solid #e3e3e8;
    border-radius: 8px;
    background: #fff;
    cursor: crosshair;
}

.doodle-point-stage img {
    display: block;
    width: 100%;
    max-height: 240px;
    object-fit: contain;
    background: #fff;
}

.doodle-point-marker {
    position: absolute;
    display: inline-flex;
    height: 22px;
    width: 22px;
    align-items: center;
    justify-content: center;
    border: 2px solid #fff;
    border-radius: 999px;
    transform: translate(-50%, -50%);
    color: #fff;
    font-size: 10px;
    font-weight: 900;
    box-shadow: 0 2px 6px rgba(17, 17, 24, 0.35);
    pointer-events: none;
}

.doodle-point-start {
    background: #16a34a;
}

.doodle-point-end {
    background: #dc2626;
}

.doodle-point-tools {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
}

.doodle-point-mode {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    border: 1px solid #e3e3e8;
    border-radius: 999px;
    background: #fff;
    padding: 4px 10px;
    color: #666675;
    font-size: 11px;
    font-weight: 800;
}

.doodle-point-mode.is-active {
    border-color: var(--accent);
    color: #171719;
}

.doodle-dot {
    display: inline-block;
    height: 8px;
    width: 8px;
    border-radius: 999px;
}

.doodle-dot-start { background: #16a34a; }
.doodle-dot-end { background: #dc2626; }

.doodle-point-hint {
    color: #666675;
    font-size: 11px;
    font-weight: 640;
}

.doodle-scene-audio-preview {
    width: 100%;
    height: 34px;
}

.doodle-scene-audio-preview[hidden],
.doodle-point-stage[hidden],
.doodle-point-tools[hidden] {
    display: none;
}

.doodle-layer-tools {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 10px;
}

.doodle-layer-tools[hidden] {
    display: none;
}

.doodle-layer-add-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.doodle-layer-add {
    padding: 6px 10px;
    font-size: 12px;
}

.doodle-layer-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.doodle-layer-row {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
    border: 1px solid var(--line, #e4e4ec);
    border-radius: 10px;
    background: #fff;
    padding: 6px 8px;
}

.doodle-layer-kind {
    flex: 0 0 auto;
    min-width: 28px;
    border-radius: 8px;
    background: #eef1f7;
    color: #3b4254;
    font-size: 11px;
    font-weight: 800;
    text-align: center;
    padding: 4px 5px;
}

.doodle-layer-text {
    flex: 1 1 140px;
    min-width: 120px;
    height: 32px;
    font-size: 12px;
}

.doodle-layer-font {
    flex: 0 0 auto;
    width: 108px;
    height: 32px;
    font-size: 12px;
}

.doodle-layer-size {
    flex: 0 0 auto;
    width: 74px;
    accent-color: #4b5563;
}

.doodle-layer-color {
    flex: 0 0 auto;
    width: 30px;
    height: 30px;
    padding: 0;
    border: 1px solid var(--line, #e4e4ec);
    border-radius: 8px;
    background: transparent;
}

.doodle-layer-actions {
    display: flex;
    gap: 2px;
    margin-left: auto;
}

.doodle-layer-overlay {
    position: absolute;
    max-width: 92%;
    cursor: grab;
    user-select: none;
    touch-action: none;
    line-height: 1.2;
    white-space: pre-wrap;
    border: 1px dashed transparent;
    border-radius: 6px;
    padding: 1px 3px;
    z-index: 4;
}

.doodle-layer-overlay:hover,
.doodle-layer-overlay.is-dragging {
    border-color: rgba(59, 130, 246, 0.75);
    background: rgba(59, 130, 246, 0.08);
    cursor: grabbing;
}

.doodle-layer-overlay img {
    display: block;
    pointer-events: none;
    max-width: 100%;
}

.doodle-layer-overlay.is-invalid {
    border-color: rgba(220, 38, 38, 0.7);
}

html[data-theme='dark'] .doodle-layer-row {
    border-color: #33333e;
    background: #17171c;
}

html[data-theme='dark'] .doodle-layer-kind {
    background: #26262e;
    color: #cfd3e0;
}

.doodle-layer-image-name {
    flex: 1 1 120px;
    min-width: 100px;
    font-size: 12px;
    font-weight: 640;
    color: #666675;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

@font-face {
    font-family: 'Caveat';
    src: url('../fonts/doodle/Caveat.ttf') format('truetype');
    font-display: swap;
}

@font-face {
    font-family: 'Patrick Hand';
    src: url('../fonts/doodle/PatrickHand.ttf') format('truetype');
    font-display: swap;
}

@font-face {
    font-family: 'Shadows Into Light';
    src: url('../fonts/doodle/ShadowsIntoLight.ttf') format('truetype');
    font-display: swap;
}

@font-face {
    font-family: 'Kalam';
    src: url('../fonts/doodle/Kalam.ttf') format('truetype');
    font-display: swap;
}

@font-face {
    font-family: 'Indie Flower';
    src: url('../fonts/doodle/IndieFlower.ttf') format('truetype');
    font-display: swap;
}

.doodle-editor-layers-panel {
    display: flex;
    flex-direction: column;
    gap: 8px;
    border: 1px solid var(--line, #e4e4ec);
    border-radius: 12px;
    background: #fff;
    padding: 12px;
    flex: 0 1 auto;
    min-height: 0;
    overflow: hidden;
}

.doodle-editor-layers {
    display: flex;
    flex-direction: column;
    gap: 4px;
    overflow-y: auto;
    max-height: 220px;
    min-height: 0;
}

.doodle-editor-layer-item {
    display: flex;
    align-items: center;
    gap: 7px;
    border: 1px solid var(--line, #e4e4ec);
    border-radius: 8px;
    background: #fff;
    padding: 5px 8px;
    cursor: pointer;
    text-align: left;
    width: 100%;
}

.doodle-editor-layer-item.is-active {
    border-color: #3b82f6;
    background: rgba(59, 130, 246, 0.07);
}

.doodle-editor-layer-number {
    flex: 0 0 auto;
    min-width: 20px;
    border-radius: 6px;
    background: #1d2733;
    color: #fff;
    font-size: 10px;
    font-weight: 800;
    text-align: center;
    padding: 2px 4px;
}

.doodle-editor-layer-label {
    flex: 1 1 auto;
    min-width: 0;
    font-size: 12px;
    font-weight: 640;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: #3b4254;
}

html[data-theme='dark'] .doodle-editor-layers-panel,
html[data-theme='dark'] .doodle-editor-layer-item {
    background: #1c1c22;
    border-color: #33333e;
}

html[data-theme='dark'] .doodle-editor-layer-label {
    color: #cfd3e0;
}

.doodle-editor-modal {
    position: fixed;
    inset: 0;
    z-index: 90;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(15, 17, 24, 0.72);
    padding: 18px;
}

.doodle-editor-modal[hidden] {
    display: none;
}

body.doodle-editor-open {
    overflow: hidden;
}

.doodle-editor-shell {
    display: flex;
    flex-direction: column;
    gap: 10px;
    width: min(1180px, 100%);
    max-height: 94vh;
    border-radius: 16px;
    background: var(--surface, #f6f7fa);
    border: 1px solid var(--line, #e4e4ec);
    padding: 14px;
    overflow: auto;
}

.doodle-editor-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 10px;
}

.doodle-editor-topbar strong {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 15px;
    font-weight: 800;
}

.doodle-editor-topbar-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.doodle-editor-topbar-actions .secondary-button,
.doodle-editor-topbar-actions .primary-button {
    padding: 7px 12px;
    font-size: 12px;
}

.doodle-editor-body {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 240px;
    gap: 12px;
    align-items: start;
}

.doodle-editor-stage-wrap {
    display: flex;
    justify-content: center;
    min-width: 0;
}

.doodle-editor-stage {
    position: relative;
    width: fit-content;
    max-width: 100%;
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid var(--line, #e4e4ec);
    background:
        linear-gradient(45deg, #eceef3 25%, transparent 25%, transparent 75%, #eceef3 75%),
        linear-gradient(45deg, #eceef3 25%, #fff 25%, #fff 75%, #eceef3 75%);
    background-size: 22px 22px;
    background-position: 0 0, 11px 11px;
    min-height: 200px;
}

.doodle-editor-stage > img[data-editor-image] {
    display: block;
    max-width: 100%;
    max-height: 68vh;
    width: auto;
    height: auto;
    user-select: none;
}

.doodle-editor-overlay {
    z-index: 6;
}

.doodle-editor-overlay.is-selected {
    border-color: rgba(59, 130, 246, 0.95);
    background: rgba(59, 130, 246, 0.1);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.25);
}

.doodle-editor-side {
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-height: 74vh;
    min-width: 0;
}

.doodle-editor-props {
    display: flex;
    flex-direction: column;
    gap: 10px;
    border: 1px solid var(--line, #e4e4ec);
    border-radius: 12px;
    background: #fff;
    padding: 12px;
    flex: 0 0 auto;
}

.doodle-editor-props[hidden] {
    display: none;
}

.doodle-editor-props-title {
    font-size: 12px;
    font-weight: 800;
    text-transform: uppercase;
    color: #666675;
}

.doodle-editor-props label {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.doodle-editor-props input[type='color'] {
    width: 44px;
    height: 34px;
    padding: 0;
    border: 1px solid var(--line, #e4e4ec);
    border-radius: 8px;
    background: transparent;
}

.doodle-editor-props input[type='range'] {
    accent-color: #4b5563;
}

.doodle-editor-props-actions {
    display: flex;
    gap: 4px;
}

.doodle-editor-hint {
    font-size: 11px;
    font-weight: 640;
    color: #666675;
    text-align: center;
}

.doodle-editor-slides-panel {
    display: flex;
    flex-direction: column;
    gap: 8px;
    border: 1px solid var(--line, #e4e4ec);
    border-radius: 12px;
    background: #fff;
    padding: 12px;
    flex: 1 1 auto;
    min-height: 0;
    overflow: hidden;
}

.doodle-editor-slides {
    display: flex;
    flex-direction: column;
    gap: 8px;
    overflow-y: auto;
    padding: 2px;
    min-height: 0;
}

.doodle-editor-slide {
    position: relative;
    flex: 0 0 auto;
    width: 100%;
    height: 96px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid var(--line, #e4e4ec);
    border-radius: 10px;
    background: #fff;
    overflow: hidden;
    cursor: pointer;
    padding: 0;
    color: #9a9aa8;
}

.doodle-editor-slide img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    pointer-events: none;
}

.doodle-editor-slide.is-active {
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.25);
}

.doodle-editor-slide:disabled {
    cursor: not-allowed;
    opacity: 0.55;
}

.doodle-editor-slide-number {
    position: absolute;
    left: 6px;
    bottom: 5px;
    min-width: 20px;
    border-radius: 6px;
    background: rgba(15, 17, 24, 0.78);
    color: #fff;
    font-size: 11px;
    font-weight: 800;
    text-align: center;
    padding: 1px 5px;
    pointer-events: none;
}

html[data-theme='dark'] .doodle-editor-slide {
    background: #1c1c22;
    border-color: #33333e;
}

html[data-theme='dark'] .doodle-editor-slides-panel {
    background: #1c1c22;
    border-color: #33333e;
}

html[data-theme='dark'] .doodle-editor-shell {
    background: #17171c;
    border-color: #33333e;
}

html[data-theme='dark'] .doodle-editor-stage {
    background: #101014;
    border-color: #33333e;
}

html[data-theme='dark'] .doodle-editor-props {
    background: #1c1c22;
    border-color: #33333e;
}

@media (max-width: 860px) {
    .doodle-editor-body {
        grid-template-columns: minmax(0, 1fr);
    }
}

.doodle-add-scene {
    align-self: flex-start;
}

html[data-theme='dark'] .doodle-scene-card {
    border-color: #33333e;
    background: #1c1c22;
}

html[data-theme='dark'] .doodle-file-field,
html[data-theme='dark'] .doodle-point-stage,
html[data-theme='dark'] .doodle-point-mode {
    border-color: #33333e;
    background: #17171c;
    color: #e6e6ee;
}

html[data-theme='dark'] .doodle-scene-number {
    color: #e6e6ee;
}

@media (max-width: 1100px) {
    .doodle-workspace {
        grid-template-columns: minmax(0, 1fr);
    }

    .doodle-result-panel {
        position: static;
    }
}

@media (max-width: 640px) {
    .doodle-scene-grid {
        grid-template-columns: minmax(0, 1fr);
    }
}

/* =============================================================================
   Shared prompt textarea (.ig-textarea-wrap)
   Used by the image, regional and text-to-video prompt bars.
   ========================================================================== */
.ig-textarea-wrap { position: relative; }
/* Textareas carry a UA default inline padding/indent that sibling buttons
   don't, which pushes the placeholder right of the toolbar below it. */
.ig-textarea-wrap textarea {
    padding-left: 0;
    text-indent: 0;
}
/* Soften the hard cut where a long prompt scrolls past the top/bottom edges.
   The overlays sit above the textarea, so they must not eat pointer events.
   Each side only shows once content is actually scrolled past it — app.js
   toggles .has-scroll-top / .has-scroll-bottom. */
.ig-textarea-wrap::before,
.ig-textarea-wrap::after {
    content: "";
    position: absolute;
    left: 0;
    right: 14px;
    height: 22px;
    pointer-events: none;
    opacity: 0;
    transition: opacity 160ms ease;
    z-index: 2;
}
.ig-textarea-wrap::before {
    top: 0;
    background: linear-gradient(to bottom, #0f0f0f 15%, rgba(15, 15, 15, 0));
}
.ig-textarea-wrap::after {
    bottom: 0;
    background: linear-gradient(to top, #0f0f0f 15%, rgba(15, 15, 15, 0));
}
.ig-textarea-wrap.has-scroll-top::before { opacity: 1; }
.ig-textarea-wrap.has-scroll-bottom::after { opacity: 1; }
/* Keep the clear button above the fade overlays so it stays clickable. */
.ig-textarea-wrap .ig-clear-btn,
.ig-textarea-wrap .rg-clear-btn { z-index: 3; }

/* =============================================================================
   Shared media library modal (.um-*)
   Markup lives in templates/partials/media_library.html and is driven by
   window.usaMediaLibrary.open(). Any tool can reuse it.
   ========================================================================== */
.um-backdrop {
    position: fixed;
    inset: 0;
    z-index: 120;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: rgba(0, 0, 0, 0.6);
    -webkit-backdrop-filter: blur(6px);
    backdrop-filter: blur(6px);
}
.um-backdrop[hidden] { display: none !important; }
.um-modal {
    display: flex;
    flex-direction: column;
    width: min(100%, 1060px);
    height: min(90vh, 720px);
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 18px;
    background: #0f0f0f;
    box-shadow: 0 40px 100px rgba(0, 0, 0, 0.6);
}
.um-head {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 14px;
}
/* Sized to the rail below so the header lines up with the columns. */
.um-title {
    width: 178px;
    flex: 0 0 178px;
    margin: 0;
    padding-left: 12px;
    font-size: 14px;
    font-weight: 700;
    color: #fff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.um-search { position: relative; flex: 1; min-width: 0; }
.um-search .material-symbols-outlined {
    position: absolute;
    top: 50%;
    left: 14px;
    transform: translateY(-50%);
    font-size: 20px;
    color: rgba(255, 255, 255, 0.45);
    pointer-events: none;
}
.um-search-input,
input.um-search-input {
    width: 100%;
    height: 46px;
    padding: 0 16px 0 44px !important;
    border: 1px solid rgba(255, 255, 255, 0.08) !important;
    border-radius: 13px !important;
    background: rgba(255, 255, 255, 0.06) !important;
    color: #fff !important;
    font-size: 14px;
    font-weight: 500;
    outline: none !important;
    box-shadow: none !important;
    -webkit-appearance: none;
    appearance: none;
}
.um-search-input::placeholder { color: rgba(255, 255, 255, 0.4); }
.um-search-input:focus,
input.um-search-input:focus,
.um-search-input:focus-visible {
    border-color: rgba(255, 255, 255, 0.2) !important;
    outline: none !important;
    box-shadow: none !important;
    --tw-ring-shadow: 0 0 #0000;
    --tw-ring-offset-shadow: 0 0 #0000;
}
/* Search inputs render a native clear "X" that collides with our styling. */
.um-search-input::-webkit-search-cancel-button { -webkit-appearance: none; appearance: none; }
/* Custom sort dropdown: a native <select> popup can't be themed (the OS draws
   it), so the menu is our own markup. */
.um-sort { position: relative; flex: 0 0 auto; }
.um-sort-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: 46px;
    padding: 0 12px 0 16px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 13px;
    background: rgba(255, 255, 255, 0.06);
    color: #fff;
    font-size: 14px;
    font-weight: 600;
    white-space: nowrap;
    cursor: pointer;
    transition: background 140ms ease, border-color 140ms ease;
}
.um-sort-btn:hover { background: rgba(255, 255, 255, 0.1); }
.um-sort.is-open .um-sort-btn { border-color: rgba(255, 255, 255, 0.2); }
.um-sort-arrow {
    font-size: 20px;
    color: rgba(255, 255, 255, 0.55);
    transition: transform 160ms ease;
}
.um-sort.is-open .um-sort-arrow { transform: rotate(180deg); }
.um-sort-menu {
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    z-index: 5;
    min-width: 100%;
    margin: 0;
    padding: 6px;
    list-style: none;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 12px;
    background: #17171a;
    box-shadow: 0 18px 50px rgba(0, 0, 0, 0.55);
}
.um-sort-menu[hidden] { display: none !important; }
.um-sort-opt {
    padding: 8px 12px;
    border-radius: 8px;
    color: rgba(255, 255, 255, 0.75);
    font-size: 13.5px;
    font-weight: 600;
    white-space: nowrap;
    cursor: pointer;
    transition: background 140ms ease, color 140ms ease;
}
.um-sort-opt:hover { background: rgba(255, 255, 255, 0.08); color: #fff; }
.um-sort-opt.is-active { background: #fff; color: #0f0f0f; }
.um-x {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    flex: 0 0 40px;
    padding: 0;
    border: 0;
    border-radius: 11px;
    background: transparent;
    color: rgba(255, 255, 255, 0.6);
    cursor: pointer;
    transition: background 140ms ease, color 140ms ease;
}
.um-x:hover { background: rgba(255, 255, 255, 0.08); color: #fff; }
.um-body { display: flex; flex: 1; min-height: 0; }
/* Column 1: kind rail + upload action pinned to the bottom */
.um-rail {
    display: flex;
    flex-direction: column;
    width: 178px;
    flex: 0 0 178px;
    padding: 12px;
}
.um-rail-nav { display: flex; flex-direction: column; gap: 2px; flex: 1; }
.um-rail-item {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 10px 12px;
    border: 0;
    border-radius: 11px;
    background: transparent;
    color: rgba(255, 255, 255, 0.6);
    font-size: 13.5px;
    font-weight: 600;
    text-align: left;
    cursor: pointer;
    transition: background 140ms ease, color 140ms ease;
}
.um-rail-item:hover { background: rgba(255, 255, 255, 0.05); color: #fff; }
.um-rail-item.is-active { background: rgba(255, 255, 255, 0.1); color: #fff; }
.um-rail-item .material-symbols-outlined { font-size: 19px; }
.um-rail-foot { padding-top: 10px; }
.um-upload-btn {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 10px 12px;
    border: 0;
    border-radius: 11px;
    background: transparent;
    color: #fff;
    font-size: 13.5px;
    font-weight: 600;
    text-align: left;
    cursor: pointer;
    transition: background 140ms ease;
}
.um-upload-btn:hover { background: rgba(255, 255, 255, 0.07); }
.um-upload-btn .material-symbols-outlined { font-size: 19px; }
.um-limit { margin: 4px 0 0 12px; font-size: 10.5px; color: rgba(255, 255, 255, 0.35); }
/* Column 2: file list */
.um-side {
    display: flex;
    flex-direction: column;
    width: 296px;
    flex: 0 0 296px;
    min-height: 0;
    padding: 12px 12px 12px 0;
}
.um-list-wrap { flex: 1; min-height: 0; overflow-y: auto; }
.um-list { display: flex; flex-direction: column; gap: 4px; }
/* First-open skeleton: the library is fetched from a remote DB, so show
   placeholder rows instead of an empty panel. */
.um-loading { display: flex; flex-direction: column; gap: 4px; padding: 0 8px; }
.um-loading[hidden] { display: none !important; }
.um-skel {
    display: block;
    height: 60px;
    border-radius: 12px;
    background: linear-gradient(110deg, rgba(255, 255, 255, 0.05) 25%, rgba(255, 255, 255, 0.11) 42%, rgba(255, 255, 255, 0.05) 60%);
    background-size: 220% 100%;
    animation: usa-skel-shimmer 1.4s linear infinite;
}
.um-row {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    padding: 8px 12px 8px 8px;
    border: 0;
    border-radius: 12px;
    background: transparent;
    color: rgba(255, 255, 255, 0.9);
    text-align: left;
    cursor: pointer;
    transition: background 140ms ease;
}
.um-row:hover { background: rgba(255, 255, 255, 0.06); }
.um-row.is-selected { background: rgba(255, 255, 255, 0.13); }
.um-row.is-muted { opacity: 0.45; }
.um-row.is-pending { cursor: default; }
.um-row-thumb {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    flex: 0 0 44px;
    overflow: hidden;
    border-radius: 11px;
    background: rgba(255, 255, 255, 0.07);
    color: rgba(255, 255, 255, 0.5);
}
.um-row-thumb img, .um-row-thumb video { width: 100%; height: 100%; object-fit: cover; }
.um-row-thumb .material-symbols-outlined { font-size: 20px; }
.um-row.is-pending .um-row-thumb img,
.um-row.is-pending .um-row-thumb video { opacity: 0.35; }
.um-row-spinner {
    position: absolute;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.25);
    border-top-color: #fff;
    animation: um-spin 0.7s linear infinite;
}
@keyframes um-spin { to { transform: rotate(360deg); } }
.um-row-name {
    flex: 1;
    min-width: 0;
    font-size: 13.5px;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.um-empty, .um-error {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 40px 12px;
    color: rgba(255, 255, 255, 0.45);
    font-size: 13px;
    font-weight: 600;
    text-align: center;
}
.um-empty p, .um-error p { margin: 0; }
.um-empty .material-symbols-outlined { font-size: 36px; }
.um-empty[hidden], .um-error[hidden] { display: none !important; }
.um-error { padding: 10px 0 0; color: #ff8f8f; }
/* Column 3: large preview */
.um-stage {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-width: 0;
    min-height: 0;
    gap: 10px;
    padding: 12px 14px 14px 0;
}
.um-stage-media {
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 1;
    min-height: 0;
    overflow: hidden;
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.04);
}
.um-stage-media img,
.um-stage-media video { max-width: 100%; max-height: 100%; object-fit: contain; }
.um-stage-media audio { width: 80%; }
.um-stage-media > .material-symbols-outlined { font-size: 64px; color: rgba(255, 255, 255, 0.35); }
.um-stage-empty { color: rgba(255, 255, 255, 0.35); font-size: 13px; text-align: center; }
.um-stage-empty[hidden] { display: none !important; }
.um-stage-foot { display: flex; flex-direction: column; gap: 8px; }
.um-stage-foot[hidden] { display: none !important; }
.um-stage-meta { display: flex; align-items: center; gap: 8px; }
.um-stage-name {
    flex: 1;
    min-width: 0;
    margin: 0;
    font-size: 13.5px;
    font-weight: 600;
    color: #fff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.um-meta { margin: 0; font-size: 11px; color: rgba(255, 255, 255, 0.45); text-transform: capitalize; }
.um-btn {
    padding: 10px 14px;
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: 10px;
    background: transparent;
    color: #fff;
    font-size: 12.5px;
    font-weight: 700;
    white-space: nowrap;
    cursor: pointer;
    transition: background 140ms ease, opacity 140ms ease;
}
.um-btn:hover { background: rgba(255, 255, 255, 0.08); }
.um-btn[hidden] { display: none !important; }
.um-btn-wide { width: 100%; padding: 13px; border-radius: 12px; font-size: 13.5px; }
.um-btn-primary { background: #fff; border-color: transparent; color: #0f0f0f; }
.um-btn-primary:hover { background: #e6e6e6; }
.um-btn-primary:disabled { opacity: 0.45; cursor: not-allowed; }
.um-btn-danger { color: #ff8f8f; }
.um-btn-danger:hover { background: rgba(255, 0, 0, 0.12); }
@media (max-width: 980px) {
    .um-rail { display: none; }
    .um-side { padding-left: 12px; }
    .um-title { display: none; }
}
@media (max-width: 720px) {
    .um-side { width: 200px; flex: 0 0 200px; }
}

