:root {
    color-scheme: dark;
    --bg: #101014;
    --bg-elevated: #15151c;
    --surface: #1b1b24;
    --surface-hover: #23232e;
    --surface-soft: #20202a;
    --border: #30303c;
    --border-soft: #282832;
    --text: #f5f5fa;
    --text-secondary: #b2b2c1;
    --text-muted: #858596;
    --accent: #b69cff;
    --accent-hover: #c7b4ff;
    --accent-soft: rgba(182, 156, 255, 0.12);
    --accent-border: rgba(182, 156, 255, 0.35);
    --success: #71d6a1;
    --success-soft: rgba(113, 214, 161, 0.12);
    --warning: #f1c779;
    --warning-soft: rgba(241, 199, 121, 0.12);
    --danger: #ff929c;
    --danger-soft: rgba(255, 146, 156, 0.12);
    --sidebar-width: 250px;
    --topbar-height: 64px;
    --radius-sm: 9px;
    --radius-md: 13px;
    --radius-lg: 18px;
    --radius-xl: 22px;
    --shadow: 0 18px 60px rgba(0, 0, 0, 0.28);
    font-family:
        Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont,
        "Segoe UI", sans-serif;
    font-synthesis: none;
    text-rendering: optimizeLegibility;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

* {
    box-sizing: border-box;
}

.welcome-view {
    padding: clamp(14px, 3vw, 30px);
}

.welcome-scene {
    position: relative;
    isolation: isolate;
    display: grid;
    align-items: center;
    min-height: min(76vh, 760px);
    overflow: hidden;
    padding: clamp(32px, 7vw, 84px);
    border: 1px solid rgba(197, 178, 255, .18);
    border-radius: clamp(22px, 4vw, 36px);
    background:
        radial-gradient(ellipse at 72% 30%, rgba(48, 190, 197, .25), transparent 31%),
        radial-gradient(ellipse at 28% 85%, rgba(143, 70, 222, .30), transparent 42%),
        linear-gradient(135deg, #171522 0%, #141522 48%, #0c1b2a 100%);
    box-shadow: 0 28px 90px rgba(0, 0, 0, .38), inset 0 1px rgba(255,255,255,.04);
}

.welcome-scene::before,
.welcome-scene::after {
    position: absolute;
    z-index: -1;
    inset: auto -12% -44% 26%;
    height: 75%;
    content: "";
    border: 1px solid rgba(191, 156, 255, .16);
    border-radius: 50%;
    transform: rotate(-12deg);
    box-shadow: 0 0 80px rgba(143, 89, 232, .12);
    animation: welcome-orbit 26s linear infinite;
}

.welcome-scene::after {
    inset: auto -20% -54% 39%;
    border-color: rgba(84, 216, 217, .12);
    animation-duration: 34s;
    animation-direction: reverse;
}

.welcome-grid {
    position: absolute;
    z-index: -1;
    inset: 35% 0 0;
    opacity: .32;
    background-image: linear-gradient(rgba(193,174,255,.10) 1px, transparent 1px), linear-gradient(90deg, rgba(193,174,255,.08) 1px, transparent 1px);
    background-size: 54px 54px;
    mask-image: linear-gradient(transparent, #000 50%);
    transform: perspective(440px) rotateX(58deg) scale(1.4);
    transform-origin: center bottom;
}

#welcome-canvas {
    position: absolute;
    z-index: -1;
    inset: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

.welcome-orb {
    position: absolute;
    z-index: -1;
    width: clamp(180px, 27vw, 360px);
    aspect-ratio: 1;
    border-radius: 50%;
    filter: blur(1px);
    opacity: .38;
    background: radial-gradient(circle at 36% 34%, rgba(225, 210, 255, .68), rgba(159, 105, 238, .25) 28%, rgba(63, 48, 117, .03) 68%, transparent 72%);
    animation: welcome-float 11s ease-in-out infinite alternate;
}

.welcome-orb-one { top: 4%; right: 9%; }
.welcome-orb-two { width: clamp(110px, 17vw, 220px); right: 37%; bottom: 9%; opacity: .23; animation-delay: -4s; }

.welcome-copy { position: relative; z-index: 1; max-width: 760px; }
.welcome-copy .eyebrow { color: #c5b1ff; letter-spacing: .18em; }
.welcome-brand-mark {
    position: relative;
    display: grid;
    width: clamp(58px, 8vw, 78px);
    aspect-ratio: 1;
    place-items: center;
    margin: 24px 0 16px;
    border: 1px solid rgba(219, 204, 255, .38);
    border-radius: 24px;
    background: linear-gradient(145deg, rgba(195, 165, 255, .3), rgba(73, 201, 204, .12));
    color: #f2ebff;
    font-size: clamp(30px, 5vw, 42px);
    font-weight: 800;
    box-shadow: 0 14px 50px rgba(126, 83, 210, .25);
}
.welcome-brand-mark span { position: absolute; right: 4px; bottom: 1px; color: #8ce7dc; font-size: 20px; }
.welcome-copy h1 { max-width: 720px; margin: 0; font-size: clamp(2.5rem, 7vw, 5.3rem); font-weight: 650; letter-spacing: -.055em; line-height: .99; }
.welcome-subtitle { max-width: 520px; margin: 22px 0 0; color: #c2bfd0; font-size: clamp(1rem, 2vw, 1.25rem); }
.welcome-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 32px; }
.welcome-action { min-height: 52px; padding-inline: 22px; }
.welcome-media-controls { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; margin-top: 28px; }
.welcome-control { min-height: 40px; padding: 8px 13px; border: 1px solid rgba(229, 219, 255, .3); border-radius: 999px; background: rgba(14, 15, 25, .52); color: #eee8ff; cursor: pointer; }
.welcome-control:hover { background: rgba(72, 59, 104, .68); }
.welcome-control[hidden] { display: none !important; }
.welcome-audio-status { color: #a7a5b8; font-size: 12px; }
.welcome-visual-media { position: absolute; inset: 0; z-index: 0; overflow: hidden; border-radius: inherit; background: #11121a; }
.welcome-visual-media[hidden] { display: none !important; }
.welcome-visual-media img, .welcome-visual-media video { width: 100%; height: 100%; object-fit: cover; opacity: .54; }
.welcome-visual-media img[hidden], .welcome-visual-media video[hidden] { display: none; }
.welcome-scene.has-media { background: linear-gradient(90deg, rgba(13,14,23,.97) 0%, rgba(13,14,23,.82) 42%, rgba(13,14,23,.25) 100%); }
.welcome-scene.has-media .welcome-grid { opacity: .16; }

@keyframes welcome-orbit { to { transform: rotate(348deg); } }
@keyframes welcome-float { to { transform: translate3d(-20px, 16px, 0) scale(1.08); } }

@media (max-width: 700px) {
    .welcome-view { padding: 10px; }
    .welcome-scene { min-height: min(76dvh, 720px); align-items: end; padding: 30px 22px max(28px, env(safe-area-inset-bottom)); border-radius: 24px; }
    .welcome-copy { position: relative; z-index: 1; }
    .welcome-brand-mark { margin-top: 8px; }
    .welcome-copy h1 { font-size: clamp(2.5rem, 13vw, 4.2rem); }
    .welcome-actions { display: grid; grid-template-columns: 1fr; }
    .welcome-actions button { width: 100%; }
    .welcome-visual-media img, .welcome-visual-media video { opacity: .38; }
}

@media (prefers-reduced-motion: reduce) {
    .welcome-scene::before, .welcome-scene::after, .welcome-orb { animation: none !important; }
    html { scroll-behavior: auto; }
}

html {
    min-width: 0;
    min-height: 100%;
    background: var(--bg);
    scroll-behavior: smooth;
}

body {
    min-width: 0;
    min-height: 100vh;
    margin: 0;
    background:
        radial-gradient(
            ellipse at 58% -15%,
            rgba(103, 79, 155, 0.10),
            transparent 45%
        ),
        var(--bg);
    color: var(--text);
    font-size: 14px;
    line-height: 1.55;
}

button,
input,
textarea,
select {
    font: inherit;
}

button {
    color: inherit;
}

button,
select,
input[type="checkbox"],
input[type="radio"],
label[for] {
    -webkit-tap-highlight-color: transparent;
}

button:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible,
a:focus-visible,
label:has(input:focus-visible) {
    outline: 2px solid var(--accent);
    outline-offset: 3px;
}

button:disabled {
    cursor: not-allowed;
    opacity: 0.55;
}

a {
    color: inherit;
    text-decoration: none;
}

button {
    cursor: pointer;
}

button:active:not(:disabled) {
    transform: translateY(1px);
}

h1,
h2,
h3,
p {
    margin-top: 0;
}

h1,
h2,
h3 {
    color: var(--text);
    line-height: 1.25;
    letter-spacing: -0.025em;
}

h1 {
    margin-bottom: 12px;
    font-size: clamp(27px, 3vw, 36px);
    font-weight: 750;
}

h2 {
    margin-bottom: 0;
    font-size: 16px;
    font-weight: 700;
}

p {
    color: var(--text-secondary);
}

[hidden] {
    display: none !important;
}

.visually-hidden {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    white-space: nowrap !important;
    border: 0 !important;
}

.app-shell {
    display: flex;
    min-height: 100vh;
}

/* Sidebar */

.sidebar {
    position: fixed;
    z-index: 30;
    inset: 0 auto 0 0;
    display: flex;
    width: var(--sidebar-width);
    flex-direction: column;
    padding: 26px 16px 15px;
    border-right: 1px solid var(--border-soft);
    background: rgba(17, 17, 22, 0.97);
}

.brand {
    display: flex;
    min-height: 38px;
    align-items: center;
    gap: 11px;
    padding: 0 5px;
    margin-bottom: 28px;
}

.brand-mark {
    display: grid;
    width: 36px;
    height: 36px;
    flex: 0 0 auto;
    place-items: center;
    border: 1px solid rgba(211, 194, 255, 0.48);
    border-radius: 12px;
    background: linear-gradient(145deg, #c9b7ff, #8c6be4);
    box-shadow: 0 4px 20px rgba(146, 112, 228, 0.20);
    color: #191326;
    font-size: 20px;
    font-weight: 850;
}

.brand-name {
    font-size: 16px;
    font-weight: 780;
    letter-spacing: -0.04em;
}

.sidebar-create-button,
.primary-button,
.secondary-button,
.icon-button,
.text-button,
.nav-item,
.account-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 9px;
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    transition:
        background 160ms ease,
        border-color 160ms ease,
        color 160ms ease,
        transform 160ms ease;
}

.sidebar-create-button {
    width: 100%;
    min-height: 45px;
    padding: 0 14px;
    margin-bottom: 27px;
    background: var(--accent);
    color: #20182e;
    font-weight: 750;
}

.sidebar-create-button:hover,
.primary-button:hover {
    background: var(--accent-hover);
}

.sidebar-create-button > span {
    font-size: 20px;
    line-height: 1;
}

.main-navigation {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.nav-item {
    width: 100%;
    min-height: 43px;
    justify-content: flex-start;
    padding: 0 12px;
    background: transparent;
    color: var(--text-secondary);
    font-weight: 560;
    text-align: left;
}

.nav-item:hover {
    background: var(--surface);
    color: var(--text);
}

.nav-item.active {
    border-color: rgba(182, 156, 255, 0.16);
    background: var(--accent-soft);
    color: var(--accent-hover);
}

.nav-icon {
    display: grid;
    width: 23px;
    place-items: center;
    font-size: 19px;
}

.sidebar-bottom {
    display: flex;
    flex-direction: column;
    gap: 13px;
    margin-top: auto;
}

.credits-card {
    padding: 16px;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background:
        radial-gradient(
            circle at 100% 0,
            rgba(182, 156, 255, 0.10),
            transparent 55%
        ),
        var(--surface);
}

.credits-heading {
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--text-secondary);
    font-size: 12px;
    font-weight: 650;
}

.credits-icon {
    color: var(--accent);
    font-size: 17px;
}

.credits-value {
    margin: 12px 0 2px;
    color: var(--text);
    font-size: 27px;
    font-weight: 760;
    letter-spacing: -0.045em;
}

.credits-description {
    margin: 0 0 8px;
    color: var(--text-muted);
    font-size: 14px;
    line-height: 1.5;
}

.text-button {
    min-height: 26px;
    padding: 2px 0;
    border: 0;
    border-radius: 4px;
    background: transparent;
    color: var(--accent);
    font-size: 12px;
    font-weight: 650;
}

.text-button:hover {
    color: var(--accent-hover);
}

.account-button {
    width: 100%;
    min-height: 57px;
    justify-content: flex-start;
    gap: 6px;
    padding: 8px 5px;
    background: transparent;
    text-align: left;
}

.account-button:hover {
    background: var(--surface);
}

.account-avatar {
    display: grid;
    width: 35px;
    height: 35px;
    flex: 0 0 auto;
    place-items: center;
    border: 1px solid var(--border);
    border-radius: 50%;
    background: #292638;
    color: #d3c4ff;
    font-size: 13px;
    font-weight: 750;
}

.account-copy {
    display: flex;
    min-width: 0;
    flex: 1;
    flex-direction: column;
    gap: 1px;
}

.account-name {
    overflow: hidden;
    color: var(--text);
    font-size: 12px;
    font-weight: 650;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.account-plan {
    color: var(--text-muted);
    font-size: 14px;
}

.account-menu-icon {
    color: var(--text-muted);
    font-size: 20px;
}

/* Main area and header */

.main-content {
    min-width: 0;
    min-height: 100vh;
    flex: 1;
    margin-left: var(--sidebar-width);
}

.topbar {
    position: sticky;
    z-index: 15;
    top: 0;
    display: flex;
    height: var(--topbar-height);
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    padding: 0 36px;
    border-bottom: 1px solid rgba(48, 48, 60, 0.72);
    background: rgba(16, 16, 20, 0.88);
    backdrop-filter: blur(18px);
}

.breadcrumb {
    display: flex;
    min-width: 0;
    align-items: center;
    gap: 6px;
    color: var(--text-muted);
    font-size: 12px;
}

.breadcrumb span:last-child {
    color: var(--text-secondary);
}

.breadcrumb-separator {
    color: #51515f;
}

.topbar-actions {
    display: flex;
    align-items: center;
    gap: 15px;
}

.topbar-library-button {
    min-height: 34px;
    padding: 7px 11px;
    white-space: nowrap;
    font-size: 14px;
}

.admin-panel-link {
    display: inline-flex;
    align-items: center;
    text-decoration: none;
}

.admin-panel-link[hidden] {
    display: none;
}

.connection-indicator {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    color: var(--text-muted);
    font-size: 14px;
}

.connection-dot {
    width: 7px;
    height: 7px;
    flex: 0 0 auto;
    border-radius: 50%;
    background: var(--warning);
    box-shadow: 0 0 9px rgba(241, 199, 121, 0.22);
}

.connection-indicator.is-connected .connection-dot {
    background: var(--success);
    box-shadow: 0 0 9px rgba(113, 214, 161, 0.25);
}

.connection-indicator.is-disconnected .connection-dot {
    background: var(--danger);
    box-shadow: 0 0 9px rgba(255, 146, 156, 0.25);
}

.connection-retry {
    min-height: 34px;
    padding: 6px 10px;
    font-size: 13px;
}

.connection-retry[hidden] {
    display: none;
}

.mobile-menu-button {
    display: none;
}

.icon-button {
    width: 38px;
    height: 38px;
    flex: 0 0 auto;
    border-color: var(--border);
    background: var(--surface);
    color: var(--text);
}

.icon-button:hover {
    background: var(--surface-hover);
}

.monetization-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
    align-items: start;
}

.monetization-panel {
    min-width: 0;
    padding: 20px;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: var(--surface);
}

.monetization-panel--wide {
    grid-column: 1 / -1;
}

.monetization-panel .section-heading {
    margin-bottom: 14px;
}

.monetization-balance {
    display: flex;
    align-items: baseline;
    flex-wrap: wrap;
    gap: 8px;
    margin: 12px 0 4px;
    color: var(--text-secondary);
    font-size: 13px;
}

.monetization-balance span:first-child {
    color: var(--text);
    font-size: 34px;
    font-weight: 760;
    letter-spacing: -0.05em;
}

.monetization-secondary,
.monetization-status,
.monetization-plan__description,
.monetization-plan__features,
.monetization-plan__limits {
    color: var(--text-secondary);
    font-size: 12px;
    line-height: 1.65;
}

.monetization-status:empty {
    display: none;
}

.monetization-error {
    color: var(--danger, #ff8792);
    font-size: 12px;
}

.monetization-plans {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
    gap: 12px;
}

.monetization-plan {
    padding: 15px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm, 12px);
    background: var(--surface-raised, rgba(255,255,255,.025));
}

.monetization-plan__name {
    margin: 0 0 6px;
    color: var(--text);
    font-size: 15px;
}

.monetization-plan__price {
    margin: 0 0 9px;
    color: var(--accent-hover);
    font-size: 20px;
    font-weight: 730;
}

.monetization-plan__interval {
    margin: -5px 0 9px;
    color: var(--text-secondary);
    font-size: 11px;
}

.monetization-plan__features,
.monetization-plan__limits {
    padding-left: 18px;
}

.monetization-badge {
    display: inline-flex;
    padding: 4px 8px;
    border: 1px solid var(--border);
    border-radius: 999px;
    color: var(--text-muted);
    font-size: 10px;
}

.credit-transactions {
    display: grid;
    gap: 5px;
}

.credit-transaction {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto auto;
    align-items: center;
    gap: 14px;
    padding: 9px 0;
    border-bottom: 1px solid var(--border);
}

.credit-transaction:last-child {
    border-bottom: 0;
}

.credit-transaction__description {
    overflow: hidden;
    color: var(--text);
    font-size: 12px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.credit-transaction__amount {
    color: var(--text-secondary);
    font-size: 12px;
    font-weight: 650;
    white-space: nowrap;
}

.credit-transaction__amount[data-direction="positive"] {
    color: #75d5a4;
}

.credit-transaction__amount[data-direction="negative"] {
    color: #ff929c;
}

.credit-transaction__date {
    color: var(--text-muted);
    font-size: 10px;
    white-space: nowrap;
}

#credits-transactions-more {
    margin-top: 12px;
}

@media (max-width: 760px) {
    .monetization-grid {
        grid-template-columns: 1fr;
        gap: 11px;
    }

    .monetization-panel--wide {
        grid-column: auto;
    }

    .monetization-panel {
        padding: 15px;
    }

    .credit-transaction {
        grid-template-columns: minmax(0, 1fr) auto;
        gap: 7px 10px;
    }

    .credit-transaction__date {
        grid-column: 1 / -1;
    }
}

/* Page structure */

.view {
    width: 100%;
    max-width: 1600px;
    padding: 34px 36px 55px;
    margin: 0 auto;
}

.view[hidden] {
    display: none !important;
}

.page-heading {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 22px;
    margin-bottom: 30px;
}

.eyebrow {
    margin-bottom: 9px;
    color: var(--accent);
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 0.14em;
}

.page-description {
    max-width: 670px;
    margin-bottom: 0;
    color: var(--text-secondary);
    font-size: 13px;
    line-height: 1.75;
}

.creation-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(245px, 300px);
    align-items: start;
    gap: 25px;
}

.create-draft-tools {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.75rem;
    margin: -0.5rem 0 1rem;
}

.create-draft-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.55rem 0.8rem;
}

.create-draft-actions button {
    min-height: 44px;
}

.create-draft-actions [hidden] {
    display: none !important;
}

.create-draft-tools .field-hint {
    margin: 0;
    max-width: 44rem;
}

.create-draft-tools .text-button {
    flex: 0 0 auto;
    text-align: right;
}

@media (max-width: 560px) {
    .create-draft-tools {
        flex-direction: column;
        align-items: stretch;
    }

    .create-draft-tools .text-button {
        text-align: left;
    }
}

.creation-form {
    min-width: 0;
    padding: 25px;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    background: rgba(23, 23, 30, 0.88);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.10);
}

.form-section {
    padding-bottom: 26px;
    margin-bottom: 25px;
    border-bottom: 1px solid var(--border-soft);
}

.form-section:last-of-type {
    padding-bottom: 0;
    margin-bottom: 22px;
    border-bottom: 0;
}

.section-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
    margin-bottom: 20px;
}

.section-heading h2 {
    font-size: 16px;
}

.optional-label {
    color: var(--text-muted);
    font-size: 14px;
    font-weight: 450;
}

.field-label {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 8px;
    color: var(--text-secondary);
    font-size: 12px;
    font-weight: 650;
}

.field-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
    margin-top: 19px;
}

.field-heading .field-label {
    margin-bottom: 8px;
}

.text-input,
.text-area {
    display: block;
    width: 100%;
    min-width: 0;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    outline: none;
    background: #14141a;
    color: var(--text);
    font-size: 13px;
    transition:
        border-color 160ms ease,
        box-shadow 160ms ease,
        background 160ms ease;
}

.text-input {
    min-height: 43px;
    padding: 4px 6px;
}

.text-area {
    min-height: 84px;
    padding: 12px;
    resize: vertical;
    line-height: 1.65;
}

.text-input::placeholder,
.text-area::placeholder,
.search-field input::placeholder {
    color: #6f6f80;
    opacity: 1;
}

.text-input:hover,
.text-area:hover {
    border-color: #444454;
}

.text-input:focus,
.text-area:focus {
    border-color: var(--accent);
    background: #17151e;
    box-shadow: 0 0 0 3px rgba(182, 156, 255, 0.08);
}

.text-input:disabled,
.text-area:disabled {
    cursor: not-allowed;
    opacity: 0.6;
}

.text-input select,
select.text-input {
    cursor: pointer;
}

.lyrics-area {
    min-height: 168px;
}

.style-area {
    min-height: 98px;
}

.lyrics-actions {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 10px;
}

.secondary-button {
    min-height: 37px;
    padding: 8px 12px;
    border-color: var(--border);
    background: var(--surface);
    color: var(--text);
    font-size: 12px;
    font-weight: 650;
}

.secondary-button:hover {
    border-color: #55556a;
    background: var(--surface-hover);
}

.lyrics-actions .secondary-button > span {
    color: var(--accent);
    font-size: 14px;
}

.suggestion-heading {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
    margin: 18px 0 10px;
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 600;
}

.style-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.style-chip {
    min-height: 31px;
    padding: 6px 11px;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: #191920;
    color: var(--text-secondary);
    font-size: 14px;
    transition:
        color 160ms ease,
        border-color 160ms ease,
        background 160ms ease;
}

.style-chip:hover {
    border-color: var(--accent-border);
    color: var(--text);
}

.style-chip.selected {
    border-color: var(--accent-border);
    background: var(--accent-soft);
    color: var(--accent-hover);
}

.selected-style-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 10px;
}

.selected-style-tag {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 7px 4px 11px;
    border: 1px solid var(--accent-border);
    border-radius: 999px;
    background: var(--accent-soft);
    color: var(--text);
    font-size: 0.875rem;
}

.selected-style-tag button {
    display: inline-grid;
    width: 22px;
    height: 22px;
    place-items: center;
    border: 0;
    border-radius: 50%;
    background: transparent;
    color: inherit;
    cursor: pointer;
    font-size: 1.15rem;
    line-height: 1;
}

/* Creation type */

.creation-type-options {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 190px), 1fr));
    gap: 6px;
}

.creation-type-card[hidden] {
    display: none !important;
}

.creation-type-card {
    position: relative;
    display: flex;
    min-width: 0;
    min-height: 105px;
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
    padding: 14px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: #17171e;
    cursor: pointer;
    transition:
        border-color 160ms ease,
        background 160ms ease,
        box-shadow 160ms ease;
}

.creation-type-card:hover {
    border-color: #4a4858;
    background: #1d1c26;
}

.creation-type-card[aria-disabled="true"] {
    cursor: not-allowed;
    opacity: 0.62;
}

.creation-type-card[aria-disabled="true"]:hover {
    border-color: var(--border);
    background: #17171e;
}

.creation-type-card.selected,
.creation-type-card:has(input:checked) {
    border-color: var(--accent-border);
    background: var(--accent-soft);
    box-shadow: inset 0 0 0 1px rgba(182, 156, 255, 0.06);
}

.creation-type-card input {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
    pointer-events: none;
}

.creation-type-icon {
    display: grid;
    min-width: 29px;
    height: 29px;
    place-items: center;
    color: var(--accent);
    font-size: 21px;
}

.creation-type-copy {
    display: flex;
    min-width: 0;
    flex-direction: column;
    gap: 4px;
}

.creation-type-copy strong {
    color: var(--text);
    font-size: 12px;
    font-weight: 700;
}

.creation-type-copy > span {
    color: var(--text-muted);
    font-size: 10px;
    line-height: 1.45;
}

.creation-type-copy > .creation-type-availability {
    color: var(--warning);
    font-size: 9px;
}

.generation-capability-status {
    margin: 9px 0 0;
    color: var(--text-muted);
    font-size: 11px;
    line-height: 1.5;
}

.selection-indicator {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 14px;
    height: 14px;
    border: 1px solid #5a5968;
    border-radius: 50%;
}

.creation-type-card.selected .selection-indicator,
.creation-type-card:has(input:checked) .selection-indicator {
    border: 4px solid var(--accent);
    background: #1b1726;
}

/* Optional settings and advanced mode */

.optional-settings-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 17px;
}

.field-group {
    min-width: 0;
}

.field-hint {
    margin: 7px 0 0;
    color: var(--text-muted);
    font-size: 10px;
    line-height: 1.55;
}

.upload-control {
    display: flex;
    width: 100%;
    min-height: 43px;
    align-items: center;
    gap: 9px;
    overflow: hidden;
    padding: 9px 12px;
    border: 1px dashed #494858;
    border-radius: var(--radius-sm);
    background: #15151c;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 12px;
    transition:
        border-color 160ms ease,
        background 160ms ease;
}

.upload-control:hover {
    border-color: var(--accent-border);
    background: var(--accent-soft);
}

.upload-control > span:first-child {
    color: var(--accent);
    font-size: 18px;
}

#reference-audio-label {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.advanced-toggle {
    display: flex;
    min-height: 61px;
    align-items: center;
    gap: 6px;
    padding: 12px;
    margin-top: 20px;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: #17171e;
    cursor: pointer;
    transition:
        border-color 160ms ease,
        background 160ms ease;
}

.advanced-toggle:hover {
    border-color: #4a4858;
    background: #1c1b25;
}

.advanced-toggle > input {
    width: 16px;
    height: 16px;
    flex: 0 0 auto;
    accent-color: var(--accent);
}

.advanced-toggle-copy {
    display: flex;
    flex: 1;
    flex-direction: column;
    gap: 2px;
}

.advanced-toggle-copy strong {
    color: var(--text);
    font-size: 12px;
}

.advanced-toggle-copy > span {
    color: var(--text-muted);
    font-size: 10px;
}

.advanced-toggle-arrow {
    color: var(--text-muted);
    font-size: 17px;
    transition: transform 160ms ease;
}

.advanced-toggle:has(input:checked) .advanced-toggle-arrow {
    transform: rotate(180deg);
}

.advanced-options {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 17px;
    padding: 18px 0 0;
    animation: reveal 180ms ease both;
}

@keyframes reveal {
    from {
        opacity: 0;
        transform: translateY(-4px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Generation footer */

.form-feedback {
    padding: 11px 13px;
    margin: 0 0 16px;
    border: 1px solid var(--accent-border);
    border-radius: var(--radius-sm);
    background: var(--accent-soft);
    color: var(--text-secondary);
    font-size: 12px;
    line-height: 1.6;
}

.form-feedback.is-success {
    border-color: rgba(113, 214, 161, 0.35);
    background: var(--success-soft);
}

.form-feedback.is-warning {
    border-color: rgba(241, 199, 121, 0.35);
    background: var(--warning-soft);
}

.form-feedback.is-error {
    border-color: rgba(255, 146, 156, 0.35);
    background: var(--danger-soft);
}

.generation-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    padding-top: 21px;
    border-top: 1px solid var(--border-soft);
}

.generation-cost {
    display: flex;
    min-width: 0;
    flex-direction: column;
    gap: 2px;
}

.cost-label {
    color: var(--text-muted);
    font-size: 14px;
}

.generation-cost strong {
    color: var(--text);
    font-size: 18px;
    font-weight: 750;
    letter-spacing: -0.02em;
}

.cost-note {
    color: var(--text-muted);
    font-size: 10px;
    line-height: 1.5;
}

.primary-button {
    min-height: 43px;
    padding: 10px 15px;
    background: var(--accent);
    color: #21172f;
    font-size: 12px;
    font-weight: 750;
    white-space: nowrap;
}

.primary-button:disabled {
    background: #625c70;
    color: #d0c8de;
}

.generate-button {
    min-height: 47px;
    gap: 6px;
    padding: 11px 17px;
}

.generate-button > span:first-child {
    font-size: 16px;
}

.generate-button > span:last-child {
    font-size: 17px;
}

.generation-disclaimer {
    margin: 14px 0 0;
    color: var(--text-muted);
    font-size: 10px;
    line-height: 1.7;
}

/* Right-hand information cards */

.creation-aside {
    display: flex;
    min-width: 0;
    flex-direction: column;
    gap: 15px;
}

.aside-card {
    padding: 19px;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    background: rgba(24, 24, 32, 0.82);
}

.inspiration-card {
    position: relative;
    overflow: hidden;
    padding-top: 22px;
    background:
        radial-gradient(
            circle at 100% 0,
            rgba(182, 156, 255, 0.14),
            transparent 60%
        ),
        rgba(24, 24, 32, 0.9);
}

.aside-card-icon {
    display: grid;
    width: 39px;
    height: 39px;
    place-items: center;
    margin-bottom: 22px;
    border: 1px solid var(--accent-border);
    border-radius: 12px;
    background: var(--accent-soft);
    color: var(--accent);
    font-size: 22px;
}

.inspiration-card .eyebrow {
    font-size: 9px;
    line-height: 1.5;
}

.inspiration-card h2 {
    max-width: 230px;
    margin: 0 0 11px;
    font-size: 19px;
    line-height: 1.4;
    letter-spacing: -0.035em;
}

.inspiration-card > p:last-child {
    margin-bottom: 0;
    font-size: 14px;
    line-height: 1.8;
}

.workflow-card h2,
.recent-card h2 {
    margin-bottom: 17px;
    font-size: 14px;
}

.recent-generations {
    display: grid;
    gap: 9px;
}

.recent-generation-entry {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    min-width: 0;
    padding: 10px 12px;
    border: 1px solid var(--border-color, rgba(255, 255, 255, .1));
    border-radius: 12px;
    background: rgba(255, 255, 255, .035);
}

.recent-generation-cover {
    display: grid;
    flex: 0 0 34px;
    width: 34px;
    height: 34px;
    place-items: center;
    border-radius: 9px;
    background: linear-gradient(145deg, #783fff, #21c7b7);
    color: #fff;
    font-size: 19px;
}

.recent-generation-title {
    flex: 1 1 auto;
    min-width: 0;
    overflow: hidden;
    padding: 0;
    border: 0;
    background: transparent;
    color: inherit;
    font: inherit;
    font-weight: 600;
    text-align: left;
    text-overflow: ellipsis;
    white-space: nowrap;
    cursor: pointer;
}

.recent-generation-title:focus-visible {
    outline: 2px solid var(--accent, #b6ff45);
    outline-offset: 3px;
}

.workflow-list {
    display: flex;
    flex-direction: column;
    gap: 18px;
    padding: 0;
    margin: 0;
    list-style: none;
}

.workflow-list li {
    display: flex;
    align-items: flex-start;
    gap: 11px;
}

.workflow-number {
    display: grid;
    width: 27px;
    height: 27px;
    flex: 0 0 auto;
    place-items: center;
    border: 1px solid var(--border);
    border-radius: 9px;
    background: #20202a;
    color: var(--accent);
    font-size: 14px;
    font-weight: 750;
}

.workflow-list li > span:last-child {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.workflow-list strong {
    color: var(--text);
    font-size: 14px;
    font-weight: 650;
}

.workflow-list li > span:last-child > span {
    color: var(--text-muted);
    font-size: 10px;
    line-height: 1.6;
}

.aside-card-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
}

.aside-card-heading h2 {
    margin-bottom: 12px;
}

.aside-card-heading .text-button {
    margin-top: -9px;
}

.empty-state-small {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 19px 8px 8px;
    text-align: center;
}

.empty-state-icon {
    display: grid;
    width: 47px;
    height: 47px;
    place-items: center;
    border: 1px solid var(--border);
    border-radius: 15px;
    background: #20202a;
    color: var(--accent);
    font-size: 24px;
}

.empty-state-small .empty-state-icon {
    width: 38px;
    height: 38px;
    margin-bottom: 12px;
    border-radius: 12px;
    font-size: 20px;
}

.empty-state-small p {
    margin-bottom: 5px;
    color: var(--text-secondary);
    font-size: 14px;
}

.empty-state-small > span:last-child {
    color: var(--text-muted);
    font-size: 10px;
    line-height: 1.6;
}

/* Library */

.library-toolbar {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 23px;
}

.search-field {
    display: flex;
    min-width: 0;
    min-height: 43px;
    flex: 1;
    align-items: center;
    gap: 9px;
    padding: 0 13px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: #15151b;
    color: var(--text-muted);
}

.search-field:focus-within {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(182, 156, 255, 0.08);
}

.search-field > span {
    font-size: 21px;
    line-height: 1;
}

.search-field input {
    width: 100%;
    min-width: 0;
    border: 0;
    outline: none;
    background: transparent;
    color: var(--text);
    font-size: 12px;
}

.search-field input:focus-visible {
    outline: none;
}

.library-filter {
    width: auto;
    min-width: 155px;
}

#library-view .page-heading { margin-bottom: 14px; }
#library-view .page-heading .eyebrow,
#library-view .page-heading .page-description { display: none; }
.library-content {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 6px;
}

.song-player-screen {
    max-width: 900px;
    margin: 12px auto 0;
    padding: clamp(16px, 4vw, 30px);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    background: linear-gradient(145deg, rgba(34, 31, 45, .82), var(--surface));
}
.song-player-screen[hidden] { display: none; }
.song-player-main {
    display: grid;
    grid-template-columns: minmax(180px, 300px) minmax(0, 1fr);
    align-items: center;
    gap: clamp(20px, 5vw, 48px);
}
.song-player-cover-slot { min-width: 0; }
.song-player-cover {
    width: 100%;
    height: auto;
    aspect-ratio: 1;
    flex: none;
    border-radius: 18px;
    object-fit: cover;
    box-shadow: 0 18px 44px rgba(0, 0, 0, .34);
}
.song-player-information { min-width: 0; }
.song-player-information .eyebrow { margin-bottom: 8px; }
.song-player-title { margin: 0; font-size: clamp(22px, 4vw, 34px); line-height: 1.15; overflow-wrap: anywhere; }
.song-player-artist { margin: 8px 0 18px; color: var(--text-secondary); font-size: 14px; }
.song-player-version-picker { display: grid; gap: 6px; max-width: 360px; color: var(--text-muted); font-size: 12px; }
.song-player-version-picker .text-input { width: 100%; }
.song-player-version-label { margin: 0; color: var(--text-secondary); font-size: 12px; }
.song-player-controls { display: flex; justify-content: center; align-items: center; gap: 22px; margin: 30px 0 20px; }
.song-player-toggle,
.song-player-skip {
    display: inline-grid;
    place-items: center;
    border: 1px solid var(--border);
    color: var(--text);
    cursor: pointer;
}
.song-player-toggle { width: 62px; height: 62px; border-radius: 50%; background: var(--accent); color: #15111f; font-size: 24px; font-weight: 750; }
.song-player-toggle:disabled { cursor: wait; opacity: .55; }
.song-player-skip { width: 42px; height: 42px; border-radius: 50%; background: rgba(255,255,255,.04); font-size: 12px; font-weight: 650; }
.song-player-seek { display: block; width: 100%; accent-color: var(--accent); }
.song-player-times { display: flex; justify-content: space-between; margin-top: 4px; color: var(--text-muted); font-size: 11px; font-variant-numeric: tabular-nums; }
.song-player-status { min-height: 1.5em; margin: 14px 0; color: var(--text-secondary); font-size: 12px; text-align: center; }
.song-player-status[data-state="error"] { color: var(--danger, #ff7878); }
.song-player-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; }
.song-player-actions button:disabled { cursor: wait; opacity: .65; }
.song-player-cover-details { margin: 14px 0; padding: 12px; border: 1px solid var(--border); border-radius: var(--radius-md); background: var(--surface-soft); }
.song-player-cover-details[hidden] { display: none; }
.song-player-cover-details > summary { color: var(--text-secondary); cursor: pointer; font-weight: 650; }
.song-player-cover-details > summary:hover { color: var(--text); }
.song-player-screen .library-download-status { min-height: 1.4em; text-align: center; }
.song-player-derived-section { display: grid; gap: 9px; margin-top: 20px; padding: 14px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface-soft); }
.song-player-derived-section[hidden] { display: none; }
.song-player-derived-section h3,
.song-player-derived-section > p { margin: 0; }
.song-player-derived-section > p,
.song-player-derived-meta,
.song-player-derived-copy { color: var(--text-secondary); font-size: 12px; line-height: 1.5; }
.song-player-derived-list { display: grid; gap: 8px; }
.song-player-derived-entry { display: grid; justify-items: start; gap: 6px; padding: 11px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); }
.song-player-derived-entry strong { overflow-wrap: anywhere; }
.song-player-derived-copy { margin: 0; white-space: pre-wrap; }
.song-player-derived-entry .button { min-height: 40px; }

.library-card {
    display: flex;
    min-width: 0;
    min-height: 58px;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 7px 11px;
    border: 1px solid color-mix(in srgb, var(--border) 78%, transparent);
    border-radius: 14px;
    background: linear-gradient(110deg, rgba(255,255,255,.035), rgba(255,255,255,.012)), var(--surface);
    cursor: pointer;
    transition: border-color 160ms ease, background 160ms ease, transform 160ms ease;
}

.library-card:hover,
.library-card:focus-visible {
    border-color: var(--accent-border);
    background: linear-gradient(110deg, rgba(182,156,255,.075), rgba(255,255,255,.02)), var(--surface-raised, var(--surface));
}
.library-card:hover { transform: translateY(-1px); }
.library-card:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.library-card-title-group { display: flex; min-width: 0; flex: 1; align-items: center; gap: 11px; }
.library-cover {
    display: block;
    width: 64px;
    height: 64px;
    flex: 0 0 64px;
    overflow: hidden;
    border-radius: 11px;
    background: #252238;
    object-fit: cover;
    box-shadow: 0 5px 16px rgba(0, 0, 0, .2);
}
.library-cover-small { width: 48px; height: 48px; flex-basis: 48px; border-radius: 9px; }
.library-cover-compact { width: 44px; height: 44px; flex-basis: 44px; border-radius: 10px; box-shadow: 0 3px 10px rgba(0,0,0,.25); }
.library-cover-detail { width: 104px; height: 104px; flex-basis: 104px; border-radius: 16px; }
.library-card-copy { display: grid; min-width: 0; gap: 4px; }
.library-card-title {
    min-width: 0;
    margin: 0;
    overflow: hidden;
    white-space: nowrap;
    color: var(--text);
    font-size: 14px;
    font-weight: 620;
    line-height: 1.25;
    text-overflow: ellipsis;
}
.library-card-meta { display: flex; min-width: 0; align-items: center; gap: 7px; overflow: hidden; color: var(--text-muted); font-size: 10px; line-height: 1.25; white-space: nowrap; }
.library-card-type { flex: 0 0 auto; color: color-mix(in srgb, var(--accent) 78%, white); font-weight: 650; }
.library-card-music-style { min-width: 0; overflow: hidden; color: var(--text-muted); font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.library-card-state { display: inline-flex; flex: 0 0 auto; align-items: center; gap: 4px; padding: 3px 7px; border: 1px solid rgba(255,255,255,.09); border-radius: 999px; background: rgba(255,255,255,.035); color: var(--text-muted); font-size: 9px; font-weight: 600; white-space: nowrap; }
.library-card-state::before { width: 5px; height: 5px; border-radius: 50%; background: currentColor; content: ""; }
.library-card-state[data-state="ready"] { color: #9bd8b1; border-color: rgba(104,196,142,.2); background: rgba(104,196,142,.08); }
.library-card-state[data-state="failed"] { color: var(--danger, #ff7878); border-color: rgba(255,120,120,.2); background: rgba(255,120,120,.08); }
.library-card-state[data-state="pending"] { color: var(--warning, #edc46a); border-color: rgba(237,196,106,.2); background: rgba(237,196,106,.08); }
.library-card-state[data-state="unavailable"] { color: var(--text-muted); }
.library-card-actions { display: flex; flex: 0 0 auto; align-items: center; gap: 6px; }
.library-quick-play,
.library-card-details {
    display: inline-grid;
    width: 32px;
    min-width: 32px;
    height: 32px;
    min-height: 32px;
    padding: 0;
    place-items: center;
    border: 1px solid var(--border);
    border-radius: 50%;
    background: rgba(255,255,255,.025);
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 13px;
}
.library-quick-play { color: var(--text); background: rgba(182,156,255,.1); }
.library-quick-play:hover,
.library-card-details:hover { border-color: var(--accent-border); color: var(--text); background: rgba(182,156,255,.15); }
.library-quick-play:disabled { cursor: wait; opacity: .65; }
.library-quick-audio { width: min(100%, 230px); }
.library-count { display: block; margin: 0 0 8px; color: var(--text-muted); font-size: 11px; }
.library-detail-view { grid-column: 1 / -1; min-width: 0; }
.library-cover-editor { min-width: 0; margin: 14px 0; padding: 12px; border: 1px solid var(--border); border-radius: var(--radius-md); background: var(--surface); }
.library-cover-editor-copy { margin: 4px 0 8px; color: var(--text-muted); font-size: 12px; }
.library-cover-editor-message { min-height: 1em; margin: 4px 0 8px; color: var(--accent); font-size: 12px; }
.library-cover-editor-error { color: var(--danger, #ff7878); font-size: 12px; }
.library-cover-options { display: grid; grid-template-columns: repeat(auto-fill, minmax(76px, 1fr)); gap: 8px; max-width: 680px; margin: 10px 0; }
.library-cover-option { display: grid; min-width: 0; justify-items: center; gap: 5px; padding: 7px 5px; border: 1px solid var(--border); border-radius: 11px; background: linear-gradient(145deg, rgba(255,255,255,.045), rgba(255,255,255,.01)); color: var(--text-muted); cursor: pointer; font-size: 10px; transition: border-color 140ms ease, transform 140ms ease, background 140ms ease; }
.library-cover-option:hover { transform: translateY(-2px); border-color: var(--accent-border); color: var(--text); }
.library-cover-option img { width: 56px; height: 56px; border-radius: 8px; object-fit: cover; box-shadow: 0 3px 10px rgba(0,0,0,.22); }
.library-cover-option.is-selected { border-color: var(--accent); box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 26%, transparent); color: var(--text); }
.library-cover-option:disabled { cursor: wait; opacity: .65; }
.library-cover-upload-label { display: inline-flex; align-items: center; min-height: 30px; margin: 4px 0; padding: 0 10px; border: 1px solid var(--border); border-radius: 8px; color: var(--text); cursor: pointer; font-size: 12px; }
.library-cover-upload-label input { width: min(180px, 42vw); margin-left: 8px; font-size: 11px; }
.library-cover-reset { min-height: 30px; margin: 4px 8px 4px 0; padding: 0 10px; font-size: 12px; }
.library-version-cover-editor { margin-top: 6px; padding-top: 6px; border-top: 1px solid var(--border); }
.library-version-cover-editor > summary { width: fit-content; color: var(--text-secondary); cursor: pointer; font-size: 12px; }
.library-version-cover-editor > summary:hover { color: var(--text); }
.library-cover-retry { padding: 5px 9px; border: 1px solid var(--border); border-radius: 7px; background: transparent; color: var(--text); cursor: pointer; }
.library-back-button {
    margin: 0 0 12px;
    padding: 8px 0;
    border: 0;
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    font: inherit;
}
.library-back-button:hover { color: var(--text); }
.library-detail-card {
    display: grid;
    grid-template-columns: minmax(0, 1.2fr) minmax(260px, .8fr);
    gap: 18px 24px;
    padding: 20px;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: var(--surface);
}
.library-detail-header { display: flex; min-width: 0; align-items: center; gap: 16px; grid-column: 1 / -1; }
.library-detail-title { margin: 0; overflow-wrap: anywhere; font-size: 22px; font-weight: 650; }
.library-detail-summary { display: flex; flex-wrap: wrap; align-content: start; gap: 7px; margin: 0; grid-column: 1 / -1; }
.library-summary-chip { display: flex; min-width: 0; align-items: baseline; gap: 6px; padding: 6px 9px; border: 1px solid var(--border); border-radius: 999px; background: rgba(255,255,255,.025); }
.library-summary-chip dt { color: var(--text-muted); font-size: 10px; }
.library-summary-chip dd { margin: 0; overflow: hidden; color: var(--text); font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.library-summary-chip.is-failed dd { color: var(--danger, #ff7878); }
.library-summary-chip.is-pending dd { color: var(--warning, #edc46a); }
.library-full-configuration { min-width: 0; grid-column: 1 / -1; border-top: 1px solid var(--border); padding-top: 10px; }
.library-full-configuration > summary { width: fit-content; color: var(--text-secondary); cursor: pointer; font-size: 12px; }
.library-full-configuration > summary:hover { color: var(--text); }
.library-full-configuration .library-detail-information { display: grid; align-content: start; gap: 8px; margin: 12px 0 0; }
.library-detail-field { min-width: 0; padding-bottom: 10px; border-bottom: 1px solid var(--border); }
.library-detail-field dt { margin-bottom: 4px; color: var(--text-muted); font-size: 11px; }
.library-detail-field dd { margin: 0; color: var(--text); font-size: 13px; line-height: 1.6; white-space: pre-wrap; overflow-wrap: anywhere; }
.library-detail-lyrics dd { max-height: 300px; overflow: auto; }
.library-detail-versions { display: grid; align-content: start; gap: 10px; min-width: 0; }
.library-detail-section-title { margin: 0 0 2px; font-size: 14px; }
.library-audio-version {
    display: grid;
    min-width: 0;
    gap: 6px;
    padding: 10px;
    border: 1px solid var(--border);
    border-radius: 11px;
    background: rgba(255, 255, 255, .02);
}
.library-audio-version-heading { display: flex; min-width: 0; align-items: center; gap: 10px; }
.library-audio-version-heading .library-card-style { min-width: 0; margin: 0; }
.library-card-style { color: var(--text-secondary); font-size: 12px; line-height: 1.55; }
.library-detail-direct-audio { grid-column: 1 / -1; }
.library-detail-actions { grid-column: 1 / -1; justify-content: end; }
.library-detail-actions .button { min-height: 34px; }
.library-card-error { grid-column: 1 / -1; }
.library-pending-message { color: var(--warning, #edc46a); font-size: 12px; line-height: 1.5; overflow-wrap: anywhere; }

.library-content,
.voices-content {
    min-width: 0;
}

.empty-state {
    display: flex;
    min-height: 340px;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 35px 22px;
    border: 1px dashed #383844;
    border-radius: var(--radius-lg);
    background: rgba(24, 24, 32, 0.48);
    text-align: center;
}

.empty-state > .empty-state-icon {
    margin-bottom: 20px;
}

.empty-state h2 {
    margin-bottom: 9px;
    font-size: 19px;
}

.empty-state p {
    max-width: 390px;
    margin-bottom: 20px;
    font-size: 12px;
    line-height: 1.8;
}

.empty-state .primary-button {
    margin-top: 2px;
}

.library-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.library-item {
    display: flex;
    min-width: 0;
    align-items: center;
    gap: 14px;
    padding: 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: var(--surface);
}

.library-item-cover {
    display: grid;
    width: 57px;
    height: 57px;
    flex: 0 0 auto;
    place-items: center;
    overflow: hidden;
    border-radius: 10px;
    background:
        radial-gradient(circle at 30% 25%, #7561a8, transparent 55%),
        linear-gradient(145deg, #363047, #1c1b28);
    color: #e1d5ff;
    font-size: 22px;
}

.library-item-cover img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.library-item-info {
    min-width: 0;
    flex: 1;
}

.library-item-info h3 {
    overflow: hidden;
    margin: 0 0 4px;
    font-size: 13px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.library-item-info p {
    overflow: hidden;
    margin: 0;
    color: var(--text-muted);
    font-size: 14px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.library-item-actions {
    display: flex;
    flex: 0 0 auto;
    align-items: center;
    gap: 7px;
}

.library-item-status {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 8px;
    border: 1px solid var(--border);
    border-radius: 999px;
    color: var(--text-secondary);
    font-size: 10px;
}

.library-item-status.is-ready {
    border-color: rgba(113, 214, 161, 0.25);
    background: var(--success-soft);
    color: var(--success);
}

.library-item-status.is-failed {
    border-color: rgba(255, 146, 156, 0.25);
    background: var(--danger-soft);
    color: var(--danger);
}

.library-item-status.is-pending {
    border-color: rgba(241, 199, 121, 0.25);
    background: var(--warning-soft);
    color: var(--warning);
}

.library-action-button {
    display: grid;
    width: 35px;
    height: 35px;
    flex: 0 0 auto;
    place-items: center;
    border: 1px solid var(--border);
    border-radius: 9px;
    background: #20202a;
    color: var(--text-secondary);
    font-size: 14px;
}

.library-action-button:hover {
    border-color: var(--accent-border);
    color: var(--accent);
}

.library-action-button.is-liked {
    color: #ff9bb2;
}

/* Dialogs */

.app-dialog {
    width: min(520px, calc(100% - 32px));
    max-height: min(85vh, 760px);
    padding: 0;
    overflow: auto;
    border: 1px solid #41404f;
    border-radius: var(--radius-xl);
    background: #191920;
    color: var(--text);
    box-shadow: var(--shadow);
}

.app-dialog::backdrop {
    background: rgba(5, 5, 9, 0.76);
    backdrop-filter: blur(5px);
}

.dialog-content {
    position: relative;
    padding: 29px;
}

.dialog-close {
    position: absolute;
    top: 16px;
    right: 16px;
    display: grid;
    width: 34px;
    height: 34px;
    place-items: center;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: #22222b;
    color: var(--text-secondary);
    font-size: 22px;
}

.dialog-close:hover {
    background: var(--surface-hover);
    color: var(--text);
}

.dialog-content .eyebrow {
    padding-right: 30px;
}

.dialog-content h2 {
    margin-bottom: 12px;
    font-size: 23px;
    letter-spacing: -0.035em;
}

.dialog-content > p:not(.eyebrow) {
    font-size: 12px;
    line-height: 1.75;
}

.confirmation-summary {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 15px;
    margin-top: 18px;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: #14141a;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    max-height: min(38vh, 360px);
    overflow-y: auto;
}

.summary-row {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    font-size: 12px;
}

.summary-row > span:first-child {
    color: var(--text-muted);
}

.summary-row > span:last-child {
    max-width: 65%;
    color: var(--text);
    text-align: right;
    overflow-wrap: anywhere;
}

.dialog-actions {
    display: flex;
    justify-content: flex-end;
    flex-wrap: wrap;
    gap: 9px;
    margin-top: 22px;
}

.dialog-actions .primary-button,
.dialog-actions .secondary-button {
    min-height: 40px;
}

.dialog-actions .secondary-button {
    background: transparent;
}

/* Toast notifications */

.toast-container {
    position: fixed;
    z-index: 100;
    right: 20px;
    bottom: 20px;
    display: flex;
    width: min(370px, calc(100vw - 32px));
    flex-direction: column;
    gap: 9px;
    pointer-events: none;
}

.toast {
    display: flex;
    align-items: flex-start;
    gap: 6px;
    padding: 13px 15px;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: #22222b;
    color: var(--text);
    box-shadow: var(--shadow);
    font-size: 12px;
    line-height: 1.65;
    overflow-wrap: anywhere;
    animation: toast-in 180ms ease both;
}

.toast::before {
    content: "";
    width: 7px;
    height: 7px;
    flex: 0 0 auto;
    margin-top: 6px;
    border-radius: 50%;
    background: var(--accent);
}

.toast.is-success::before {
    background: var(--success);
}

.toast.is-error::before {
    background: var(--danger);
}

.toast.is-warning::before {
    background: var(--warning);
}

@keyframes toast-in {
    from {
        opacity: 0;
        transform: translateY(7px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Responsive layouts */

@media (min-width: 1500px) {
    .view {
        padding-right: 48px;
        padding-left: 48px;
    }

    .creation-layout {
        grid-template-columns: minmax(0, 1fr) 320px;
        gap: 30px;
    }

    .creation-form {
        padding: 30px;
    }

    .aside-card {
        padding: 22px;
    }
}

@media (max-width: 1190px) {
    :root {
        --sidebar-width: 225px;
    }

    .view {
        padding-right: 25px;
        padding-left: 25px;
    }

    .topbar {
        padding-right: 25px;
        padding-left: 25px;
    }

    .creation-layout {
        grid-template-columns: minmax(0, 1fr) 250px;
        gap: 17px;
    }

    .creation-form {
        padding: 20px;
    }

    .creation-type-options {
        gap: 7px;
    }

    .creation-type-card {
        padding: 12px 9px;
    }

    .creation-type-copy strong {
        font-size: 11px;
    }

    .aside-card {
        padding: 16px;
    }
}

@media (max-width: 960px) {
    .creation-layout {
        grid-template-columns: minmax(0, 1fr);
    }

    .creation-aside {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        align-items: start;
    }

    .recent-card {
        grid-column: 1 / -1;
    }

    .inspiration-card {
        min-height: 100%;
    }

    .workflow-card {
        min-height: 100%;
    }
}

@media (max-width: 760px) {
    :root {
        --sidebar-width: 270px;
        --topbar-height: 58px;
    }

    .sidebar {
        z-index: 50;
        width: min(var(--sidebar-width), calc(100vw - 54px));
        box-shadow: var(--shadow);
        transform: translateX(-105%);
        transition: transform 200ms ease;
    }

    .sidebar.sidebar-open {
        transform: translateX(0);
    }

    .topbar-library-button {
        min-height: 32px;
        padding: 6px 9px;
        font-size: 10px;
    }

    .sidebar-backdrop {
        position: fixed;
        z-index: 40;
        inset: 0;
        background: rgba(4, 4, 8, 0.68);
        backdrop-filter: blur(3px);
    }

    .main-content {
        margin-left: 0;
    }

    .mobile-menu-button {
        display: inline-flex;
        width: 34px;
        height: 34px;
        font-size: 16px;
    }

    .topbar {
        gap: 11px;
        padding: 0 18px;
    }

    .breadcrumb {
        flex: 1;
        gap: 7px;
        font-size: 11px;
    }

    .topbar-actions {
        gap: 0;
    }

    .connection-indicator {
        font-size: 0;
    }

    .connection-dot {
        width: 8px;
        height: 8px;
    }

    .view {
        padding: 26px 18px 40px;
    }

    .page-heading {
        margin-bottom: 23px;
    }

    h1 {
        font-size: clamp(25px, 5vw, 32px);
    }

    .page-description {
        font-size: 12px;
    }

    .creation-form {
        padding: 20px;
    }
}

@media (max-width: 540px) {
    .view {
        padding: 22px 12px 32px;
    }

    .topbar {
        padding: 0 12px;
    }

    .page-heading {
        gap: 12px;
    }

    .page-heading > .primary-button {
        min-height: 38px;
        padding: 8px 10px;
        font-size: 11px;
    }

    .creation-form {
        padding: 16px 13px;
        border-radius: var(--radius-md);
    }

    .form-section {
        padding-bottom: 22px;
        margin-bottom: 22px;
    }

    .section-heading {
        margin-bottom: 16px;
    }

    .creation-type-options {
        grid-template-columns: 1fr;
        gap: 8px;
    }

    .creation-type-card {
        min-height: 75px;
        flex-direction: row;
        align-items: center;
        gap: 12px;
        padding: 12px;
    }

    .creation-type-icon {
        width: 33px;
        flex: 0 0 auto;
    }

    .creation-type-copy {
        flex: 1;
    }

    .creation-type-copy strong {
        font-size: 12px;
    }

    .creation-type-copy > span {
        font-size: 11px;
    }

    .selection-indicator {
        top: 50%;
        right: 13px;
        transform: translateY(-50%);
    }

    .optional-settings-grid,
    .advanced-options {
        grid-template-columns: minmax(0, 1fr);
        gap: 15px;
    }

    .generation-footer {
        align-items: stretch;
        flex-direction: column;
        gap: 14px;
    }

    .generation-cost {
        display: grid;
        grid-template-columns: auto 1fr;
        align-items: baseline;
        column-gap: 10px;
    }

    .generation-cost strong {
        text-align: right;
    }

    .cost-note {
        grid-column: 1 / -1;
    }

    .generate-button {
        width: 100%;
        min-height: 49px;
        justify-content: center;
    }

    .creation-aside {
        grid-template-columns: minmax(0, 1fr);
    }

    .recent-card {
        grid-column: auto;
    }

    .inspiration-card,
    .workflow-card {
        min-height: 0;
    }

    .library-toolbar {
        align-items: stretch;
        flex-direction: column;
    }

    .library-filter {
        width: 100%;
    }

    .library-item {
        flex-wrap: wrap;
        gap: 10px;
    }

    .library-item-cover {
        width: 48px;
        height: 48px;
    }

    .library-item-info {
        flex-basis: calc(100% - 65px);
    }

    .library-item-actions {
        width: 100%;
        justify-content: flex-end;
        padding-top: 4px;
    }

    .library-item-status {
        margin-right: auto;
    }

    .empty-state {
        min-height: 280px;
        padding: 26px 15px;
    }

    .dialog-content {
        padding: 24px 19px;
    }

    .dialog-actions {
        flex-direction: column-reverse;
    }

    .dialog-actions .primary-button,
    .dialog-actions .secondary-button {
        width: 100%;
    }

    .toast-container {
        right: 12px;
        bottom: 12px;
        width: calc(100vw - 24px);
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        scroll-behavior: auto !important;
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}


/* Lyric brief: stored with the music request; no model is called yet. */
.lyrics-assistant-note,
.lyrics-brief-context {
    color: var(--text-muted, #aaa);
    font-size: 0.8rem;
    line-height: 1.5;
}
.lyrics-assistant-note {
    margin: 9px 0 0;
}
.lyrics-assistant-note[data-state="unavailable"] {
    padding: 9px 11px;
    border: 1px solid var(--warning-soft);
    border-radius: 10px;
    background: var(--warning-soft);
    color: var(--warning);
}
.lyrics-assistant-note[data-state="ready"] {
    padding: 9px 11px;
    border: 1px solid var(--accent-border);
    border-radius: 10px;
    background: var(--accent-soft);
    color: var(--accent-hover);
}
.lyrics-assistant-note[data-state="error"] {
    padding: 9px 11px;
    border: 1px solid var(--danger-soft);
    border-radius: 10px;
    background: var(--danger-soft);
    color: var(--danger);
}
.lyrics-assistant-dialog {
    width: min(38rem, calc(100vw - 2rem));
    max-height: min(86vh, 42rem);
    overflow: auto;
    color: var(--text-primary, #f4f4f5);
    background: var(--surface, #18181d);
    border: 1px solid var(--border, #333);
    border-radius: 1rem;
    padding: 1.25rem;
}
.lyrics-assistant-dialog::backdrop { background: rgb(0 0 0 / 70%); }
.lyrics-assistant-form { display: grid; gap: 0.6rem; }
.lyrics-assistant-form .dialog-heading { display: flex; justify-content: space-between; align-items: start; }
.lyrics-assistant-form h2 { margin: 0; }
.lyrics-brief-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0.75rem; }
.lyrics-assistant-actions { display: flex; flex-wrap: wrap; gap: 0.6rem; justify-content: end; }
.lyrics-provider-status { margin: 0; padding: 0.65rem 0.75rem; border-radius: 0.65rem; background: rgb(255 255 255 / 5%); color: var(--warning, #edc46a); font-size: 0.84rem; line-height: 1.4; }
.lyrics-provider-status[data-state="error"] { color: #ffb4ab; background: rgb(255 90 70 / 9%); }
.lyrics-provider-status[data-state="ready"] { color: #9dd9b2; }
.lyrics-advanced-options { border: 1px solid var(--border, #333); border-radius: 0.7rem; padding: 0.65rem 0.8rem; }
.lyrics-advanced-options summary { cursor: pointer; color: var(--text-muted, #aaa); font-size: 0.9rem; }
.lyrics-advanced-fields { display: grid; gap: 0.6rem; padding-top: 0.75rem; }
.lyrics-assistant-form button:disabled { cursor: not-allowed; opacity: 0.62; }
.lyrics-draft-panel { display: grid; gap: 0.75rem; padding-top: 1rem; border-top: 1px solid var(--border, #333); }
@media (max-width: 760px) {
    .song-player-main { grid-template-columns: minmax(0, 1fr); justify-items: center; text-align: center; }
    .song-player-cover-slot { width: min(72vw, 300px); }
    .song-player-version-picker { margin-inline: auto; text-align: left; }
    .library-detail-card {
        min-width: 0;
        grid-template-columns: minmax(0, 1fr);
        gap: 16px;
        padding: 14px;
    }
    .library-detail-card > *,
    .library-detail-summary,
    .library-full-configuration,
    .library-detail-versions {
        min-width: 0;
        max-width: 100%;
    }
    .library-detail-header { grid-column: 1; }
}

@media (max-width: 560px) {
    .song-player-screen { margin-top: 6px; padding: 16px 12px; border-radius: 14px; }
    .song-player-cover-slot { width: min(68vw, 250px); }
    .song-player-controls { gap: 18px; margin: 22px 0 16px; }
    .song-player-toggle { width: 56px; height: 56px; }
    .lyrics-brief-grid { grid-template-columns: 1fr; }
    .lyrics-actions .secondary-button { flex: 1 1 100%; justify-content: center; }
    .lyrics-actions .text-button { flex: 0 0 auto; }
    .library-content { grid-template-columns: 1fr; gap: 5px; }
    .library-card { min-height: 54px; padding: 6px 8px; gap: 7px; border-radius: 12px; }
    .library-card-title-group { gap: 8px; }
    .library-cover-compact { width: 38px; height: 38px; flex-basis: 38px; border-radius: 9px; }
    .library-card-copy { gap: 3px; }
    .library-card-title { font-size: 13px; }
    .library-card-meta { gap: 5px; font-size: 9px; }
    .library-card-state { gap: 3px; padding: 2px 5px; font-size: 8px; }
    .library-card-state::before { width: 4px; height: 4px; }
    .library-card-actions { gap: 4px; }
    .library-quick-play, .library-card-details { width: 29px; min-width: 29px; height: 29px; min-height: 29px; }
    .library-detail-header { gap: 12px; }
    .library-cover-detail { width: 76px; height: 76px; flex-basis: 76px; }
    .library-detail-title { font-size: 18px; }
}

/* Mi cuenta: perfil propio y sesiones verificadas por el servidor. */
.account-view .page-heading { margin-bottom: 24px; }
.account-layout { display: grid; grid-template-columns: minmax(0, .82fr) minmax(0, 1.18fr); align-items: start; gap: 16px; }
.account-layout[hidden], .account-sign-in-state[hidden] { display: none; }
.account-panel { min-width: 0; padding: 20px; border: 1px solid var(--border); border-radius: var(--radius-lg); background: linear-gradient(150deg, rgba(34, 31, 45, .78), var(--bg-elevated)); }
.account-admin-push-panel[hidden] { display: none; }
.account-admin-push-panel .account-session-actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.admin-push-toast { position: fixed; z-index: 1200; inset: auto 16px max(16px, env(safe-area-inset-bottom)); max-width: 520px; margin-inline: auto; padding: 14px 18px; border: 1px solid var(--border); border-radius: 14px; color: var(--text-primary); background: var(--bg-elevated); box-shadow: 0 12px 36px rgba(0,0,0,.28); }
.admin-push-toast[hidden] { display: none; }
.account-panel .section-heading { margin-bottom: 15px; }
.account-panel .section-heading h2 { margin: 0; font-size: 18px; }
.account-danger-zone { border-color: rgba(255,146,156,.32); }
.account-danger-zone h2 { color: var(--danger); }
.legal-links-panel { margin-top: 16px; }
.legal-link-list { display: flex; flex-wrap: wrap; gap: 8px 16px; margin: 12px 0; }
.legal-link-list a, #account-panel a { color: var(--accent-hover); }
.danger-button { min-height: 40px; padding: 10px 14px; border: 1px solid var(--danger); border-radius: var(--radius-sm); background: var(--danger); color: #211318; font: inherit; font-weight: 700; cursor: pointer; }
.danger-button:disabled { opacity: .55; cursor: not-allowed; }
.community-blocks-panel { margin: 12px 0; padding: 12px 14px; border: 1px solid var(--border); border-radius: var(--radius-md); background: rgba(255,255,255,.02); }
.community-blocks-panel summary { cursor: pointer; color: var(--text-secondary); font-size: 13px; font-weight: 650; }
.community-blocks-panel > p { margin: 8px 0; }
.community-blocks-list { display: grid; gap: 8px; margin-top: 10px; }
.community-block-item { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 9px 10px; border: 1px solid var(--border-soft); border-radius: var(--radius-sm); }
.account-current-user { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 12px; margin-bottom: 18px; padding: 12px 14px; border: 1px solid var(--border-soft); border-radius: var(--radius-md); background: rgba(255,255,255,.025); }
.account-current-user h3 { margin: 0; font-size: 15px; font-weight: 680; }
.account-current-user p { margin: 0; color: var(--text-secondary); font-size: 12px; overflow-wrap: anywhere; }
.account-profile-form { display: grid; gap: 8px; }
.account-profile-form .field-label { margin-top: 4px; }
.account-profile-form .text-input[readonly] { color: var(--text-secondary); opacity: .8; }
.account-field-note { margin: 0; color: var(--text-muted); font-size: 11px; line-height: 1.55; }
.account-form-footer { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin-top: 8px; }
.account-status, .account-error { min-height: 18px; margin: 0; font-size: 11px; line-height: 1.5; }
.account-status { color: var(--text-muted); }
.account-status[data-state="success"] { color: var(--success); }
.account-status[data-state="warning"] { color: var(--warning); }
.account-status[data-state="error"], .account-error { color: var(--danger); }
.account-error { margin: 5px 0; }
.account-sessions-heading { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.account-session-actions { display: flex; align-items: center; gap: 9px; }
.account-session-count { color: var(--text-muted); font-size: 11px; white-space: nowrap; }
.sessions-list { display: grid; gap: 8px; margin-top: 12px; }
.session-card { display: grid; grid-template-columns: minmax(0,1fr) auto; align-items: start; gap: 5px 12px; padding: 12px; border: 1px solid var(--border-soft); border-radius: var(--radius-md); background: rgba(255,255,255,.022); }
.session-card-title { margin: 0; font-size: 12px; font-weight: 680; }
.session-status { justify-self: end; padding: 3px 8px; border: 1px solid var(--border); border-radius: 999px; color: var(--text-secondary); font-size: 9px; text-transform: capitalize; }
.session-status-active { border-color: rgba(113,214,161,.22); background: var(--success-soft); color: var(--success); }
.session-status-revoked, .session-status-expired { color: var(--text-muted); }
.session-card-details { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 2px 13px; }
.session-card-details p { margin: 0; color: var(--text-muted); font-size: 10px; overflow-wrap: anywhere; }
.session-card-actions { grid-column: 1 / -1; display: flex; align-items: center; justify-content: flex-end; min-height: 28px; }
.session-current-label { color: var(--accent-hover); font-size: 10px; font-weight: 650; }
.session-revoke-button { min-height: 28px; padding: 4px 8px; border: 1px solid var(--border); border-radius: 7px; background: transparent; color: var(--text-secondary); font-size: 10px; cursor: pointer; }
.session-revoke-button:hover { border-color: var(--danger); color: var(--danger); }
.account-session-footer { display: flex; justify-content: flex-end; margin-top: 12px; }
.account-revoke-others { min-height: 34px; padding: 7px 10px; color: var(--text-secondary); font-size: 11px; }
.sessions-empty-message { margin: 0; padding: 12px; color: var(--text-muted); font-size: 12px; }
.account-sign-in-state { display: grid; justify-items: start; gap: 8px; max-width: 500px; padding: 25px; border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--bg-elevated); }
.account-sign-in-state h2 { margin: 0; font-size: 18px; }
.account-sign-in-state p { margin: 0 0 8px; color: var(--text-secondary); font-size: 12px; }
.account-state-icon { display: grid; width: 42px; height: 42px; place-items: center; border-radius: 13px; background: var(--accent-soft); color: var(--accent-hover); font-size: 22px; }

@media (max-width: 900px) {
    .account-layout { grid-template-columns: minmax(0,1fr); }
}

@media (max-width: 560px) {
    .account-panel { padding: 14px; }
    .account-sessions-heading { align-items: flex-start; flex-direction: column; }
    .account-session-actions { width: 100%; justify-content: space-between; }
    .session-card { padding: 10px; }
    .account-form-footer { align-items: stretch; flex-direction: column; }
}

/* Voices: metadata management, with provider-backed use clearly gated. */
.voices-provider-note,
.voice-form-note {
    margin: 0 0 16px;
    padding: 11px 13px;
    border: 1px solid var(--warning-soft);
    border-radius: var(--radius-sm);
    background: var(--warning-soft);
    color: var(--text-secondary);
    font-size: 12px;
    line-height: 1.6;
}

#voices-view .heading-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.voices-toolbar {
    display: flex;
    min-width: 0;
    align-items: center;
    gap: 9px;
    margin-bottom: 8px;
}

.voices-toolbar .search-field { flex: 1 1 260px; }
.voices-count { flex: 0 0 auto; color: var(--text-muted); font-size: 11px; }
.voices-status, .voices-error { min-height: 18px; margin: 7px 0; font-size: 12px; }
.voices-status { color: var(--text-muted); }
.voices-status[data-state="success"] { color: var(--success); }
.voices-status[data-state="error"], .voices-error { color: var(--danger); }
.voices-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 280px), 1fr)); gap: 12px; }

.voice-card {
    display: flex;
    min-width: 0;
    flex-direction: column;
    gap: 10px;
    padding: 16px;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: linear-gradient(145deg, rgba(35, 32, 47, .84), var(--surface));
}

.voice-card-heading { display: flex; min-width: 0; align-items: flex-start; justify-content: space-between; gap: 10px; }
.voice-card-name { min-width: 0; margin: 0; overflow-wrap: anywhere; font-size: 15px; font-weight: 680; }
.voice-card-description { margin: 0; color: var(--text-secondary); font-size: 12px; line-height: 1.6; overflow-wrap: anywhere; }
.voice-card-meta { margin: auto 0 0; color: var(--text-muted); font-size: 10px; }
.voice-status { min-height: 0; flex: 0 0 auto; padding: 4px 8px; border: 1px solid var(--border); border-radius: 999px; background: rgba(255,255,255,.035); color: var(--text-secondary); font-size: 10px; }
.voice-status-ready { border-color: rgba(113,214,161,.25); background: var(--success-soft); color: var(--success); }
.voice-status-failed { border-color: rgba(255,146,156,.25); background: var(--danger-soft); color: var(--danger); }
.voice-status-pending, .voice-status-processing { border-color: rgba(241,199,121,.2); background: var(--warning-soft); color: var(--warning); }
.voice-card-actions { display: flex; flex-wrap: wrap; gap: 7px; }
.voice-action { min-height: 33px; padding: 7px 10px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface-soft); color: var(--text); font-size: 11px; font-weight: 620; cursor: pointer; }
.voice-action:hover:not(:disabled) { border-color: var(--accent-border); background: var(--surface-hover); }
.voice-action-primary { border-color: transparent; background: var(--accent); color: #21172f; }
.voice-action-danger { color: var(--danger); }
.voice-action:disabled { cursor: not-allowed; opacity: .52; }
.voice-use-note { margin: -3px 0 0; color: var(--text-muted); font-size: 10px; line-height: 1.45; }
.voice-form { display: grid; gap: 9px; }
.voice-form h2 { margin: 0; }
.voice-form .voice-form-note { margin: 0 0 4px; }
.voice-details > p { line-height: 1.6; overflow-wrap: anywhere; }
.voice-details-list { display: grid; gap: 9px; margin: 16px 0; }
.voice-details-list > div { display: grid; grid-template-columns: minmax(75px, .35fr) 1fr; gap: 12px; padding-bottom: 8px; border-bottom: 1px solid var(--border-soft); }
.voice-details-list dt { color: var(--text-muted); font-size: 11px; }
.voice-details-list dd { margin: 0; color: var(--text); font-size: 12px; overflow-wrap: anywhere; }

/* Ayuda y soporte: formulario de usuario e historial propio. */
.support-view .page-heading { margin-bottom: 20px; }
.support-layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(280px, .82fr); align-items: start; gap: 16px; }
.support-layout[hidden] { display: none; }
.support-panel { min-width: 0; padding: 18px; border: 1px solid var(--border); border-radius: var(--radius-lg); background: linear-gradient(150deg, rgba(34, 31, 45, .78), var(--bg-elevated)); }
.support-panel h2 { margin: 0; font-size: 17px; }
.support-panel .section-heading { margin-bottom: 12px; }
.support-intro { margin: 0 0 14px; color: var(--text-secondary); font-size: 12px; line-height: 1.55; }
.support-form { display: grid; gap: 8px; }
.support-form .field-label { margin-top: 3px; }
.support-form .text-area { min-height: 138px; resize: vertical; }
.support-field-note { margin: 0; color: var(--text-muted); font-size: 10px; line-height: 1.55; }
.support-form-actions { display: flex; justify-content: flex-end; margin-top: 5px; }
.support-aside { display: grid; gap: 14px; }
.support-facts { display: grid; gap: 8px; margin: 12px 0; padding-left: 18px; color: var(--text-secondary); font-size: 11px; line-height: 1.55; }
.support-history-heading { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.support-filter { width: 100%; margin-bottom: 10px; }
.support-empty { padding: 12px 0; color: var(--text-muted); font-size: 11px; }
.feedback-list { display: grid; gap: 8px; }
.feedback-card { min-width: 0; padding: 11px 12px; border: 1px solid var(--border-soft); border-radius: var(--radius-md); background: rgba(255,255,255,.022); }
.feedback-card-subject { margin: 0 0 6px; font-size: 12px; font-weight: 680; overflow-wrap: anywhere; }
.feedback-card-metadata { display: flex; flex-wrap: wrap; align-items: center; gap: 5px 9px; color: var(--text-muted); font-size: 9px; }
.feedback-card-status { padding: 2px 7px; border-radius: 999px; background: var(--accent-soft); color: var(--accent-hover); }
.feedback-card-message, .feedback-card-response p { margin: 8px 0 0; color: var(--text-secondary); font-size: 11px; line-height: 1.55; overflow-wrap: anywhere; white-space: pre-wrap; }
.feedback-card-response { margin-top: 10px; padding-top: 8px; border-top: 1px solid var(--border-soft); }
.feedback-card-response h4 { margin: 0; font-size: 10px; }

@media (max-width: 900px) {
    .support-layout { grid-template-columns: minmax(0, 1fr); }
    .support-aside { grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: start; }
}

@media (max-width: 560px) {
    .support-panel { padding: 14px; }
    .support-aside { grid-template-columns: minmax(0, 1fr); }
    .support-history-heading { align-items: flex-start; }
    .support-form-actions .primary-button { width: 100%; justify-content: center; }
    #voices-view .page-heading { flex-direction: column; }
    #voices-view .heading-actions { width: 100%; }
    .voices-toolbar { align-items: stretch; flex-wrap: wrap; }
    .voices-toolbar .search-field { flex-basis: 100%; }
    .voices-toolbar .library-filter { flex: 1; }
    .voice-card { padding: 13px; }
    .voice-card-actions { gap: 6px; }
    .voice-action { min-height: 34px; padding: 7px 8px; font-size: 10px; }
}

/* Public song discovery and saved references. */
.community-home-card { margin-top: 14px; }
.community-home-note { margin: 4px 0 10px; color: var(--text-secondary); font-size: 12px; line-height: 1.5; }
.community-home-list { display: grid; gap: 8px; }
.community-card { min-width: 0; padding: 16px; border: 1px solid var(--border-soft); border-radius: 16px; background: var(--surface-raised, rgba(255,255,255,.035)); }
.community-card-heading { display: flex; align-items: center; gap: 14px; min-width: 0; }
.community-cover { width: 108px; height: 108px; flex: 0 0 auto; border-radius: 13px; object-fit: cover; background: #24222d; }
.community-cover-small { width: 52px; height: 52px; border-radius: 10px; }
.community-card-copy { min-width: 0; }
.community-card-title { margin: 0 0 5px; font-size: 17px; overflow-wrap: anywhere; }
.community-card-artist, .community-card-style { margin: 3px 0; color: var(--text-secondary); font-size: 13px; overflow-wrap: anywhere; }
.community-card-style { font-size: 12px; }
.community-card-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 14px; }
.community-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 290px), 1fr)); gap: 14px; }
.community-card-compact { padding: 8px 0; border: 0; border-bottom: 1px solid var(--border-soft); border-radius: 0; background: transparent; display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.community-card-compact .community-card-heading { gap: 9px; }
.community-card-compact .community-card-title { font-size: 13px; margin-bottom: 2px; }
.community-card-compact .community-card-artist { font-size: 11px; }
.community-card-compact .text-button { flex: 0 0 auto; }
.credit-bucket-details { margin-top: 14px; border-top: 1px solid var(--border-soft); padding-top: 11px; }
.credit-bucket-details summary { color: var(--text-secondary); font-size: 13px; cursor: pointer; }
.credit-bucket-list { display: grid; gap: 7px; margin: 12px 0; }
.credit-bucket-list > div { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; color: var(--text-secondary); font-size: 13px; }
.credit-bucket-list dt, .credit-bucket-list dd { margin: 0; }
.credit-bucket-list dd { color: var(--text); font-variant-numeric: tabular-nums; font-weight: 600; }
.community-muted, .community-status { color: var(--text-secondary); font-size: 13px; line-height: 1.5; }
.community-status:empty { display: none; }
.community-status[data-state="error"], .community-unavailable { color: #ffb4a9; }
.community-empty { grid-column: 1 / -1; padding: 24px 12px; }
.community-tabs { display: flex; flex-wrap: wrap; gap: 8px; margin: 18px 0 14px; }
.community-tab { border: 1px solid var(--border-soft); border-radius: 999px; padding: 9px 15px; background: transparent; color: var(--text-secondary); cursor: pointer; }
.community-tab.active { background: var(--accent-soft); border-color: var(--accent); color: var(--text-primary); }
.community-search { max-width: 560px; margin: 0 0 16px; }
.community-confirm { display: flex; align-items: flex-start; gap: 10px; margin: 16px 0; color: var(--text-secondary); font-size: 13px; line-height: 1.5; }
.community-confirm input { margin-top: 3px; accent-color: var(--accent); }
.community-cover-preview { display: block; width: 132px; height: 132px; margin: 12px 0; border-radius: 14px; object-fit: cover; }
.community-dialog .dialog-content { max-height: min(86dvh, 760px); overflow: auto; }
.derivation-dialog .dialog-content { width: min(680px, calc(100vw - 24px)); max-height: min(88dvh, 820px); overflow: auto; }
.derivation-types, .derivation-preserve { display: grid; gap: 9px; margin: 12px 0; padding: 0; border: 0; }
.derivation-type-option { display: flex; align-items: flex-start; gap: 10px; padding: 11px 12px; border: 1px solid var(--border); border-radius: 11px; background: var(--surface-soft); cursor: pointer; }
.derivation-type-option input, .derivation-preserve input { accent-color: var(--accent); }
.derivation-type-option strong, .derivation-type-option small { display: block; }
.derivation-type-option small, .derivation-note, .derivation-status, .library-derived-version-meta { color: var(--text-secondary); font-size: 12px; line-height: 1.5; }
.derivation-type-option small { margin-top: 3px; }
.derivation-type-option.is-unavailable { opacity: .78; cursor: pointer; }
.derivation-change-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin: 12px 0; }
.derivation-change-grid .field-label { display: grid; gap: 6px; }
.derivation-preserve { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.derivation-preserve label { display: flex; align-items: center; gap: 7px; color: var(--text-secondary); font-size: 12px; }
.derivation-status[data-state="error"] { color: #ffb4a9; }
.library-derived-versions { display: grid; gap: 9px; margin-top: 16px; }
.library-derived-version { display: grid; gap: 7px; padding: 12px; border: 1px solid var(--border); border-radius: 11px; background: var(--surface-soft); }
.library-derived-version-copy { margin: 0; color: var(--text-secondary); font-size: 13px; white-space: pre-wrap; }
@media (max-width: 560px) {
    .derivation-change-grid { grid-template-columns: 1fr; }
    .derivation-preserve { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 640px) {
    .community-card { padding: 13px; }
    .community-cover { width: 82px; height: 82px; }
    .community-card-actions > .button { flex: 1 1 140px; }
    .community-home-card { padding: 14px; }
}
