@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=Space+Grotesk:wght@500;600&display=swap');

@font-face {
    font-family: 'Satisfy';
    src: url('../font/Satisfy-Regular.ttf') format('truetype');
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}

:root {
    --topbar-height: 96px;
    --sidebar-width-expanded: 264px;
    --sidebar-width-collapsed: 64px;
    --app-font-default: 'Inter', 'Segoe UI', sans-serif;
    --app-font-satisfy: 'Satisfy', 'Brush Script MT', cursive;
    --app-font-family: var(--app-font-default);
}

html,
body {
    height: 100%;
}

body {
    margin: 0;
    font-family: var(--app-font-family);
    background: rgba(255, 255, 255, 0.9);
    min-height: 100vh;
    height: 100vh;
    display: flex;
    flex-direction: column;
    --sidebar-current-width: var(--sidebar-width-expanded);
    --layout-horizontal-gap: 5px;
    --layout-vertical-gap: 5px;
}

body.sidebar-collapsed {
    --sidebar-current-width: var(--sidebar-width-collapsed);
}

body.sidebar-collapsible {
    --sidebar-current-width: 0px;
}

body.sidebar-collapsible.sidebar-open {
    overflow: hidden;
}

body.sidebar-collapsible .app-layout {
    margin-left: 0;
    padding: var(--layout-vertical-gap) var(--layout-horizontal-gap);
}

body.sidebar-collapsible.sidebar-open .app-layout {
    pointer-events: none;
}

.visually-hidden {
    position: absolute !important;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.topbar {
    display: flex;
    align-items: center;
    min-height: 56px;
    height: 56px;
    gap: 16px;
    padding: 6px 20px;
    min-height: 56px;
    background: var(--theme-surface-2);
    border-bottom: 1px solid var(--theme-border);
    backdrop-filter: blur(12px);
    flex: 0 0 auto;
}

.topbar-left {
    display: inline-flex;
    align-items: center;
    gap: 16px;
    min-width: 0;
}

.app-brand {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 56px;
    width: 56px;
    border-radius: 18px;
    background: var(--theme-surface-1);
    border: 1px solid var(--theme-border-soft);
    box-shadow: var(--theme-shadow, none);
}

.app-brand-logo {
    display: block;
    max-height: 40px;
    width: auto;
    object-fit: contain;
}

.app-brand-name {
    font-family: 'Satisfy', 'Brush Script MT', cursive;
    font-size: 26px;
    font-weight: 700;
    letter-spacing: 0.75px;
    color: var(--theme-text);
    white-space: nowrap;
}

.topbar-center {
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.topbar-actions {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    position: relative;
}

.topbar-actions-buttons {
    display: inline-flex;
    align-items: center;
    gap: 12px;
}

.topbar-actions .export-buttons {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.topbar .export-btn {
    border: 1px solid var(--theme-border-soft);
    background: var(--theme-surface-1);
    color: var(--theme-text);
    padding: 10px 16px;
    border-radius: 12px;
    font-weight: 600;
    transition: background 0.2s ease, transform 0.2s ease;
}

.topbar .export-btn:hover {
    transform: translateY(-1px);
    background: var(--theme-surface-2);
}

.topbar .export-label {
    color: var(--theme-text);
}

.topbar-actions-toggle {
    display: none;
    font-size: 20px;
}

.topbar-action-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 15px;
    line-height: 1.25;
    padding: 10px 16px;
    border-radius: 8px;
}

.topbar-action-icon {
    width: 20px;
    height: 20px;
    display: inline-block;
    object-fit: contain;
}

.topbar-selectors {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}


.topbar-select {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 180px;
    flex: 0 1 260px;
    position: relative;
}

.topbar-select-label {
    font-size: 13px;
    font-weight: 600;
    color: var(--theme-text);
    white-space: nowrap;
}

.topbar-select-input {
    appearance: none;
    padding: 10px 12px;
    border-radius: 10px;
    border: 1px solid var(--theme-border-soft);
    background: transparent;
    color: var(--theme-text);
    font-family: var(--app-font-family);
    font-size: 15px;
    line-height: 1.4;
}

.topbar-select-input:disabled {
    cursor: not-allowed;
    opacity: 0.7;
    color: var(--theme-text-muted);
    border-color: var(--theme-border-soft);
    background: transparent;
}

.topbar-select-input:focus-visible {
    outline: 2px solid var(--theme-focus);
    outline-offset: 2px;
}

.topbar-select-status {
    display: none;
    margin-top: 6px;
    font-size: 12px;
    color: var(--theme-text-muted);
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
}

.topbar-select-status > span {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.topbar-select[data-state="loading"] .topbar-select-status,
.topbar-select[data-state="empty"] .topbar-select-status,
.topbar-select[data-state="error"] .topbar-select-status {
    display: flex;
}

.topbar-select[data-state="loading"] .topbar-select-status {
    display: block;
}

.topbar-select[data-state="loading"] .topbar-select-status::before {
    content: "";
    display: block;
    width: 100%;
    height: 10px;
    border-radius: 999px;
    background: linear-gradient(90deg, var(--theme-surface-2), var(--theme-surface-3), var(--theme-surface-2));
    background-size: 200% 100%;
    animation: topbar-skeleton 1.2s linear infinite;
}

.topbar-select[data-state="loading"] .topbar-select-status > * {
    display: none;
}

.topbar-select[data-state="error"] .topbar-select-status {
    color: var(--theme-accent);
}

.topbar-select-action {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 6px 12px;
    border-radius: 999px;
    border: 1px solid var(--theme-border-soft);
    background: var(--theme-accent-soft);
    color: var(--theme-text);
    font-family: var(--app-font-family);
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease, transform 0.2s ease;
}

.topbar-select-action:hover,
.topbar-select-action:focus-visible {
    background: var(--theme-accent);
    color: var(--theme-text-inverse);
    border-color: var(--theme-accent-border);
    transform: translateY(-1px);
    outline: none;
}

.topbar-select-icon-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
    border-radius: 12px;
    border: 1px solid var(--theme-border-soft);
    background: transparent;
    padding: 0;
    flex-shrink: 0;
    cursor: pointer;
    transition: background 0.2s ease, border-color 0.2s ease, transform 0.2s ease;
}

.topbar-select-icon-btn img {
    width: 20px;
    height: 20px;
    pointer-events: none;
}

.topbar-select-icon-btn + .topbar-select-icon-btn {
    margin-left: 8px;
}

.topbar-select-icon-btn:hover,
.topbar-select-icon-btn:focus-visible {
    background: var(--theme-surface-2);
    border-color: var(--theme-border);
    outline: none;
    transform: translateY(-1px);
}

.topbar-select-icon-btn[disabled],
.topbar-select-icon-btn[aria-disabled="true"] {
    opacity: 0.45;
    cursor: not-allowed;
    transform: none;
    pointer-events: none;
}

.topbar-select-icon-btn[disabled] img,
.topbar-select-icon-btn[aria-disabled="true"] img {
    opacity: 0.65;
}

@keyframes topbar-skeleton {
    0% {
        background-position-x: 0%;
    }
    100% {
        background-position-x: 200%;
    }
}

.app-toast-container {
    position: fixed;
    right: 24px;
    bottom: 24px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    z-index: 400;
    pointer-events: none;
}

.app-toast {
    pointer-events: auto;
    background: var(--theme-surface-2);
    border: 1px solid var(--theme-border);
    color: var(--theme-text);
    padding: 12px 16px;
    border-radius: 16px;
    box-shadow: var(--theme-shadow);
    min-width: 220px;
    max-width: min(360px, 90vw);
    opacity: 0;
    transform: translateY(12px);
    transition: opacity 0.2s ease, transform 0.2s ease;
}

.app-toast.is-visible {
    opacity: 1;
    transform: translateY(0);
}

.app-toast--error {
    border-color: var(--theme-accent-border);
    background: var(--theme-accent-soft);
}

@media (max-width: 600px) {
    .app-toast-container {
        left: 16px;
        right: 16px;
        bottom: 16px;
        align-items: stretch;
    }

    .app-toast {
        max-width: 100%;
    }
}

.topbar-meta {
    display: flex;
    align-items: flex-end;
    gap: 24px;
    flex-wrap: wrap;
}

.topbar-right {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 16px;
    margin-left: auto;
}

.account-inline {
    display: flex;
    align-items: center;
    gap: 12px;
}

.account-inline-name {
    display: flex;
    align-items: center;
    font-weight: 600;
    color: var(--theme-text);
}

.account-inline-btn {
    padding: 10px;
    border-radius: 12px;
    font-size: 16px;
    border: 1px solid var(--theme-border-soft);
    background: var(--theme-surface-1);
    color: var(--theme-text);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.account-inline-icon {
    width: 18px;
    height: 18px;
    display: block;
}

.account-inline-label {
    font-weight: 600;
}

.button-display-icon-only .account-inline-label {
    display: none;
}

.button-display-icon-only .account-inline-btn {
    gap: 0;
}

.account-inline-btn:hover {
    background: var(--theme-surface-2);
}

.account-inline-btn:focus-visible,
.icon-btn:focus-visible,
.export-btn:focus-visible,
.topbar-actions-toggle:focus-visible {
    outline: 2px solid var(--theme-focus);
    outline-offset: 2px;
}

.icon-btn {
    padding: 10px 16px;
    font-size: 16px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    border-radius: 12px;
    border: 1px solid var(--theme-border-soft);
    background: var(--theme-surface-1);
    color: var(--theme-text);
    font-family: var(--app-font-family);
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s ease, border-color 0.2s ease, transform 0.2s ease;
}

.icon-btn:hover {
    transform: translateY(-1px);
    background: var(--theme-surface-2);
}

.icon-btn[data-button-label] {
    --icon-btn-icon-size: 20px;
    --icon-btn-text-size: 14px;
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0;
}

.icon-btn[data-button-label]::before,
.icon-btn[data-button-label]::after {
    pointer-events: none;
    line-height: 1.2;
    white-space: nowrap;
}

.button-display-icon-only .icon-btn[data-button-label] {
    font-size: 0;
}

.button-display-icon-only .icon-btn[data-button-label]::before {
    content: attr(data-button-icon);
    font-size: var(--icon-btn-icon-size);
}

.button-display-icon-only .icon-btn[data-button-label]::after {
    content: "";
}

.button-display-icon-only #delete-project-btn .topbar-action-label {
    display: none;
}

.button-display-icon-text .icon-btn[data-button-label] {
    font-size: 0;
    padding-left: 14px;
    padding-right: 14px;
}

.button-display-icon-text .icon-btn[data-button-label]::before {
    content: attr(data-button-icon);
    font-size: var(--icon-btn-icon-size);
    margin-right: 6px;
}

.button-display-icon-text .icon-btn[data-button-label]::after {
    content: attr(data-button-label);
    font-size: var(--icon-btn-text-size);
    color: inherit;
}

.button-display-text-only .icon-btn[data-button-label] {
    font-size: 0;
    padding-left: 14px;
    padding-right: 14px;
}

.button-display-text-only .icon-btn[data-button-label]::before {
    content: "";
}

.button-display-text-only .icon-btn[data-button-label]::after {
    content: attr(data-button-label);
    font-size: var(--icon-btn-text-size);
    color: inherit;
}

.button-display-text-only .icon-btn[data-button-label] img,
.button-display-text-only .icon-btn[data-button-label] [aria-hidden="true"] {
    display: none !important;
}

.export-buttons {
    display: inline-flex;
    gap: 8px;
}

.export-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.8);
    color: #1f1f1f;
    border: none;
    cursor: pointer;
    min-height: 42px;
}

.export-btn:hover {
    transform: translateY(-1px);
    background: rgba(255, 255, 255, 0.95);
}

.export-label {
    font-weight: 600;
}


.account-menu {
    margin-left: auto;
    display: inline-flex;
    align-items: center;
    gap: 14px;
    background: rgba(255, 255, 255, 0.72);
    padding: 10px 16px;
    border-radius: 16px;
    border: 1px solid rgba(255, 255, 255, 0.65);
}

/* Account management page */

body.account-page {
    background: linear-gradient(135deg, #ff9a8b, #ff6a88 45%, #ff99ac);
    color: #1f1f1f;
}

.account-page .account-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 36px;
    background: rgba(255, 255, 255, 0.9);
}

.account-header-brand {
    display: flex;
    align-items: center;
    gap: 14px;
}

.account-brand-link {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
    color: inherit;
    font-weight: 700;
    font-size: 20px;
}

.account-brand-logo {
    width: 52px;
    height: 52px;
    object-fit: contain;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.7);
    padding: 6px;
}

.account-brand-name {
    font-family: 'Satisfy', 'Brush Script MT', cursive;
    font-size: 30px;
    color: #ff6f61;
}

.account-header-actions {
    display: flex;
    align-items: center;
    gap: 18px;
}

.account-header-link {
    font-weight: 600;
    color: #ff7043;
    text-decoration: none;
    transition: color 0.2s ease;
    font-family: var(--app-font-family);
}

.account-header-link:focus-visible {
    outline: 2px solid rgba(255, 112, 67, 0.4);
    outline-offset: 3px;
}

button.account-header-link {
    background: none;
    border: none;
    padding: 0;
    cursor: pointer;
    font: inherit;
    appearance: none;
}

.account-header-link:hover {
    color: #d84315;
}

.account-settings {
    display: flex;
    gap: 32px;
    width: 100%;
    margin: 32px 0 48px;
    padding: 0 32px 48px;
    box-sizing: border-box;
}

.account-settings-sidebar {
    flex: 0 0 260px;
    display: flex;
    flex-direction: column;
    gap: 18px;
    position: sticky;
    top: 96px;
    align-self: flex-start;
    background: rgba(255, 255, 255, 0.9);
    border-radius: 20px;
    padding: 24px 20px;
    border: 1px solid rgba(255, 255, 255, 0.6);
    backdrop-filter: blur(6px);
}

.account-settings-group-label {
    margin: 0;
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    color: rgba(0, 0, 0, 0.45);
    font-weight: 700;
    font-family: var(--app-font-family);
}

.account-settings-nav {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.account-settings-nav-button {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 10px 14px;
    border: 1px solid rgba(255, 255, 255, 0.4);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.2);
    color: #3b3b3b;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: var(--app-font-family);
}

.account-settings-nav-button:hover,
.account-settings-nav-button:focus-visible {
    background: rgba(255, 255, 255, 0.35);
    border-color: rgba(255, 255, 255, 0.6);
    outline: none;
}

.account-settings-nav-button.is-active {
    background: #ff7043;
    color: #fff;
    border-color: transparent;
}

.account-settings-separator {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: rgba(0, 0, 0, 0.45);
}

.account-settings-separator::before,
.account-settings-separator::after {
    content: "";
    height: 1px;
    flex: 1 1 auto;
    background: rgba(0, 0, 0, 0.12);
}

.account-settings-content {
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    gap: 24px;
    min-height: calc(100vh - 220px);
}

.account-settings-section {
    background: rgba(255, 255, 255, 0.9);
    border-radius: 18px;
    padding: 24px;
    border: 1px solid rgba(255, 255, 255, 0.6);
    min-height: 320px;
}

.account-settings-section[hidden] {
    display: none !important;
}

.account-settings-section-header {
    margin-bottom: 16px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.account-settings-section-header h2 {
    margin: 0;
    font-size: 22px;
    color: #212121;
}

.account-settings-section-description {
    margin: 0;
    color: rgba(0, 0, 0, 0.6);
    font-size: 14px;
}

.account-details {
    margin: 0;
    padding: 0;
}

.account-details-row {
    display: grid;
    grid-template-columns: 160px 1fr;
    gap: 12px;
    align-items: start;
    padding: 10px 0;
    border-bottom: 1px solid rgba(0, 0, 0, 0.08);
}

.account-details-row:last-child {
    border-bottom: none;
}

.account-details-row dt {
    font-weight: 600;
    color: rgba(0, 0, 0, 0.65);
}

.account-details-row dd {
    margin: 0;
    color: #212121;
}

.account-details-row input[type="email"] {
    width: 100%;
    max-width: 100%;
    padding: 8px 10px;
    border-radius: 10px;
    border: 1px solid rgba(0, 0, 0, 0.12);
    background: rgba(255, 255, 255, 0.95);
    font-size: 14px;
    box-sizing: border-box;
}

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

.account-section-hint {
    margin: 0;
    color: rgba(0, 0, 0, 0.55);
    font-style: italic;
}

.account-settings-nav--admin .account-settings-nav-button {
    border-color: rgba(94, 104, 255, 0.25);
}

.account-settings-nav--admin .account-settings-nav-button.is-active {
    background: linear-gradient(135deg, #5f7fff, #7c5bff);
}

.account-header-button {
    border: none;
    border-radius: 999px;
    padding: 10px 20px;
    font-weight: 600;
    background: linear-gradient(135deg, #ff7e5f, #ffb199);
    color: #fff;
    cursor: pointer;
    font-family: var(--app-font-family);
}

.account-header-button:hover {
    transform: translateY(-1px);
}

.account-main {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    padding: 40px 24px 60px;
}

.account-card {
    width: min(720px, 100%);
    background: rgba(255, 255, 255, 0.95);
    border-radius: 24px;
    padding: 32px;
    backdrop-filter: blur(6px);
}

.account-card-header h1 {
    margin: 0 0 8px;
    font-size: 28px;
}

.account-card-header p {
    margin: 0;
    color: #555;
    font-size: 15px;
}

.account-section {
    margin-top: 28px;
}

.account-section h2 {
    margin: 0 0 16px;
    font-size: 20px;
    color: #ff7043;
}

.account-field {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 18px;
}

.account-field label {
    font-weight: 600;
    font-size: 14px;
    color: #333;
}

.account-field input[type="email"] {
    border: 1px solid rgba(0, 0, 0, 0.15);
    border-radius: 10px;
    padding: 10px 12px;
    font-size: 15px;
    background: rgba(0, 0, 0, 0.03);
    color: #444;
}

.account-field input[type="email"][readonly] {
    cursor: not-allowed;
}

.account-field-hint {
    margin: 0;
    font-size: 13px;
    color: #666;
}

.account-field-inline {
    display: grid;
    gap: 16px;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
}

.account-field-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 6px 14px;
    border-radius: 999px;
    background: rgba(255, 126, 95, 0.12);
    color: #c85a38;
    font-weight: 600;
    font-size: 14px;
}

.account-field-badge-secondary {
    background: rgba(76, 175, 80, 0.12);
    color: #2e7d32;
}

.account-select {
    border-radius: 10px;
    border: 1px solid rgba(0, 0, 0, 0.18);
    padding: 10px 12px;
    font-size: 15px;
    max-width: 220px;
    background: rgba(255, 255, 255, 0.9);
}

.account-feedback {
    margin-top: 16px;
    padding: 12px 14px;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 600;
    display: none;
}

.account-feedback[data-status] {
    display: block;
}

.account-feedback[data-status="loading"] {
    background: rgba(255, 183, 77, 0.18);
    color: #ff8f00;
}

.account-feedback[data-status="success"] {
    background: rgba(129, 199, 132, 0.25);
    color: #2e7d32;
}

.account-feedback[data-status="error"] {
    background: rgba(244, 67, 54, 0.15);
    color: #c62828;
}

.account-loading {
    font-size: 16px;
    font-weight: 600;
    color: #555;
}

@media (max-width: 768px) {
    .account-page .account-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 16px;
    }

    .account-header-actions {
        width: 100%;
        justify-content: space-between;
        flex-wrap: wrap;
        gap: 12px;
    }

    .account-card {
        padding: 24px;
    }
}

/* Admin dashboard */

.admin-page {
    background: linear-gradient(to right, #ff7e5f, #feb47b);
}

.admin-main {
    flex: 1;
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: 32px;
    padding: 32px 24px 60px;
    max-width: 1400px;
    margin: 0 auto;
    width: 100%;
    box-sizing: border-box;
}

.admin-content {
    background: rgba(255, 255, 255, 0.9);
    border-radius: 24px;
    padding: 32px;
    backdrop-filter: blur(6px);
    display: flex;
    flex-direction: column;
    gap: 32px;
    min-height: 0;
}

.admin-sidebar {
    background: rgba(255, 255, 255, 0.75);
    border-radius: 24px;
    padding: 28px 24px;
    display: flex;
    flex-direction: column;
    gap: 24px;
    backdrop-filter: blur(6px);
    position: sticky;
    top: 24px;
    height: fit-content;
    align-self: start;
}

.admin-sidebar-title {
    margin: 0;
    font-size: 24px;
    color: #2f2f2f;
}

.admin-sidebar-subtitle {
    margin: 4px 0 0;
    color: rgba(0, 0, 0, 0.6);
    font-size: 14px;
}

.admin-sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.admin-sidebar-link {
    border: none;
    text-align: left;
    padding: 12px 16px;
    border-radius: 12px;
    font-weight: 600;
    font-size: 15px;
    background: rgba(255, 255, 255, 0.7);
    color: #3b3b3b;
    cursor: pointer;
    transition: background 0.2s ease, transform 0.15s ease;
}

.admin-sidebar-link:hover,
.admin-sidebar-link:focus {
    background: rgba(100, 223, 223, 0.25);
    transform: translateX(2px);
    outline: none;
}

.admin-sidebar-link.is-active {
    background: linear-gradient(135deg, rgba(94, 96, 206, 0.85), rgba(100, 223, 223, 0.9));
    color: #fff;
}

.admin-sidebar-footer {
    margin-top: auto;
}

.admin-sidebar-help {
    margin: 0;
    font-size: 13px;
    color: rgba(0, 0, 0, 0.55);
}

.admin-card-header h1 {
    margin: 0 0 10px;
    font-size: 30px;
}

.admin-card-header p {
    margin: 0;
    color: #555;
    font-size: 15px;
}

.admin-section {
    margin-top: 32px;
}

.account-settings-section--admin {
    display: flex;
    flex-direction: column;
    gap: 32px;
    min-height: 0;
    flex: 1 1 auto;
}

.account-settings-section--admin[hidden] {
    display: none;
}

.admin-sections-container {
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    gap: 32px;
    min-height: 0;
    overflow-y: auto;
    padding-right: 8px;
}

.admin-sections-container::-webkit-scrollbar {
    width: 8px;
}

.admin-sections-container::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 999px;
}

#admin-users {
    display: flex;
    flex-direction: column;
    gap: 20px;
    flex: 1 1 auto;
    min-height: 0;
    overflow: hidden;
}

#admin-users[hidden] {
    display: none;
}

#admin-users .admin-users-layout {
    flex: 1 1 auto;
    min-height: 0;
}

.admin-card-header {
    flex: 0 0 auto;
}

.admin-section[hidden] {
    display: none;
}

.admin-section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
}

.admin-section h2 {
    margin: 0;
    font-size: 22px;
    color: #5e60ce;
}

.admin-section-hint {
    margin: 12px 0 0;
    color: #666;
    font-size: 14px;
}

.admin-switch {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    border-radius: 12px;
    background: rgba(93, 95, 239, 0.08);
}

.admin-switch input[type="checkbox"] {
    width: 48px;
    height: 24px;
}

.admin-switch-label {
    font-weight: 600;
}

.admin-inline-form {
    display: grid;
    gap: 12px;
    grid-template-columns: repeat(auto-fit, minmax(160px, max-content));
    align-items: end;
    margin-top: 16px;
}

.admin-inline-form input[type="text"],
.admin-inline-form input[type="number"] {
    border-radius: 10px;
    border: 1px solid rgba(0, 0, 0, 0.2);
    padding: 10px 12px;
    font-size: 15px;
}

.admin-action-button {
    border: none;
    border-radius: 999px;
    padding: 10px 20px;
    font-weight: 600;
    background: linear-gradient(135deg, #5e60ce, #64dfdf);
    color: #fff;
    cursor: pointer;
}

.admin-action-button:hover {
    transform: translateY(-1px);
}

.admin-action-button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
    background: #c7c9d3;
}

.admin-table-wrapper {
    margin-top: 16px;
    overflow-x: auto;
    border-radius: 16px;
}

.admin-section-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px;
    margin-top: 16px;
}

.admin-search-label {
    font-weight: 600;
}

.admin-search-input {
    flex: 1 1 260px;
    max-width: 320px;
    padding: 8px 12px;
    border-radius: 8px;
    border: 1px solid rgba(0, 0, 0, 0.2);
    font-size: 15px;
}

.admin-promo-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.admin-table-primary {
    font-weight: 600;
}

.admin-table-meta {
    margin-top: 4px;
    font-size: 12px;
    color: #666;
}

.admin-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 640px;
}

.admin-table thead {
    background: rgba(94, 96, 206, 0.12);
}

.admin-table th,
.admin-table td {
    padding: 12px 16px;
    text-align: left;
    font-size: 14px;
}

.admin-table tbody tr:nth-child(odd) {
    background: rgba(0, 0, 0, 0.02);
}

.admin-table tbody tr:hover {
    background: rgba(100, 223, 223, 0.12);
}

.admin-table-empty {
    text-align: center;
    color: #777;
    font-style: italic;
}

.admin-table-code-disabled {
    color: #c62828;
    font-weight: 600;
}

.admin-table select {
    border-radius: 8px;
    border: 1px solid rgba(0, 0, 0, 0.2);
    padding: 6px 10px;
    font-size: 13px;
}

.admin-plan-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.admin-empty-state {
    margin: 16px 0;
    color: #777;
    font-style: italic;
    text-align: center;
}

.admin-action-button-danger {
    background: linear-gradient(135deg, #ff6b6b, #c9184a);
}

.admin-users-layout {
    display: grid;
    grid-template-columns: minmax(260px, 30%) minmax(0, 1fr);
    grid-template-rows: auto 1fr;
    grid-template-areas:
        "header header"
        "list details";
    gap: 28px;
    align-items: stretch;
    max-height: calc(100vh - 260px);
}

.admin-users-header-panel {
    grid-area: header;
    background: #fff;
    border-radius: 18px;
    border: 1px solid rgba(0, 0, 0, 0.08);
    box-shadow: 0 12px 36px rgba(32, 33, 36, 0.08);
    padding: 28px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.admin-users-header {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.admin-users-subtitle {
    margin: 6px 0 0;
    color: #5f6368;
    font-size: 15px;
}

.admin-users-sidebar {
    grid-area: list;
    display: flex;
    flex-direction: column;
    gap: 16px;
    height: 100%;
    min-height: 0;
}

.admin-users-list-wrapper {
    flex: 1 1 auto;
    background: rgba(255, 255, 255, 0.9);
    border-radius: 16px;
    border: 1px solid rgba(0, 0, 0, 0.05);
    padding: 12px;
    overflow-y: auto;
    max-height: 100%;
}

.admin-users-details {
    grid-area: details;
    display: flex;
    height: 100%;
    max-width: 100%;
    min-height: 0;
}

.admin-users-details-inner {
    background: #fff;
    border-radius: 18px;
    border: 1px solid rgba(0, 0, 0, 0.08);
    box-shadow: 0 12px 36px rgba(32, 33, 36, 0.12);
    padding: 28px;
    display: flex;
    flex-direction: column;
    gap: 24px;
    width: 100%;
    height: 100%;
    overflow-y: auto;
}

.admin-users-search {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.admin-users-search .admin-search-input {
    max-width: 100%;
    flex: 0 0 auto;
}

@media (max-width: 1024px) {
    .admin-users-layout {
        grid-template-columns: 1fr;
        grid-template-areas:
            "header"
            "list"
            "details";
        height: auto;
        max-height: none;
    }

    .admin-users-details {
        height: auto;
    }

    .admin-users-details-inner {
        overflow: visible;
    }

    .admin-users-sidebar {
        height: auto;
    }
}
.admin-users-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.admin-users-item {
    width: 100%;
    border: 1px solid rgba(94, 96, 206, 0.25);
    border-radius: 12px;
    background: #fff;
    padding: 14px 18px;
    text-align: left;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    gap: 6px;
    transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.admin-users-item:hover {
    border-color: #5e60ce;
    box-shadow: 0 6px 20px rgba(94, 96, 206, 0.12);
}

.admin-users-item.is-active {
    border-color: #5e60ce;
    background: rgba(94, 96, 206, 0.08);
    box-shadow: 0 8px 24px rgba(94, 96, 206, 0.2);
}

.admin-users-item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
}

.admin-users-item-name {
    font-weight: 600;
    font-size: 16px;
    color: #202124;
}

.admin-users-item-email {
    font-size: 13px;
    color: #5f6368;
}

.admin-user-online-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    font-size: 12px;
    border-radius: 999px;
    background: rgba(76, 201, 240, 0.18);
    color: #0b7285;
    font-weight: 600;
}

.admin-user-online-pill.offline {
    background: rgba(203, 213, 224, 0.6);
    color: #666;
}

.admin-user-online-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: currentColor;
}

.admin-user-status-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    font-size: 12px;
    border-radius: 999px;
    font-weight: 600;
    background: rgba(203, 213, 224, 0.4);
    color: #4a4e69;
    transition: background 0.2s ease, color 0.2s ease;
}

.admin-user-status-pill.is-active {
    background: rgba(47, 158, 68, 0.18);
    color: #2b8a3e;
}

.admin-user-status-pill.is-inactive {
    background: rgba(250, 82, 82, 0.16);
    color: #c92a2a;
}

.admin-user-status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: currentColor;
}

.admin-user-project-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}

.admin-user-project-actions button {
    border: none;
    border-radius: 999px;
    padding: 6px 12px;
    font-size: 13px;
    font-weight: 600;
    background: rgba(94, 96, 206, 0.12);
    color: #3f3d56;
    cursor: pointer;
    transition: background 0.2s ease, transform 0.2s ease;
}

.admin-user-project-actions button:hover,
.admin-user-project-actions button:focus-visible {
    background: rgba(94, 96, 206, 0.22);
    transform: translateY(-1px);
    outline: none;
}

.admin-user-project-actions button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.admin-user-project-actions button[data-project-action="download"] {
    background: rgba(100, 223, 223, 0.18);
    color: #0b7285;
}

.admin-user-project-actions button[data-project-action="download"]:hover,
.admin-user-project-actions button[data-project-action="download"]:focus-visible {
    background: rgba(100, 223, 223, 0.28);
}

.admin-user-project-actions button[data-project-action="toggle"][data-project-active="true"] {
    background: rgba(252, 196, 0, 0.22);
    color: #8a6d00;
}

.admin-user-project-actions button[data-project-action="toggle"][data-project-active="true"]:hover,
.admin-user-project-actions button[data-project-action="toggle"][data-project-active="true"]:focus-visible {
    background: rgba(252, 196, 0, 0.32);
}

.admin-user-project-actions button[data-project-action="toggle"][data-project-active="false"] {
    background: rgba(47, 158, 68, 0.18);
    color: #2b8a3e;
}

.admin-user-project-actions button[data-project-action="toggle"][data-project-active="false"]:hover,
.admin-user-project-actions button[data-project-action="toggle"][data-project-active="false"]:focus-visible {
    background: rgba(47, 158, 68, 0.28);
}

.admin-user-project-actions button[data-project-action="delete"] {
    background: rgba(250, 82, 82, 0.16);
    color: #c92a2a;
}

.admin-user-project-actions button[data-project-action="delete"]:hover,
.admin-user-project-actions button[data-project-action="delete"]:focus-visible {
    background: rgba(250, 82, 82, 0.26);
}

.admin-users-item-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.admin-users-item-tag {
    font-size: 12px;
    padding: 4px 10px;
    border-radius: 999px;
    background: rgba(94, 96, 206, 0.12);
    color: #3f3d56;
}

.admin-users-item-tag.secondary {
    background: rgba(203, 213, 224, 0.6);
    color: #4a4e69;
}

.admin-users-item-tag.status-active {
    background: rgba(47, 158, 68, 0.18);
    color: #2b8a3e;
}

.admin-users-item-tag.status-inactive {
    background: rgba(250, 82, 82, 0.16);
    color: #c92a2a;
}

.admin-user-details-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 16px;
    flex-wrap: wrap;
}

.admin-user-detail-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.admin-user-info dl {
    display: grid;
    gap: 18px;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    margin: 0;
}

.admin-user-info dt {
    font-weight: 600;
    font-size: 13px;
    color: #5f6368;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-bottom: 6px;
}

.admin-user-info dd {
    margin: 0;
    font-size: 15px;
    color: #202124;
}

.admin-user-role-field select {
    width: 100%;
    border-radius: 8px;
    border: 1px solid rgba(0, 0, 0, 0.2);
    padding: 6px 10px;
    font-size: 15px;
    background: #fff;
}

.admin-user-section {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.admin-user-section h4 {
    margin: 0;
    font-size: 16px;
    color: #3f3d56;
}

.admin-user-sessions-list,
.admin-user-connections-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.admin-user-session,
.admin-user-connection {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    background: rgba(94, 96, 206, 0.08);
    border-radius: 12px;
    padding: 10px 14px;
    font-size: 13px;
    color: #3f3d56;
}

.admin-user-session .session-meta,
.admin-user-connection .connection-meta {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.admin-user-session em,
.admin-user-connection em {
    font-style: normal;
    color: #5f6368;
    font-size: 12px;
}

.admin-user-sessions-list:empty::after,
.admin-user-connections-list:empty::after {
    content: "Aucune donnée disponible.";
    color: #777;
    font-style: italic;
}

.admin-plan-card {
    background: rgba(255, 255, 255, 0.85);
    border-radius: 18px;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.admin-plan-card-header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 12px;
}

.admin-plan-card-title {
    margin: 0;
    font-size: 20px;
    color: #5e60ce;
}

.admin-plan-price {
    margin: 0;
    font-weight: 700;
    color: #2f2f2f;
}

.admin-plan-form {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.admin-plan-form label {
    font-size: 13px;
    font-weight: 600;
    color: rgba(0, 0, 0, 0.7);
}

.admin-plan-form input[type="text"],
.admin-plan-form textarea {
    border-radius: 10px;
    border: 1px solid rgba(0, 0, 0, 0.2);
    padding: 10px 12px;
    font-size: 14px;
    resize: vertical;
    min-height: 38px;
}

.admin-plan-form textarea {
    min-height: 72px;
}

.admin-plan-features-hint {
    margin: 0;
    font-size: 12px;
    color: rgba(0, 0, 0, 0.55);
}

.admin-plan-actions {
    display: flex;
    justify-content: flex-end;
}

.admin-plan-actions .admin-action-button {
    padding: 10px 18px;
}

@media (max-width: 900px) {
    .admin-main {
        grid-template-columns: 1fr;
        padding: 24px 16px 48px;
    }

    .admin-sidebar {
        position: static;
        flex-direction: row;
        flex-wrap: wrap;
        gap: 12px;
    }

    .admin-sidebar-nav {
        flex-direction: row;
        flex-wrap: wrap;
        gap: 8px;
    }

    .admin-sidebar-link {
        flex: 1 1 130px;
        text-align: center;
    }

    .admin-content {
        padding: 24px;
    }

    .admin-inline-form {
        grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    }
}

.theme-switcher {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 10px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.9);
    border: 1px solid rgba(0, 0, 0, 0.1);
}

.theme-switcher:hover {
    transform: translateY(-1px);
}

.theme-switcher-icon {
    font-size: 18px;
}

.theme-select {
    border: none;
    background: transparent;
    font-weight: 600;
    font-size: 13px;
    cursor: pointer;
    color: #2c2c2c;
    padding: 4px 0;
}

.theme-select:focus-visible {
    outline: 2px solid rgba(0, 0, 0, 0.25);
    outline-offset: 2px;
    border-radius: 6px;
}

.account-plan-badge {
    font-size: 13px;
    font-weight: 700;
    color: #ff7043;
    background: rgba(255, 255, 255, 0.92);
    padding: 6px 10px;
    border-radius: 999px;
    border: 1px solid rgba(255, 112, 67, 0.35);
    cursor: pointer;
}

.account-user-name {
    font-weight: 600;
    color: #2c2c2c;
}

.account-manage-btn,
.account-logout-btn {
    border: none;
    border-radius: 10px;
    padding: 8px 14px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
}

.account-manage-btn {
    background: linear-gradient(135deg, #ff7e5f, #ff996f);
    color: #fff;
}

.account-logout-btn {
    background: rgba(255, 255, 255, 0.9);
    color: #333;
    border: 1px solid rgba(0, 0, 0, 0.12);
}

.account-settings-btn {
    background: rgba(255, 255, 255, 0.92);
    color: #333;
    border: 1px solid rgba(0, 0, 0, 0.12);
}

.account-settings-btn:hover {
    background: rgba(255, 255, 255, 0.98);
}

.account-admin-btn {
    background: linear-gradient(135deg, #ff5252, #ff867f);
    color: #fff;
    border: none;
}

.account-admin-btn:hover {
}

.account-manage-btn:hover,
.account-logout-btn:hover {
    transform: translateY(-1px);
}

.control-panel {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
    padding: 10px 16px;
    border-radius: 14px;
    border: 1px solid rgba(255, 255, 255, 0.35);
    background: rgba(255, 255, 255, 0.18);
    backdrop-filter: blur(4px);
    min-width: 160px;
}

.control-panel-label {
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-size: 12px;
    font-weight: 600;
    color: rgba(33, 33, 33, 0.7);
}

.control-panel-input {
    width: 100%;
    max-width: 96px;
    padding: 6px 10px;
    border-radius: 10px;
    border: 1px solid rgba(0, 0, 0, 0.12);
    font-size: 16px;
    font-weight: 600;
    color: #2c2c2c;
    background: rgba(255, 255, 255, 0.95);
}

.instrument-toggle {
    margin-left: 0;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.instrument-btn {
    border: none;
    background: rgba(0, 0, 0, 0.35);
    line-height: 1;
    border-radius: 10px;
    width: 48px;
    height: 48px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 2px;
    cursor: pointer;
    color: #f5f5f5;
    border: 2px solid transparent;
}

.instrument-icon {
    font-size: 18px;
}

.instrument-label {
    display: none;
}

.instrument-btn:hover {
    background: rgba(0, 0, 0, 0.55);
    transform: translateY(-1px);
}

.instrument-btn.active {
    background: rgba(255, 255, 255, 0.95);
    color: #212121;
    border-color: #ff7043;
}

.instrument-btn.active .instrument-label {
    color: #ff7043;
}

.instrument-btn:focus-visible {
    outline: none;
    border-color: #ffab91;
}

.instrument-btn.active:focus-visible {
    border-color: #ff7043;
}

.instrument-btn:hover .instrument-label {
    color: #ffd9cc;
}

.instrument-btn.active:hover .instrument-label {
    color: #ff5722;
}

.instrument-btn:hover,
.instrument-btn.active {
    transform: translateY(-1px);
}




.app-layout {
    box-sizing: border-box;
    margin-left: calc(var(--sidebar-current-width) + var(--layout-horizontal-gap));
    padding: var(--layout-vertical-gap) var(--layout-horizontal-gap) calc(var(--layout-vertical-gap) + 24px);
    min-height: calc(100vh - var(--topbar-height));
    transition: margin-left 0.2s ease, transform 0.2s ease, opacity 0.2s ease, padding 0.2s ease;
}

.layout-divider {
    height: 0px;
    width: 100%;
    background: var(--theme-border);
    margin-bottom: 15px;
    border-radius: 999px;
    box-shadow: 0 1px 0 rgba(0, 0, 0, 0.04);
}

.header-banner {
    display: flex;
    flex-direction: column;
    gap: 16px;
    padding: 10px 24px;
    border-radius: 20px;
    border: 1px solid var(--theme-border-soft);
    background: var(--theme-surface-1);
    color: var(--theme-text);
    box-shadow: var(--theme-shadow, none);
    margin-bottom: 2px;
}

.header-banner-top {
    width: 100%;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 24px;
    flex-wrap: wrap;
}

.header-banner-text {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.header-version-block {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-left: auto;
    align-items: flex-start;
    width: auto;
}

.header-song-title {
    margin: 0;
    font-size: 24px;
    line-height: 1.2;
    font-weight: 700;
    letter-spacing: 0.2px;
    color: var(--theme-text);
    cursor: text;
    border-bottom: 2px solid transparent;
    padding-bottom: 2px;
}

.header-song-title[contenteditable="true"]:focus-visible {
    outline: none;
    border-bottom-color: var(--theme-focus);
}

.header-song-title[data-placeholder]:empty::before {
    content: attr(data-placeholder);
    color: var(--theme-text-muted);
    font-weight: 600;
    pointer-events: none;
}

.header-song-author {
    margin: 0;
    font-size: 15px;
    line-height: 1.4;
    color: var(--theme-text-muted);
    cursor: text;
    border-bottom: 2px solid transparent;
    padding-bottom: 2px;
}

.header-song-author[contenteditable="true"]:focus-visible {
    outline: none;
    border-bottom-color: var(--theme-focus);
}

.header-song-author[data-placeholder]:empty::before {
    content: attr(data-placeholder);
    color: var(--theme-text-muted);
    font-style: italic;
    pointer-events: none;
}

.header-version {
    display: flex;
    align-items: center;
    gap: 8px;
    min-height: 32px;
}

.header-version-label {
    font-size: 14px;
    font-weight: 600;
    color: var(--theme-text-muted);
}

.header-version-name {
    min-width: 80px;
    max-width: 260px;
    padding: 2px 4px;
    border-radius: 0;
    border: none;
    background: transparent;
    font-size: 14px;
    line-height: 1.3;
    font-weight: 600;
    color: var(--theme-text);
    cursor: text;
}

.header-version-name[contenteditable="true"]:focus-visible {
    outline: none;
    border-bottom: 2px solid var(--theme-focus);
    padding-bottom: 0;
}

.header-version-name[data-placeholder]:empty::before {
    content: attr(data-placeholder);
    color: var(--theme-text-muted);
    font-weight: 500;
    pointer-events: none;
}

.header-banner-actions {
    width: 100%;
    display: flex;
    gap: 12px;
    justify-content: flex-start;
    flex-wrap: wrap;
}

.header-action-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    border-radius: 8px;
    border: 1px solid var(--theme-border-soft);
    background: var(--theme-surface-2);
    color: var(--theme-text);
    font-weight: 600;
    font-size: 13px;
    cursor: pointer;
    line-height: 1.2;
    transition: background 0.2s ease, transform 0.2s ease, border-color 0.2s ease;
}

.header-action-btn:hover,
.header-action-btn:focus-visible {
    background: var(--theme-surface-3);
    border-color: var(--theme-border);
    transform: translateY(-1px);
    outline: none;
}

.header-action-btn:active {
    transform: translateY(0);
}

.header-banner-actions .header-action-btn {
    align-items: center;
}

.header-action-btn svg,
.header-action-btn img {
    pointer-events: none;
}

.header-action-icon {
    width: 16px;
    height: 16px;
    display: inline-block;
    object-fit: contain;
}

@media (max-width: 720px) {
    .header-banner-top {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }

    .header-version-block {
        width: 100%;
        margin-left: 0;
        align-items: stretch;
    }

    .header-banner-actions {
        width: 100%;
    }
}

.sidebar {
    position: fixed;
    top: var(--topbar-height);
    left: 0;
    z-index: 20;
    width: var(--sidebar-width-expanded);
    min-width: var(--sidebar-width-expanded);
    max-width: var(--sidebar-width-expanded);
    height: calc(100vh - var(--topbar-height));
    background: var(--theme-surface-1);
    border-radius: 0 24px 24px 0;
    border: 1px solid var(--theme-border-soft);
    color: var(--theme-text);
    display: flex;
    flex-direction: column;
    gap: 16px;
    padding: 24px 20px;
    box-sizing: border-box;
    box-shadow: var(--theme-shadow, none);
    overflow-x: hidden;
    overflow-y: auto;
    transition: width 0.2s ease, min-width 0.2s ease, max-width 0.2s ease, padding 0.2s ease, transform 0.2s ease, opacity 0.2s ease;
    --sidebar-item-bg: var(--theme-surface-1);
    --sidebar-item-border: var(--theme-border-soft);
    --sidebar-item-text: var(--theme-text);
    --sidebar-item-hover-bg: var(--theme-surface-2);
    --sidebar-item-hover-border: var(--theme-border);
    --sidebar-item-active-bg: var(--theme-accent-soft);
    --sidebar-item-active-border: var(--theme-accent-border);
    --sidebar-item-active-text: var(--theme-text);
}

.sidebar.collapsed {
    width: var(--sidebar-width-collapsed);
    min-width: var(--sidebar-width-collapsed);
    max-width: var(--sidebar-width-collapsed);
    padding: 24px 12px;
}

body.sidebar-collapsible .sidebar {
    transform: translateX(-120%);
    opacity: 0;
    pointer-events: none;
    box-shadow: none;
}

body.sidebar-collapsible.sidebar-open .sidebar {
    transform: translateX(0);
    opacity: 1;
    pointer-events: auto;
    box-shadow: var(--theme-shadow, none);
}

.sidebar-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0px;
}

.sidebar-rail-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: flex-start;
    gap: 12px;
    width: 100%;
    padding: 12px 18px;
    border-radius: 16px;
    border: 1px solid var(--sidebar-item-border);
    background: var(--sidebar-item-bg);
    color: var(--sidebar-item-text);
    font-family: var(--app-font-family);
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease, transform 0.2s ease;
}

.sidebar-rail-toggle:hover,
.sidebar-rail-toggle:focus-visible {
    background: var(--sidebar-item-hover-bg);
    border-color: var(--sidebar-item-hover-border);
}

.sidebar-toggle-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    transition: transform 0.2s ease;
}

.sidebar.collapsed .sidebar-toggle-label {
    display: none;
}

.sidebar-title {
    margin: 0;
    font-size: 18px;
    font-weight: 700;
    color: var(--theme-text);
}

.sidebar.collapsed .sidebar-title {
    display: none;
}

.sidebar-subtitle {
    margin: 12px 0 0;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    color: var(--theme-text-muted);
    font-weight: 700;
}

.sidebar.collapsed .sidebar-subtitle {
    display: none;
}

.sidebar-layout-nav {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 6px;
}

.sidebar-layout-nav .layout-btn {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: flex-start;
    gap: 12px;
    width: 100%;
    padding: 12px 18px;
    border-radius: 16px;
    border: 1px solid var(--sidebar-item-border);
    background: var(--sidebar-item-bg);
    color: var(--sidebar-item-text);
    font-family: var(--app-font-family);
    font-weight: 600;
    font-size: 15px;
    line-height: 1.3;
    text-align: left;
    transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease, transform 0.2s ease;
    overflow: hidden;
}

.sidebar:not(.collapsed) .sidebar-layout-nav .layout-btn {
    font-size: 15px;
}

.sidebar-layout-nav .layout-btn-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    line-height: 1;
    width: 28px;
    min-width: 28px;
    transition: margin 0.2s ease, transform 0.2s ease;
}

.sidebar-layout-nav .layout-btn-icon,
.sidebar-layout-nav .layout-btn-label {
    display: inline-flex;
    align-items: center;
    color: inherit;
}

.sidebar-layout-nav .layout-btn-label {
    margin-left: 8px;
    opacity: 1;
    visibility: visible;
    transition: opacity 0.12s ease 0s, visibility 0s linear 0s;
    white-space: nowrap;
}

.sidebar-layout-nav .layout-btn:hover {
    background: var(--sidebar-item-hover-bg);
    border-color: var(--sidebar-item-hover-border);
    transform: translateY(-1px);
}

.sidebar-layout-nav .layout-btn.active {
    background: var(--sidebar-item-active-bg);
    border-color: var(--sidebar-item-active-border);
    color: var(--sidebar-item-active-text);
}

.sidebar-layout-nav .layout-btn:focus-visible {
    outline: 2px solid var(--theme-focus);
    outline-offset: 2px;
}

.sidebar.collapsed .sidebar-layout-nav .layout-btn {
    justify-content: center;
    padding: 12px;
    font-size: 0;
}

.sidebar.collapsed .sidebar-layout-nav .layout-btn::after {
    left: calc(50% - 2px);
}

.sidebar.collapsed .sidebar-layout-nav .layout-btn-icon {
    margin: 0;
}

.sidebar.collapsed .sidebar-layout-nav .layout-btn-label {
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.08s ease 0s, visibility 0s linear 0.08s;
    margin-left: 0;
}

.sidebar.collapsed .song-list {
    display: none;
}

.sidebar-footer {
    margin-top: auto;
    padding-top: 12px;
    display: flex;
    width: 100%;
}

.sidebar-theme-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: flex-start;
    gap: 12px;
    width: 100%;
    padding: 12px 18px;
    border-radius: 16px;
    border: 1px solid var(--sidebar-item-border);
    background: none;
    cursor: pointer;
    font-family: var(--app-font-family);
    font-weight: 600;
    color: var(--sidebar-item-text);
    transition: background 0.2s ease, border-color 0.2s ease, transform 0.2s ease;
}

.sidebar-theme-toggle:hover,
.sidebar-theme-toggle:focus-visible {
    background: var(--sidebar-item-hover-bg);
    border-color: var(--sidebar-item-hover-border);
    outline: none;
}

.sidebar-theme-toggle-icon {
    width: 22px;
    height: 22px;
    flex-shrink: 0;
}

.sidebar-theme-toggle-label {
    display: inline-flex;
    align-items: center;
    white-space: nowrap;
}

.sidebar.collapsed .sidebar-rail-toggle {
    justify-content: center;
    padding: 12px;
    width: auto;
}

.sidebar.collapsed .sidebar-theme-toggle {
    justify-content: center;
    padding: 10px;
    width: auto;
}

.sidebar.collapsed .sidebar-theme-toggle-label {
    display: none;
}

.song-list {
    list-style: none;
    margin: 6px 0 0;
    padding: 0;
    overflow-y: auto;
    flex: 1;
    min-height: 0;
}

.song-project-item {
    margin-bottom: 10px;
}

.song-project-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    border-radius: 12px;
    cursor: pointer;
    margin-bottom: 6px;
}

.song-project-header:hover,
.song-project-header:focus-visible,
.song-project-header.active {
    transform: translateY(-1px);
}

.song-project-header:focus-visible {
    outline: 2px solid rgba(255, 255, 255, 0.85);
    outline-offset: 3px;
}

.song-status-indicator {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.4);
    background: rgba(255, 255, 255, 0.6);
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s ease, border-color 0.2s ease, transform 0.2s ease;
}

.song-project-header.active .song-status-indicator {
    background: #4caf50;
    border-color: #4caf50;
    transform: scale(1.1);
}

.song-project-title {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.song-version-list {
    list-style: none;
    margin: 6px 0 0 24px;
    padding: 0 0 0 12px;
    border-left: 2px solid rgba(255, 255, 255, 0.15);
}

.song-version-item {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 5px 7px;
    border-radius: 6px;
    margin-bottom: 3px;
    background: rgba(0, 0, 0, 0.15);
    color: #f7f7f7;
    cursor: pointer;
}

.song-version-item:hover,
.song-version-item:focus-within,
.song-version-item.active {
    background: rgba(255, 255, 255, 0.9);
    color: #212121;
}

.song-version-select {
    flex: 1;
    display: inline-flex;
    align-items: center;
    color: inherit;
    font: inherit;
    text-align: left;
}

.song-version-item .song-status-indicator {
    margin-right: 6px;
    border-color: rgba(255, 255, 255, 0.45);
}

.song-version-item.active .song-status-indicator {
    background: #4caf50;
    border-color: #4caf50;
    transform: scale(1.1);
}

.song-version-duplicate-btn {
    border: none;
    background: transparent;
    color: inherit;
    cursor: pointer;
    font-size: 16px;
    line-height: 1;
    padding: 4px;
    border-radius: 6px;
    transition: background 0.2s ease, color 0.2s ease;
}

.song-version-duplicate-btn:hover,
.song-version-duplicate-btn:focus-visible {
    background: rgba(0, 0, 0, 0.12);
    color: #00695c;
    outline: none;
}

.song-version-delete-btn {
    border: none;
    background: transparent;
    color: inherit;
    cursor: pointer;
    font-size: 16px;
    line-height: 1;
    padding: 4px;
    border-radius: 6px;
    transition: background 0.2s ease, color 0.2s ease;
}

.song-version-delete-btn:hover,
.song-version-delete-btn:focus-visible {
    background: rgba(176, 0, 32, 0.12);
    color: #b00020;
    outline: none;
}

.song-close-btn {
    border: none;
    background: transparent;
    color: inherit;
    cursor: pointer;
    font-size: 18px;
    line-height: 1;
    border-radius: 6px;
    padding: 4px;
    opacity: 0;
    transition: background 0.2s ease, color 0.2s ease, opacity 0.2s ease;
}

.song-project-header:hover .song-close-btn,
.song-project-header:focus-within .song-close-btn,
.song-project-header.active .song-close-btn {
    opacity: 1;
}

.song-close-btn:hover,
.song-close-btn:focus-visible {
    background: rgba(0, 0, 0, 0.1);
    color: #b00020;
    outline: none;
}

.plan-modal[hidden] {
    display: none !important;
}

.plan-modal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 32px 16px;
    z-index: 999;
}

.plan-modal-panel {
    background: #ffffff;
    border-radius: 20px;
    padding: 32px 28px;
    max-width: 980px;
    width: 100%;
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.plan-modal-close {
    position: absolute;
    top: 16px;
    right: 16px;
    border: none;
    background: rgba(0, 0, 0, 0.1);
    color: #333;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    font-size: 18px;
    font-weight: 700;
    cursor: pointer;
}

.plan-modal-subtitle {
    margin: 0;
    font-size: 15px;
    color: #555;
}

.plan-modal-feedback {
    min-height: 18px;
    font-size: 13px;
    font-weight: 600;
}

.plan-modal-feedback[data-status="loading"] {
    color: #1976d2;
}

.plan-modal-feedback[data-status="success"] {
    color: #2e7d32;
}

.plan-modal-feedback[data-status="error"] {
    color: #d32f2f;
}

.plan-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 20px;
}

.plan-card {
    border-radius: 18px;
    border: 1px solid rgba(0, 0, 0, 0.08);
    background: linear-gradient(165deg, rgba(255, 255, 255, 0.95), rgba(255, 255, 255, 0.82));
    padding: 24px 20px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.plan-card.active {
    border-color: rgba(255, 112, 67, 0.6);
}

.plan-card-header h3 {
    margin: 0;
    font-size: 20px;
    color: #ff7043;
}

.plan-price {
    margin: 4px 0;
    font-weight: 700;
    color: #2c2c2c;
}

.plan-tagline {
    margin: 0;
    font-size: 13px;
    color: #555;
}

.plan-feature-list {
    margin: 0;
    padding-left: 18px;
    font-size: 13px;
    color: #333;
    display: grid;
    gap: 6px;
}

.plan-choose-btn {
    border: none;
    border-radius: 12px;
    padding: 12px 16px;
    font-weight: 700;
    font-size: 14px;
    cursor: pointer;
    color: #fff;
    background: linear-gradient(135deg, #ff7e5f, #ff8f70);
}

.plan-choose-btn:hover {
    transform: translateY(-1px);
}

.plan-choose-btn.active,
.plan-choose-btn[aria-pressed="true"] {
    background: #2e7d32;
}

@media (max-width: 720px) {
    .account-menu {
        flex-wrap: wrap;
        justify-content: center;
    }
    .plan-modal {
        align-items: flex-end;
    }
    .plan-modal-panel {
        max-height: 90vh;
        overflow-y: auto;
    }
}

.song-list li.song-list-empty {
    background: transparent;
    color: rgba(0, 0, 0, 0.6);
    cursor: default;
    pointer-events: none;
}

.main-content {
    display: flex;
    flex-direction: column;
    gap: 20px;
    min-width: 0;
    overflow-x: hidden;
    overflow-y: auto;
}

.header {
    display: flex;
    flex-direction: column;
    gap: 16px;
    color: #212121;
    font-weight: 600;
    width: 100%;
    box-sizing: border-box;
    background: transparent;
}

.header-block {
    padding: 8px 16px;
    width: 100%;
    box-sizing: border-box;
}

.header-block.header-top {
    padding: 18px 24px;
    border-radius: 20px;
    border: 1px solid var(--theme-border-soft);
    background: var(--theme-surface-1);
    color: var(--theme-text);
    box-shadow: var(--theme-shadow, none);
}

.header-top {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 12px 20px;
}

.header-top-controls {
    display: flex;
    align-items: center;
    gap: 18px;
    flex-wrap: wrap;
}

.header-quick-controls {
    display: flex;
    align-items: flex-end;
    gap: 16px;
    flex-wrap: wrap;
}

.header-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 8px 12px;
    flex: 1 1 360px;
    min-width: 0;
}

.meta-field {
    display: flex;
    flex-direction: column;
    gap: 2px;
    flex: 1 1 200px;
    min-width: 140px;
}

.meta-label {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: rgba(0, 0, 0, 0.6);
}

.meta-label strong {
    font-weight: 700;
}

.meta-field input {
    flex: 1 1 auto;
    min-width: 140px;
    max-width: 220px;
}

.quick-controls {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 2px;
    min-width: 80px;
}

.quick-control-label {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: rgba(0, 0, 0, 0.65);
    white-space: nowrap;
}

.quick-control-label strong {
    font-weight: 700;
}

.quick-control-input {
    width: 70px;
    padding: 4px 6px;
    height: 30px;
    border-radius: 6px;
    border: 1px solid rgba(0, 0, 0, 0.2);
    background: rgba(255, 255, 255, 0.9);
    font-size: 16px;
}


.header-top-controls .instrument-toggle {
    gap: 8px;
}

.header-top-controls .header-rhythm {
    margin-left: 0;
    justify-content: flex-start;
}

.header-bottom {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px;
}

.header-rhythm {
    display: flex;
    align-items: center;
    margin-left: auto;
    justify-content: flex-end;
}

.title-author {
    display: contents;
}

.title-input,
.author-input,
.version-name-input {
    width: 100%;
}

.rhythm-primary-display {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 10px 18px;
    border-radius: 10px;
    background: rgba(0, 0, 0, 0.08);
    color: #333;
    font-weight: 600;
    min-height: 0;
    transition: background 0.2s ease;
    white-space: nowrap;
    max-width: 100%;
}

.rhythm-primary-label {
    text-transform: uppercase;
    letter-spacing: 0.6px;
    font-size: 12px;
    color: #212121;
    transition: color 0.2s ease;
}

.rhythm-primary-sequence {
    font-size: 18px;
    letter-spacing: 1px;
    display: inline-block;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
}

.rhythm-primary-display.has-rhythm {
    background: rgba(255, 112, 67, 0.12);
}

.control-stack {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
}

.instrument-stack {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
    min-width: 140px;
}

.assistant-panel {
    display: none;
    flex: 1 1 0%;
    min-height: 0;
    padding: 16px;
    border-radius: 12px;
    background: transparent;
    overflow-y: auto;
    flex-direction: column;
}

.layout-btn-logo {
    width: 28px;
    height: 28px;
    object-fit: contain;
    pointer-events: none;
}

.lyrics_container.layout-assistant {
    /* Make assistant layout occupy the full content area like other layouts */
    display: flex;
    align-items: stretch;
    gap: 0;
}

/* hide other sibling panels when assistant layout is active */
.lyrics_container.layout-assistant textarea:not(.assistant-textarea),
.lyrics_container.layout-assistant .guide-panel,
.lyrics_container.layout-assistant .lyrics-output,
.lyrics_container.layout-assistant .tab-panel,
.lyrics_container.layout-assistant .rhythm-panel {
    display: none !important;
}

/* ensure the assistant-panel element becomes the sole visible, full-size panel */
.lyrics_container #assistant-panel {
    /* assistant panel hidden by default unless its parent container has the layout-assistant class */
    display: none;
}

.lyrics_container.layout-assistant #assistant-panel {
    display: flex !important;
    flex: 1 1 auto;
    min-height: 0;
    width: 100%;
    box-sizing: border-box;
}

.assistant-panel .song-assistant-dialog {
    display: flex;
    flex-direction: column;
    width: 100%;
    height: 100%;
    margin: 0;
    /* Make assistant visually consistent with the app's theme by removing
       the white inner card and using a subtle transparent background */
    background: transparent;
    border-radius: 0;
    overflow: hidden;
}

.song-assistant-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px 16px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.08);
}

.song-assistant-header h2 {
    margin: 0;
    font-size: 24px;
    letter-spacing: 0.4px;
}

.song-assistant-body {
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0;
    height: 100%;
    overflow: hidden;
}

/* Make the assistant layout horizontal by default: menu on the left, panels on the right */
.song-assistant-layout {
    display: flex;
    flex-direction: row;
    align-items: stretch;
    gap: 0;
    height: 100%;
}

.assistant-menu {
    flex: 0 0 180px;
    padding: 16px 12px;
    background: #ffffff;
    border-radius: 12px;
    margin: 8px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}


.assistant-menu-btn {
    border: none;
    background: transparent;
    padding: 12px 16px;
    text-align: left;
    width: 100%;
    cursor: pointer;
    font-weight: 600;
    border-radius: 10px;
    transition: all 0.2s ease;
    color: #444;
}

.assistant-menu-btn.is-active,
.assistant-menu-btn:hover {
    background: #ff7e5f;
    color: white;
}

.assistant-panels {
    flex: 1 1 auto;
    padding: 18px;
    overflow: auto;
    background: rgba(255, 255, 255, 0.24);
    border: 1px solid rgba(255, 255, 255, 0.35);
    border-radius: 16px;
    backdrop-filter: blur(4px);
    position: relative;
}

.assistant-panels::before {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    top: 0;
    height: 4px;
    border-top-left-radius: 16px;
    border-top-right-radius: 16px;
    background: linear-gradient(90deg, #ff7e5f, #feb47b);
}

.assistant-panels-header {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 12px;
    padding: 8px 12px 8px;
    margin-bottom: 8px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.06);
}

.assistant-panels-header h2 {
    margin: 0;
    font-size: 20px;
    font-weight: 800;
    color: #1f1f1f;
}

.assistant-fragment {
    display: flex;
    flex-direction: column;
    gap: 8px;
    background: rgba(255, 255, 255, 0.95);
    border: 1px solid rgba(0, 0, 0, 0.06);
    padding: 8px 14px 12px;
    border-radius: 12px;
    width: 100%;
    box-sizing: border-box;
}

.assistant-fragment:hover {
    transform: translateY(-1px);
}

/* subtle highlight when a new fragment appears */
.assistant-fragment.is-new {
    animation: assistant-fragment-pulse 600ms ease both;
}

@keyframes assistant-fragment-pulse {
}

.couplet-lexicals-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 12px;
}

.couplet-lexicals-list .is-muted {
    margin: 0;
    padding: 24px 16px;
    border-radius: 12px;
    background: rgba(0, 0, 0, 0.04);
    color: rgba(0, 0, 0, 0.55);
    text-align: center;
}

.couplet-stories-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 12px;
}

.couplet-stories-list .is-muted {
    margin: 0;
    padding: 24px 16px;
    border-radius: 12px;
    background: rgba(0, 0, 0, 0.04);
    color: rgba(0, 0, 0, 0.55);
    text-align: center;
}

.assistant-history-lexical {
    margin: 16px 0;
}

.assistant-history-lexical .writing-lexical-block {
    width: 100%;
}

.assistant-story-card-body {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    align-items: stretch;
    width: 100%;
    box-sizing: border-box;
}

.assistant-story-text {
    flex: 1 1 260px;
    min-width: 220px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.assistant-story-text .assistant-textarea {
    width: 100%;
}

.assistant-story-lexical {
    flex: 1 1 240px;
    min-width: 220px;
    max-width: 100%;
    overflow: hidden;
}

.assistant-story-lexical .writing-lexical-block {
    width: 100%;
    box-sizing: border-box;
}

.assistant-story-lexical .writing-lexical-block + .writing-lexical-block {
    margin-top: 12px;
}

.writing-section-title {
    font-size: 18px;
    font-weight: 700;
    color: #37474f;
    letter-spacing: 0.3px;
}

.writing-section-row {
    display: flex;
    flex-wrap: wrap;
    gap: 24px;
    align-items: stretch;
}

.writing-lyrics-wrapper,
.writing-story-wrapper {
    flex: 1 1 320px;
    min-width: 260px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    align-self: stretch;
}

.writing-lyrics {
    min-height: 220px !important;
    flex: 1 1 auto;
    height: 100%;
    display: flex;
}

.writing-story-block {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 12px 14px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.68);
    border: 1px solid rgba(0, 0, 0, 0.08);
    min-height: 220px;
    height: 100%;
}

.writing-story-content {
    white-space: pre-wrap;
    font-size: 14px;
    color: #333;
    line-height: 1.5;
    flex: 1 1 auto;
    display: flex;
    align-items: flex-start;
}

.writing-story-content.is-empty {
    color: rgba(0, 0, 0, 0.45);
    font-style: italic;
}

.writing-notes-wrapper {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.assistant-fragment-label {
    font-weight: 700;
    color: #333;
}

.assistant-fragment-lexical .assistant-fragment-label {
    color: #ff7043;
}

.assistant-fragment-story .assistant-fragment-label {
    color: #5c6bc0;
}

.assistant-fragment textarea {
    min-height: 140px;
    background: rgba(255,255,255,0.98);
    border: 1px solid rgba(0,0,0,0.06);
    padding: 12px 14px;
    border-radius: 10px;
}

.assistant-panel {
    display: flex;
    flex-direction: column;
    width: 100%;
    height: 100%;
    box-sizing: border-box;
    background: transparent;
    border-radius: 12px;
    padding: 12px;
}

/* hide panels via the hidden attribute (clean, accessible) */
.assistant-panels > .assistant-panel[hidden] {
    display: none !important;
}

/* visible panel should fill the panels area */
.assistant-panels > .assistant-panel:not([hidden]) {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.song-assistant-progress {
    flex: 0 0 220px;
    display: flex;
    flex-direction: column;
    list-style: none;
    padding: 16px;
    margin: 0;
    border-radius: 16px;
    background: rgba(0, 0, 0, 0.04);
    gap: 10px;
    position: sticky;
    top: 0;
    max-height: calc(100vh - 220px);
    overflow-y: auto;
}

.progress-step {
    display: block;
}

.progress-step-btn {
    width: 100%;
    border: none;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 14px;
    border-radius: 12px;
    cursor: pointer;
    font-weight: 600;
    text-align: left;
    background: rgba(255, 255, 255, 0.8);
    color: rgba(0, 0, 0, 0.75);
    letter-spacing: 0.4px;
}

.progress-step-btn:hover,
.progress-step-btn:focus-visible {
    background: rgba(255, 255, 255, 0.98);
    color: #d84315;
    outline: none;
    transform: translateX(2px);
}

.progress-step-index {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: rgba(255, 112, 67, 0.18);
    color: #d84315;
    font-size: 13px;
    font-weight: 700;
}

.progress-step-label {
    flex: 1 1 auto;
    text-transform: uppercase;
    font-size: 12px;
    letter-spacing: 0.6px;
}

.progress-step.is-active .progress-step-btn {
    background: linear-gradient(135deg, rgba(255, 112, 67, 0.22), rgba(255, 112, 67, 0.32));
    color: #bf360c;
}

.progress-step.is-active .progress-step-index {
    background: #ff7043;
    color: #fff;
}

.progress-step.is-complete .progress-step-btn {
    background: rgba(76, 175, 80, 0.16);
    color: #1b5e20;
}

.progress-step.is-complete .progress-step-index {
    background: #4caf50;
    color: #fff;
}

.song-assistant-content {
    display: flex;
    flex-direction: column;
    gap: 20px;
    flex: 1 1 auto;
    min-width: 0;
}

/* Make the story step expand so the textarea fills available space */
.song-assistant-step[data-step="2"] {
    display: flex;
    flex-direction: column;
    min-height: 0; /* allow children to shrink properly */
    flex: 1 1 auto;
}

.song-assistant-step[data-step="2"] .assistant-textarea {
    flex: 1 1 auto;
    min-height: 0; /* ensure it can shrink/grow with container */
    height: auto; /* override rows hint */
}

.song-assistant-step h3 {
    margin-top: 0;
    letter-spacing: 0.3px;
}

.song-assistant-step p {
    margin-bottom: 12px;
    color: rgba(0, 0, 0, 0.65);
    font-size: 14px;
}

.assistant-label {
    display: block;
    font-weight: 600;
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-size: 12px;
    color: rgba(0, 0, 0, 0.7);
}

.assistant-input,
.assistant-textarea {
    width: 100%;
    border-radius: 10px;
    border: 1px solid rgba(0, 0, 0, 0.12);
    padding: 10px 14px;
    font-size: 16px;
    background: rgba(255, 255, 255, 0.95);
}

.assistant-input.is-invalid,
.assistant-textarea.is-invalid {
    border-color: rgba(229, 57, 53, 0.85);
}

.assistant-textarea {
    resize: vertical;
    min-height: 120px;
}

.structure-builder {
    display: grid;
    grid-template-columns: minmax(0, 220px) 1fr;
    gap: 20px;
}

.structure-options {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 16px;
    border-radius: 12px;
    background: rgba(0, 0, 0, 0.05);
}

.structure-option {
    border: none;
    border-radius: 8px;
    padding: 10px 14px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    cursor: pointer;
    background: rgba(255, 255, 255, 0.9);
}

.structure-option:hover {
    transform: translateY(-2px);
    background: rgba(255, 255, 255, 1);
}

.structure-sequence {
    display: flex;
    flex-direction: column;
    gap: 12px;
    background: rgba(0, 0, 0, 0.03);
    padding: 16px;
    border-radius: 12px;
}

.structure-sequence h4 {
    margin: 0;
    letter-spacing: 0.4px;
}

.structure-list {
    margin: 0;
    padding: 0;
    list-style: none;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.structure-item {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    border-radius: 999px;
    background: rgba(255, 112, 67, 0.18);
    font-weight: 600;
    letter-spacing: 0.4px;
}
.structure-item.dragging {
    opacity: 0.5;
    transform: scale(0.98);
}
.structure-placeholder {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 120px;
    height: 42px;
    border-radius: 999px;
    border: 2px dashed rgba(255, 112, 67, 0.45);
    background: rgba(255, 112, 67, 0.12);
    margin-bottom: 8px;
}

.structure-item button {
    border: none;
    background: transparent;
    cursor: pointer;
    font-size: 14px;
    line-height: 1;
    padding: 0;
    color: rgba(0, 0, 0, 0.6);
}

.structure-empty {
    margin: 0;
    font-size: 14px;
    color: rgba(0, 0, 0, 0.55);
}

.structure-empty.is-warning {
    color: #d32f2f;
    font-weight: 600;
}

.structure-actions {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.writing-container {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.writing-block {
    display: flex;
    flex-direction: column;
    gap: 16px;
    padding: 16px;
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.24);
    border: 1px solid rgba(255, 255, 255, 0.45);
    backdrop-filter: blur(4px);
}

.writing-lexical-block {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 12px 14px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.68);
    border: 1px solid rgba(0, 0, 0, 0.08);
}

.writing-lexical-title,
.writing-lyrics-label,
.writing-story-label,
.writing-ideas-label {
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    font-size: 12px;
    color: rgba(0, 0, 0, 0.65);
}

.writing-lexical-content {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.writing-lexical-pill {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    border-radius: 999px;
    background: rgba(255, 112, 67, 0.16);
    color: #d84315;
    font-weight: 600;
    font-size: 13px;
    letter-spacing: 0.2px;
}

.writing-lexical-pill[role="button"] {
    cursor: pointer;
}

.writing-lexical-pill[role="button"]:hover,
.writing-lexical-pill[role="button"]:focus-visible {
    background: rgba(255, 112, 67, 0.28);
    transform: translateY(-1px);
    outline: none;
}

.writing-lexical-pill.is-empty {
    background: rgba(0, 0, 0, 0.06);
    color: rgba(0, 0, 0, 0.45);
    font-weight: 500;
}

.writing-ideas {
    min-height: 96px !important;
}

@media (max-width: 900px) {
    .writing-section-row {
        flex-direction: column;
    }

    .writing-lyrics-wrapper,
    .writing-story-wrapper {
        min-width: 0;
        width: 100%;
    }
}

.assistant-btn {
    border: none;
    border-radius: 10px;
    padding: 10px 16px;
    font-weight: 600;
    width: 220px;
    flex: 0 0 220px;
    background: rgba(255, 112, 67, 0.16);
    color: #d84315;
}

.assistant-btn:hover {
    transform: translateY(-1px);
    background: rgba(255, 112, 67, 0.27);
}

.assistant-btn-primary {
    background: linear-gradient(135deg, #ff7043, #ff5722);
    color: #fff;
}

.assistant-btn-primary:hover {
    background: linear-gradient(135deg, #ff8a65, #ff7043);
}

.assistant-btn-secondary {
    background: rgba(0, 0, 0, 0.08);
    color: #333;
}

.assistant-btn-secondary:hover {
    background: rgba(0, 0, 0, 0.12);
}

.song-assistant-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 16px 24px 20px;
    border-top: 1px solid rgba(0, 0, 0, 0.08);
    background: rgba(255, 255, 255, 0.9);
}

.song-assistant-navigation {
    display: inline-flex;
    gap: 12px;
    align-items: center;
}

.song-assistant-review {
    margin-top: 18px;
    padding: 16px;
    border-radius: 12px;
    background: rgba(0, 0, 0, 0.03);
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.song-assistant-review dl {
    margin: 0;
    display: grid;
    grid-template-columns: max-content 1fr;
    gap: 8px 18px;
}

.song-assistant-review dt {
    font-weight: 700;
    letter-spacing: 0.4px;
}

.song-assistant-review dd {
    margin: 0;
    color: rgba(0, 0, 0, 0.75);
}

.assistant-btn:disabled,
.assistant-btn[disabled] {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.song-assistant-dialog::-webkit-scrollbar {
    width: 10px;
}

.song-assistant-dialog::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.05);
}

.song-assistant-dialog::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.18);
    border-radius: 999px;
}

.song-assistant-dialog::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 0, 0, 0.3);
}

.song-assistant-body::-webkit-scrollbar {
    width: 10px;
}

.song-assistant-body::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 999px;
}

.song-assistant-body::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.05);
}

@media (max-width: 880px) {
    .assistant-panel {
        padding: 12px;
    }

    .assistant-panel .song-assistant-dialog {
        width: 100%;
    }

    .song-assistant-layout {
        flex-direction: column;
    }

    .song-assistant-progress {
        flex-direction: row;
        flex-wrap: wrap;
        position: static;
        max-height: none;
        gap: 12px;
    }

    .progress-step {
        flex: 1 1 calc(50% - 12px);
    }

    .progress-step-btn {
        justify-content: flex-start;
    }

    .structure-builder {
        grid-template-columns: 1fr;
    }

    .structure-options {
        flex-direction: row;
        flex-wrap: wrap;
        justify-content: center;
    }
}


.title-input,
.author-input,
.version-name-input {
    background: transparent;
    border: none;
    border-bottom: 2px solid rgba(0, 0, 0, 0.4);
    border-radius: 0;
    padding: 4px 2px;
    min-width: 140px;
    color: #1c1c1c;
}

.title-input {
    font-size: 20px;
    font-weight: 700;
}

.author-input {
    font-size: 14px;
    font-style: italic;
}

.version-name-input {
    font-size: 13px;
}

.title-input:focus,
.author-input:focus,
.version-name-input:focus {
    outline: none;
    border-bottom-color: rgba(33, 150, 243, 0.85);
}

.title-input::placeholder,
.author-input::placeholder,
.version-name-input::placeholder {
    color: rgba(0, 0, 0, 0.45);
}

.layout-toggle {
    display: flex;
    flex-direction: column;
    gap: 10px;
    width: 100%;
    --layout-btn-background: rgba(255, 255, 255, 0.25);
    --layout-btn-border: rgba(255, 255, 255, 0.45);
    --layout-btn-color: #3b3b3b;
    --layout-btn-hover: rgba(255, 255, 255, 0.4);
    --layout-btn-hover-border: rgba(255, 255, 255, 0.7);
    --layout-btn-shadow: 0 6px 16px rgba(0, 0, 0, 0.08);
    --layout-btn-active-bg: #ff7043;
    --layout-btn-active-color: #fff;
    --layout-btn-active-shadow: 0 10px 22px rgba(255, 112, 67, 0.28);
    --layout-btn-focus-outline: rgba(255, 112, 67, 0.35);
}

.layout-toggle .account-settings-nav-button {
    justify-content: flex-start;
}

.layout-toggle .icon-btn {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 0;
    padding: 12px 16px;
    border-radius: 12px;
    border: 1px solid var(--layout-btn-border);
    box-sizing: border-box;
    background: var(--layout-btn-background);
    color: var(--layout-btn-color);
    font-size: 15px;
    font-weight: 600;
    line-height: 1.3;
}

.layout-toggle .icon-btn:hover,
.layout-toggle .icon-btn:focus-visible {
    background: var(--layout-btn-hover);
    border-color: var(--layout-btn-hover-border);
    transform: translateY(-1px);
}

.layout-toggle .icon-btn:focus-visible {
    outline: none;
}

.layout-toggle .icon-btn.active {
    background: var(--layout-btn-active-bg);
    color: var(--layout-btn-active-color);
    border: none;
    transform: translateY(0);
}

.layout-toggle .icon-btn.active:focus-visible {
}

.base-chord-control {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: bold;
    color: #212121;
    white-space: nowrap;
}

.base-chord-control select {
    padding: 6px 10px;
    border-radius: 6px;
    border: 1px solid rgba(0, 0, 0, 0.2);
    font-size: 16px;
    background: rgba(255, 255, 255, 0.85);
}

.title-input::placeholder {
    color: rgba(33, 33, 33, 0.6);
}

.lyrics_container {
    display: flex;
    gap: 20px;
    border-radius: 12px;
    max-width: 100%;
    flex: 1 1 auto;
    min-height: 0;
    align-items: stretch;
    min-width: 0;
    overflow: visible;
}

.lyrics_container.layout-lyrics {
    background: transparent;
    border: none;
}

.lyrics_container.layout-guide {
    background: transparent;
    border: none;
}

.lyrics_container.layout-lyrics textarea {
    display: block;
}

.lyrics_container.layout-lyrics #lyrics-input {
    flex: 0 0 auto;
    min-width: 240px;
    resize: horizontal;
    overflow: auto;
}

.lyrics_container.layout-lyrics .guide-panel {
    display: none;
}

.lyrics_container.layout-guide textarea {
    display: none;
}

.lyrics_container.layout-guide .guide-panel {
    display: flex;
}

.lyrics_container.layout-guide .lyrics-output {
    flex: 1 1 auto;
}

.lyrics_container.layout-chords textarea,
.lyrics_container.layout-chords .guide-panel {
    display: none;
}

.lyrics_container.layout-chords {
    background: rgba(255, 255, 255, 0.9);
    flex: 1 1 auto;
    min-height: 0;
    display: flex;
    flex-direction: column;
}

.lyrics_container.layout-chords .lyrics-output {
    flex: 1 1 auto;
    min-height: 0;
    overflow: auto;
}

.lyrics_container.layout-tab textarea,
.lyrics_container.layout-tab .guide-panel,
.lyrics_container.layout-tab .lyrics-output {
    display: none;
}

.rhythm-panel {
    display: none;
    flex: 1 1 auto;
    min-height: 0;
    padding: 16px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.85);
    gap: 20px;
}

.lyrics_container.layout-rhythm textarea,
.lyrics_container.layout-rhythm .guide-panel,
.lyrics_container.layout-rhythm .lyrics-output,
.lyrics_container.layout-rhythm .tab-panel {
    display: none;
}

.lyrics_container.layout-rhythm .rhythm-panel {
    display: flex;
    flex-wrap: wrap;
}

.rhythm-saved,
.rhythm-generator {
    flex: 1 1 320px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.rhythm-saved {
    border-right: 1px solid rgba(0, 0, 0, 0.1);
    padding-right: 16px;
}

.rhythm-generator {
    padding-left: 16px;
}

.rhythm-editor {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 12px;
    padding: 12px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.9);
}

.rhythm-editor[hidden] {
    display: none;
}

.rhythm-editor-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.rhythm-editor-header h4 {
    margin: 0;
    font-size: 16px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.rhythm-editor-close {
    background: rgba(0, 0, 0, 0.1);
}

.rhythm-editor-config {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.rhythm-editor-config label {
    display: flex;
    flex-direction: column;
    gap: 6px;
    font-size: 13px;
    font-weight: 600;
    color: #363636;
}

.rhythm-editor-config select {
    padding: 6px 10px;
    border-radius: 6px;
    border: 1px solid rgba(0, 0, 0, 0.2);
    background: rgba(255, 255, 255, 0.9);
}

.rhythm-editor-grid {
    display: grid;
    gap: 8px;
    grid-auto-rows: 48px;
    border: 1px dashed rgba(0, 0, 0, 0.2);
    padding: 10px;
    border-radius: 10px;
    background: rgba(0, 0, 0, 0.04);
}

.rhythm-editor-cell {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.8);
    font-size: 20px;
    font-weight: 600;
    color: #222;
    cursor: pointer;
    border: 2px solid transparent;
    transition: background 0.2s ease, transform 0.2s ease, border-color 0.2s ease;
}

.rhythm-editor-cell:hover {
    background: rgba(255, 255, 255, 1);
    transform: translateY(-1px);
}

.rhythm-editor-cell.is-active {
    border-color: #ff7043;
}

.rhythm-editor-cell.is-empty {
    color: rgba(0, 0, 0, 0.25);
}

.rhythm-editor-symbols {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.rhythm-symbol-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
    border-radius: 8px;
    border: none;
    background: rgba(0, 0, 0, 0.1);
    font-size: 18px;
    cursor: pointer;
    transition: background 0.2s ease, transform 0.2s ease;
}

.rhythm-symbol-btn span {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.rhythm-symbol-btn:hover,
.rhythm-symbol-btn:focus-visible {
    background: rgba(0, 0, 0, 0.2);
    transform: translateY(-1px);
    outline: none;
}

.rhythm-symbol-btn.is-selected {
    background: #ff7043;
    color: #fff;
}

.rhythm-editor-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.rhythm-editor-actions .icon-btn {
    min-width: 110px;
}

.rhythm-legend {
    margin-top: 12px;
    padding: 12px;
    border-radius: 10px;
    background: rgba(0, 0, 0, 0.05);
}

.rhythm-legend h4 {
    margin: 0 0 8px;
    font-size: 16px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #3a3a3a;
}

.rhythm-legend ul {
    margin: 0;
    padding-left: 16px;
    display: grid;
    gap: 6px;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

.rhythm-legend li {
    list-style: none;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    color: #333;
}

.legend-symbol {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    border-radius: 6px;
    background: rgba(0, 0, 0, 0.08);
    font-weight: 700;
    font-size: 16px;
}

.rhythm-panel h3 {
    margin: 0;
    font-size: 20px;
    color: #2c2c2c;
    display: flex;
    align-items: center;
    gap: 8px;
}

.rhythm-saved-header,
.rhythm-generator-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
}

.rhythm-controls {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.rhythm-controls input {
    width: 72px;
    padding: 6px 8px;
    border-radius: 6px;
    border: 1px solid rgba(0, 0, 0, 0.2);
    background: rgba(255, 255, 255, 0.9);
    font-size: 14px;
}

.rhythm-list {
    list-style: none;
    margin: 0;
    padding: 0;
    border-radius: 10px;
    background: rgba(0, 0, 0, 0.05);
    flex: 1 1 auto;
    overflow-y: auto;
    padding: 8px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.rhythm-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 12px;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.9);
    position: relative;
}

.rhythm-card::before {
    content: "";
    position: absolute;
    top: 8px;
    left: 10px;
    font-size: 16px;
    opacity: 0.75;
}

.rhythm-card[data-rhythm-source="manual"]::before {
    content: "★";
    color: #ff7043;
}

.rhythm-card[data-rhythm-source="generated"]::before {
    content: "⚙";
    color: #607d8b;
}

.rhythm-sequence {
    font-size: 18px;
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    color: #292929;
    margin-left: 20px;
}

.rhythm-actions {
    display: inline-flex;
    gap: 6px;
    align-items: center;
}

.rhythm-actions button {
    border: none;
    background: rgba(0, 0, 0, 0.08);
    padding: 6px;
    border-radius: 50%;
    cursor: pointer;
    transition: background 0.2s ease, transform 0.2s ease;
    font-size: 16px;
    line-height: 1;
}

.rhythm-actions button:hover {
    background: rgba(0, 0, 0, 0.2);
    transform: translateY(-1px);
}

.rhythm-actions button.is-playing {
    background: rgba(255, 112, 67, 0.25);
    color: #ff7043;
}

.rhythm-actions button:disabled {
    opacity: 0.45;
    cursor: default;
    transform: none;
}

.rhythm-actions button:focus-visible {
    outline: none;
}

.rhythm-primary-toggle {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    letter-spacing: 0.4px;
    text-transform: uppercase;
    font-weight: 600;
    color: rgba(0, 0, 0, 0.6);
    cursor: pointer;
    user-select: none;
}

.rhythm-primary-toggle input[type="checkbox"] {
    accent-color: #ff7043;
    width: 16px;
    height: 16px;
    cursor: pointer;
}

.rhythm-primary-toggle span {
    display: inline-block;
}

.rhythm-empty {
    margin: 0;
    padding: 16px;
    border-radius: 10px;
    background: rgba(0, 0, 0, 0.05);
    color: rgba(0, 0, 0, 0.6);
    font-style: italic;
}

.rhythm-random-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 12px;
    flex: 1 1 auto;
    overflow-y: auto;
}

.rhythm-generator-card {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 12px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.92);
}

.rhythm-generator-card .rhythm-sequence {
    justify-content: center;
}

.rhythm-generator-card .rhythm-actions {
    justify-content: center;
}

.rhythm-generator-card .rhythm-actions button {
    border-radius: 8px;
    padding: 6px 10px;
    background: rgba(0, 0, 0, 0.08);
}
.lyrics_container.layout-tab .tab-panel {
    display: flex;
    flex: 1 1 0%;
    flex-direction: column;
    gap: 12px;
    min-height: 0;
    max-height: 100%;
    overflow: hidden;
}

.lyrics_container.layout-tab .tab-toolbar {
    flex: 0 0 auto;
}

.lyrics_container.layout-tab {
    background: rgba(255, 255, 255, 0.98);
    flex: 1 1 0%;
    min-height: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* Global textarea: neutral, full-width by default. Specific components override with
   more precise classes (e.g. .assistant-textarea). */
textarea {
    display: block;
    width: 100%;
    max-width: 100%;
    min-height: 120px;
    padding: 12px 14px;
    font-size: 15px;
    line-height: 1.4;
    border: 1px solid rgba(0,0,0,0.08);
    border-radius: 10px;
    resize: vertical;
    background: rgba(255, 255, 255, 0.92);
    color: #111;
    box-sizing: border-box;
}

/* Override global textarea rules for assistant-specific textareas so they remain
   visible and look polished inside assistant panels. */
.assistant-textarea {
    flex: 1 1 auto !important;
    max-width: 100% !important;
    height: 100% !important;
    min-height: 140px !important;
    display: block !important;
    box-sizing: border-box !important;
    background: rgba(255, 255, 255, 0.98) !important;
    color: #111 !important;
    border: 1px solid rgba(0,0,0,0.06) !important;
    padding: 14px 16px !important;
    border-radius: 12px !important;
}

textarea.writing-lyrics {
    white-space: pre-wrap !important;
    word-break: break-word;
    min-height: 220px !important;
}

.assistant-textarea::placeholder {
    color: rgba(0,0,0,0.45) !important;
}

.assistant-textarea:focus {
    outline: none !important;
    border-color: rgba(33,150,243,0.9) !important;
}

/* Make the history/story panel expand so the main story textarea grows */
#panel-history {
    display: flex;
    flex-direction: column;
    gap: 12px;
    min-height: 0;
    height: 100%;
}

#panel-history .assistant-textarea:first-of-type {
    flex: 1 1 auto;
    min-height: 220px !important;
}

.lyrics-output {
    flex: 1 1 auto;
    min-width: 0;
    min-height: 0;
    height: 100%;
    box-sizing: border-box;
    overflow: auto;
}

.lyrics_container.layout-lyrics .lyrics-output,
.lyrics_container.layout-guide .lyrics-output,
.lyrics_container.layout-chords .lyrics-output {
    border-radius: 14px;
    padding: 16px;
}

.lyrics_container.layout-lyrics .lyrics-output,
.lyrics_container.layout-guide .lyrics-output,
.lyrics_container.layout-chords .lyrics-output {
    background: #ffffff;
    border: 1px solid rgba(31, 31, 31, 0.08);
}

.lyrics_container.layout-lyrics .lyrics-output,
.lyrics_container.layout-guide .lyrics-output,
.lyrics_container.layout-chords .lyrics-output {
    padding-bottom: 48px;
    scroll-padding-bottom: 48px;
}

.lyrics_container.layout-lyrics .lyrics-output::after,
.lyrics_container.layout-guide .lyrics-output::after,
.lyrics_container.layout-chords .lyrics-output::after {
    content: "";
    display: block;
    height: 24px;
    flex-shrink: 0;
}

.lyrics_container.layout-lyrics .lyrics-output::-webkit-scrollbar,
.lyrics_container.layout-guide .lyrics-output::-webkit-scrollbar,
.lyrics_container.layout-chords .lyrics-output::-webkit-scrollbar {
    width: 8px;
}

.lyrics_container.layout-lyrics .lyrics-output::-webkit-scrollbar-thumb,
.lyrics_container.layout-guide .lyrics-output::-webkit-scrollbar-thumb,
.lyrics_container.layout-chords .lyrics-output::-webkit-scrollbar-thumb {
    background: rgba(31, 31, 31, 0.25);
    border-radius: 999px;
}


.guide-panel {
    display: none;
    flex: 0 0 auto;
    min-width: 240px;
    max-width: 65%;
    padding: 12px;
    padding-bottom: 28px;
    border-radius: 16px;
    background: linear-gradient(135deg, rgba(94, 96, 206, 0.18), rgba(100, 223, 223, 0.24));
    border: 1px solid rgba(94, 96, 206, 0.28);
    background-clip: padding-box;
    color: #1f1f1f;
    flex-direction: column;
    gap: 12px;
    overflow: auto;
    scroll-padding-bottom: 28px;
    resize: horizontal;
}

.guide-panel h3 {
    margin: 0;
    font-size: 18px;
}


.lyrics_container.layout-guide {
    min-height: 0;
}

.lyrics_container.layout-guide .guide-panel {
    display: flex;
    border-radius: 16px;
    flex: 0 0 auto;
    width: 30%;
    max-width: 65%;
    height: 100%;
    max-height: 100%;
}

.lyrics_container.layout-guide .lyrics-output {
    display: block;
    flex: 1 1 auto;
    max-width: none;
    min-height: 0;
}

.guitar-guide {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.guitar-guide-controls {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px;
    position: sticky;
    top: 0;
    z-index: 2;
    padding: 12px 0;
    margin: -12px 0 0;
    background: linear-gradient(to bottom, rgba(255, 255, 255, 0.95), rgba(255, 255, 255, 0.85));
    border-bottom: 1px solid rgba(0, 0, 0, 0.08);
}

.guide-quality-label {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
    color: rgba(0, 0, 0, 0.7);
}

.guide-quality-select {
    min-width: 120px;
    padding: 6px 12px;
    border-radius: 8px;
    border: 1px solid rgba(0, 0, 0, 0.2);
    background: rgba(255, 255, 255, 0.95);
    font-size: 14px;
    font-weight: 600;
    color: #1f1f1f;
}

.guide-filter-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.guide-filter-btn {
    padding: 6px 14px;
    border: 1px solid rgba(0, 0, 0, 0.15);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.9);
    color: #1f1f1f;
    font-weight: 600;
    cursor: pointer;
}

.guide-filter-btn:hover,
.guide-filter-btn:focus-visible {
    background: #1f4f99;
    color: #ffffff;
    transform: translateY(-1px);
    outline: none;
}

.guide-filter-btn.is-active {
    background: #1f4f99;
    color: #ffffff;
}

.guide-filter-btn.is-active:focus-visible {
}

.guide-no-result {
    margin: 0;
    font-size: 14px;
    color: rgba(0, 0, 0, 0.6);
}

.guide-placeholder {
    margin: 0;
    font-size: 14px;
    color: rgba(0, 0, 0, 0.54);
}

.guitar-guide-content {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.guitar-guide-display {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.guitar-guide-library {
    display: none;
}

.chord-group {
    display: flex;
    flex-direction: column;
    gap: 16px;
    padding-top: 16px;
    border-top: 1px solid rgba(0, 0, 0, 0.08);
    scroll-margin-top: 80px;
}

.chord-group:first-of-type {
    border-top: none;
    padding-top: 0;
}

.chord-card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 16px;
}

.chord-card {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 16px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.9);
    border: 1px solid rgba(0, 0, 0, 0.08);
}

.chord-card header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.chord-card h4 {
    margin: 0;
    font-size: 20px;
    color: #1a237e;
    flex: 1 1 auto;
}

.chord-card-media { 
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.chord-card-media figure {
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
    align-items: center;
}

.chord-card-media img {
    width: 160px;
    height: 200px;
    border-radius: 8px;
    border: 1px solid rgba(0, 0, 0, 0.12);
    background: #ffffff;
    object-fit: contain;
}

.chord-fingering-figure {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    margin: 0;
    padding: 14px;
    border-radius: 12px;
    border: 1px solid rgba(0, 0, 0, 0.12);
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.95), rgba(249, 249, 249, 0.95));
    max-width: 100%;
    flex: 1 1 280px;
}

.chord-fingering-image {
    width: auto;
    max-width: min(100%, 560px);
    height: auto;
    border-radius: 8px;
    border: 1px solid rgba(0, 0, 0, 0.1);
    background: #ffffff;
}

.chord-fingering-caption {
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: rgba(0, 0, 0, 0.55);
}

.chord-card-media figcaption {
    font-size: 12px;
    color: rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.chord-diagram-controls {
    display: flex;
    align-items: center;
    gap: 10px;
}

.chord-diagram-btn {
    flex: 0 0 auto;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 1px solid rgba(26, 35, 126, 0.35);
    background: rgba(26, 35, 126, 0.08);
    color: #1a237e;
    font-weight: 700;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease, transform 0.2s ease;
}

.chord-diagram-btn:hover,
.chord-diagram-btn:focus-visible {
    background: #1a237e;
    color: #ffffff;
    border-color: #1a237e;
    transform: translateY(-1px);
    outline: none;
}

.chord-diagram-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    transform: none;
}

.chord-diagram-indicator {
    flex: 0 0 auto;
    font-size: 13px;
    font-weight: 600;
    color: rgba(0, 0, 0, 0.6);
}

.chord-fingering {
    flex: 1 1 0;
    margin: 0;
    padding: 12px 16px;
    border-radius: 8px;
    background: rgba(0, 0, 0, 0.04);
    border: 1px solid rgba(0, 0, 0, 0.08);
    font-family: 'Courier New', Courier, monospace;
    font-size: 18px;
    line-height: 1.5;
    white-space: pre;
}

.chord-card header audio {
    flex: 0 0 auto;
    width: 160px;
    min-width: 120px;
}

.guitar-chord-detail {
    gap: 20px;
}

.guitar-chord-detail-header {
    align-items: flex-start;
    flex-wrap: wrap;
    gap: 18px;
}

.guitar-chord-detail-title {
    font-size: 22px;
    line-height: 1.3;
}


.guitar-chord-layout {
    display: flex;
    flex-wrap: nowrap;
    align-items: stretch;
    gap: 24px;
    padding: 24px;
    border-radius: 16px;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.98), rgba(243, 246, 255, 0.98));
    border: 1px solid rgba(26, 35, 126, 0.12);
}

.guitar-chord-diagram,
.guitar-chord-tablature {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.guitar-chord-diagram {
    flex: 1 1 0;
    align-items: center;
    justify-content: center;
}

.guitar-chord-tablature {
    flex: 0 0 auto;
    align-items: flex-start;
}

.guitar-chord-diagram figure {
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 10px;
    align-items: center;
    width: 100%;
    padding: 14px;
    border-radius: 12px;
    border: 1px solid rgba(0, 0, 0, 0.12);
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.95), rgba(249, 249, 249, 0.95));
}

.guitar-chord-diagram img {
    width: min(100%, 240px);
    height: auto;
    max-height: 320px;
    border-radius: 8px;
    border: 1px solid rgba(0, 0, 0, 0.12);
    background: #ffffff;
    object-fit: contain;
}

.guitar-chord-tablature .chord-fingering-figure {
    width: auto;
    align-items: flex-start;
    align-self: flex-start;
    max-width: 100%;
}

.guitar-chord-tablature .chord-fingering {
    width: auto;
    width: fit-content;
    max-width: 100%;
    box-sizing: border-box;
}

.guitar-chord-variants {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 12px;
}

.guitar-chord-variants .chord-diagram-controls {
    justify-content: center;
    gap: 12px;
}

@media (max-width: 1024px) {
    .guitar-chord-layout {
        flex-wrap: wrap;
    }

    .guitar-chord-diagram,
    .guitar-chord-tablature {
        flex: 1 1 100%;
    }
}

@media (max-width: 768px) {
    .guide-filter-buttons {
        gap: 6px;
    }

    .guide-filter-btn {
        padding: 6px 12px;
    }

    .chord-card-grid {
        grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    }

    .chord-card-media img {
        width: 140px;
        height: 180px;
    }

    .chord-card header {
        flex-direction: column;
        align-items: flex-start;
    }

    .chord-card header audio {
        width: 100%;
    }

    .guitar-chord-layout {
        flex-direction: column;
        padding: 20px;
    }

    .guitar-chord-detail-title {
        font-size: 20px;
    }
}

.chord-tip {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 16px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.95);
    border: 1px solid rgba(26, 35, 126, 0.12);
    width: 100%;
    box-sizing: border-box;
}

.chord-tip h5 {
    margin: 0;
    font-size: 14px;
    color: #1a237e;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.chord-tip-list {
    margin: 0;
    padding: 0;
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.chord-tip-list li {
    margin: 0;
    display: flex;
    gap: 8px;
    align-items: flex-start;
    color: rgba(0, 0, 0, 0.78);
    font-size: 13px;
    line-height: 1.6;
}

.chord-tip-list li::before {
    content: "➡️";
    flex: none;
    font-size: 12px;
    line-height: 1.4;
    margin-top: 2px;
}

.chord-tip-list li span {
    flex: 1;
}

.chord-tip-paragraph {
    margin: 0 0 10px;
    color: rgba(0, 0, 0, 0.78);
    font-size: 13px;
    line-height: 1.6;
}

.chord-tip-paragraph:last-child {
    margin-bottom: 0;
}

.chord-tip-diagram {
    margin: 0 0 12px;
    padding: 8px 10px;
    background: rgba(0, 0, 0, 0.04);
    border-radius: 8px;
    font-size: 13px;
    font-family: 'Courier New', Courier, monospace;
    line-height: 1.4;
    color: rgba(0, 0, 0, 0.75);
}

.chord-tip-diagram:last-child {
    margin-bottom: 0;
}


.guide-panel ul {
    margin: 0 0 8px;
    padding-left: 18px;
}

.guide-panel .chord-tip-list {
    padding-left: 0;
    margin: 0;
}

.guide-panel pre:not(.chord-tip-diagram) {
    margin: 0;
    padding: 8px 10px;
    background: rgba(0, 0, 0, 0.1);
    border-radius: 8px;
    font-size: 13px;
    font-family: 'Courier New', Courier, monospace;
    line-height: 1.4;
}

.guide-panel .chord-fingering {
    font-size: 18px;
    background: rgba(0, 0, 0, 0.04);
    border: 1px solid rgba(0, 0, 0, 0.08);
}

.guide-error {
    color: #b71c1c;
    font-weight: 600;
}

.tab-panel {
    display: none;
    width: 100%;
    height: 100%;
    margin: 0;
    padding: 16px;
    border-radius: 14px;
    background: rgba(255, 126, 95, 0.18);
    border: 1px solid rgba(255, 126, 95, 0.35);
    color: #1f1f1f;
    box-sizing: border-box;
    font-family: 'Courier New', Courier, monospace;
    font-size: 14px;
    overflow: hidden;
    line-height: 1.5;
    white-space: pre;
    --tab-font-size: 16px;
    --tab-line-height: 1.5;
    --tab-chord-gap: 6px;
    --tab-block-gap: 14px;
}

.tab-toolbar {
    display: none;
}

.tab-panel.show-controls .tab-toolbar {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
}

.tab-toolbar-line {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 10px;
    flex-wrap: wrap;
}

.tab-toolbar-controls {
    order: 1;
}

.tab-toolbar-actions {
    order: 2;
}

.tab-control {
    font-size: 12px;
    min-width: 32px;
    padding: 6px 8px;
}

.tab-toolbar-actions .tab-speed-label {
    margin-right: 4px;
}

.tab-control:disabled,
.tab-print-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.tab-control.active {
    background: rgba(33, 150, 243, 0.15);
}

.tab-speed-label {
    font-size: 13px;
    font-weight: 600;
    color: #1f1f1f;
}

.tab-speed-input {
    width: 72px;
    padding: 6px 8px;
    border-radius: 6px;
    border: 1px solid rgba(0, 0, 0, 0.25);
    background: rgba(255, 255, 255, 0.95);
    font-size: 13px;
    font-family: inherit;
    color: #1f1f1f;
}

.tab-speed-input:focus {
    outline: none;
    border-color: rgba(33, 150, 243, 0.7);
}

.tab-content {
    flex: 1 1 0%;
    margin: 0;
    min-height: 0;
    font-size: var(--tab-font-size, 16px);
    line-height: var(--tab-line-height, 1.5);
    overflow: auto;
}

.tab-block {
    margin-bottom: var(--tab-block-gap, 14px);
}

.tab-block.tab-line {
    margin-bottom: 0;
}

.tab-block.tab-line + .tab-block.tab-line {
    margin-top: 0;
}

.tab-spacer {
    height: var(--tab-block-gap, 14px);
}

.tab-header h2 {
    margin: 0;
    font-size: 28px; /* un peu plus gros */
    font-weight: 800; /* titre en gras */
    line-height: 1.1;
    text-transform: none; /* conserver la casse d'origine */
}
.tab-header h3 {
    margin: 6px 0 0;
    font-size: 18px; /* un peu plus gros que le corps mais moins que le titre */
    font-weight: 600;
    text-decoration: underline; /* auteur souligné */
    color: #333;
}
.tab-chords,
.tab-lyrics {
    margin: 0;
    padding: 0;
    font-family: inherit;
    white-space: pre-wrap;
    line-height: inherit;
}

.tab-chords {
    opacity: 0.8;
    margin-top: calc(var(--tab-line-height, 1.5) * 1em);
}

.tab-lyrics {
    margin-top: 0;
}

.tab-lyrics.tab-lyrics-only {
    margin-top: calc(var(--tab-line-height, 1.5) * 3);
}

.tab-content .tab-section-label {
    display: block;
    margin: 6px 0;
    padding: 6px 10px;
    border-radius: 999px;
    background: linear-gradient(135deg, #5e60ce, #64dfdf);
    border: 1px solid rgba(94, 96, 206, 0.55);
    color: #ffffff;
    font-weight: 700;
    letter-spacing: 0.5px;
    text-transform: none;
    text-align: center; /* centré */
}

.tab-empty {
    margin: 0;
    font-style: italic;
    opacity: 0.6;
}

.tab-chord-token {
    display: inline-block;
    cursor: pointer;
    color: #3d4f91;
    border-radius: 4px;
    transition: color 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
    text-decoration: none;
}

.tab-chord-token:hover,
.tab-chord-token:focus-visible {
    color: #1f2f6b;
    background: rgba(94, 96, 206, 0.18);
}

.tab-chord-token:focus-visible {
    outline: none;
    box-shadow: 0 0 0 2px rgba(94, 96, 206, 0.35);
}

.tab-chord-popover {
    position: absolute;
    min-width: 280px;
    max-width: 360px;
    background: #ffffff;
    color: #1f1f1f;
    border-radius: 12px;
    box-shadow: 0 12px 36px rgba(0, 0, 0, 0.18);
    padding: 14px 16px;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transform: translateY(0);
    transition: opacity 0.15s ease, visibility 0.15s ease, transform 0.15s ease;
    z-index: 1200;
}

.tab-chord-popover--above {
    transform: translateY(-4px);
}

.tab-chord-popover--below {
    transform: translateY(4px);
}

.tab-chord-popover--left {
    transform: translateX(-4px);
}

.tab-chord-popover--right {
    transform: translateX(4px);
}

.tab-chord-popover--active {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

.tab-chord-popover__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 10px;
    font-weight: 700;
    color: inherit;
}

.tab-chord-popover__title {
    font-size: 1rem;
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.tab-chord-popover__close {
    border: none;
    background: rgba(94, 96, 206, 0.12);
    color: inherit;
    border-radius: 999px;
    width: 26px;
    height: 26px;
    font-size: 1rem;
    line-height: 1;
    cursor: pointer;
    transition: background 0.2s ease;
}

.tab-chord-popover__close:hover,
.tab-chord-popover__close:focus-visible {
    background: rgba(94, 96, 206, 0.24);
    outline: none;
}

.tab-chord-popover__body {
    display: flex;
    flex-direction: column;
    gap: 12px;
    max-height: 360px;
}

.tab-chord-popover__status {
    font-size: 0.9rem;
    color: rgba(0, 0, 0, 0.65);
}

.tab-chord-popover__status.is-hidden {
    display: none;
}

.tab-chord-popover__image {
    display: flex;
    align-items: center;
    justify-content: center;
    max-height: 260px;
    overflow: hidden;
}

.tab-chord-popover__image-src {
    max-width: 100%;
    max-height: 260px;
    border-radius: 10px;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.15);
}

.tab-chord-popover__image-src.is-hidden {
    display: none;
}

/* Dark theme refinements for tab area */
.theme-sombre .tab-chord-popover__image-src {
    box-shadow: 0 10px 28px rgba(7, 10, 30, 0.45);
}

.lyrics-lines {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.lyrics-line {
    display: block;
    white-space: pre-wrap;
    line-height: 1.5;
    padding-left: 2.2rem;
}

.lyric-word-block {
    position: relative;
    display: inline-block;
    vertical-align: bottom;
    text-align: center;
    padding-top: 2.4rem;
}

.lyric-word-block::before {
    content: "";
    position: absolute;
    top: 1.92rem;
    left: var(--chord-left, 50%);
    transform: translateX(-50%);
    width: 0;
    height: 0.45rem;
    border-left: 2px solid rgba(30, 30, 30, 0.45);
    pointer-events: none;
    z-index: 0;
}

.lyric-word-block + .lyric-word-block {
    margin-left: 3.8rem;
}

.lyric-word-block .chord-pill {
    position: absolute;
    top: 0;
    left: var(--chord-left, 50%);
    transform: translateX(-50%);
    margin: 0;
    cursor: grab;
    touch-action: pan-y;
    user-select: none;
    z-index: 1;
}

.lyric-word-block .chord-pill.chord-pill--dragging,
.lyric-word-block .chord-pill.chord-pill--dragging:active {
    cursor: grabbing;
}

.lyric-word {
    display: inline-block;
    text-align: center;
}

.lyrics-blank-line {
    display: block;
    height: 0.4rem;
}

.lyric-cell {
    font-weight: bold;
    line-height: 1.2;
    white-space: pre-wrap;
    color: #333;
}

.lyric-cell--interactive {
    cursor: pointer;
}

.definition-tooltip {
    position: absolute;
    min-width: 240px;
    max-width: 360px;
    background: rgba(30, 30, 30, 0.95);
    color: #fff;
    padding: 12px 14px;
    border-radius: 8px;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.15s ease, visibility 0.15s ease;
    z-index: 1000;
}

.definition-tooltip--active {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

.definition-tooltip__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 8px;
}

.definition-tooltip__word,
.definition-tooltip__title {
    font-weight: 700;
    font-size: 1rem;
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.definition-tooltip__languages {
    display: flex;
    gap: 4px;
    align-items: center;
}

.definition-tooltip__reload {
    border: none;
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 0.85rem;
    line-height: 1;
    transition: background 0.2s ease, transform 0.2s ease;
}

.definition-tooltip__reload:hover,
.definition-tooltip__reload:focus-visible {
    background: rgba(255, 255, 255, 0.25);
    transform: rotate(-20deg);
    outline: none;
}

.definition-tooltip__lang-btn {
    border: none;
    background: rgba(255, 255, 255, 0.12);
    color: #fff;
    border-radius: 4px;
    padding: 2px 6px;
    cursor: pointer;
    font-size: 0.85rem;
    line-height: 1.2;
    opacity: 0.75;
    transition: background 0.2s ease, opacity 0.2s ease;
}

.definition-tooltip__lang-btn:hover {
    background: rgba(255, 255, 255, 0.24);
    opacity: 1;
}

.definition-tooltip__lang-btn.is-active {
    background: rgba(255, 255, 255, 0.35);
    opacity: 1;
}

.definition-tooltip__body {
    display: flex;
    flex-direction: column;
    gap: 10px;
    font-size: 0.9rem;
    max-height: 320px;
    overflow-y: auto;
    overscroll-behavior: contain;
}

.definition-tooltip__section-title {
    font-weight: 600;
    margin-bottom: 4px;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: rgba(255, 255, 255, 0.85);
}

.definition-tooltip__list {
    padding-left: 18px;
    margin: 0;
}

.definition-tooltip__list li {
    margin-bottom: 4px;
}

.definition-tooltip__synonym-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 4px;
}

.definition-tooltip__synonym-btn {
    border: 1px solid rgba(255, 255, 255, 0.35);
    background: rgba(255, 255, 255, 0.08);
    color: #fff;
    border-radius: 999px;
    padding: 4px 10px;
    font-size: 0.85rem;
    cursor: pointer;
    transition: background 0.2s ease, border-color 0.2s ease;
}

.definition-tooltip__synonym-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.55);
}

.definition-tooltip__empty {
    font-style: italic;
    opacity: 0.75;
}

.definition-tooltip__loading {
    font-style: italic;
    opacity: 0.8;
}

.definition-tooltip__error {
    color: #ffd5d5;
    font-weight: 600;
}

.lyrics-blank-cell {
    height: 0.4rem;
    line-height: 0.4rem;
}

.section-label {
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 1px;
    padding: 8px 12px;
    text-align: left;
    background: linear-gradient(135deg, #5e60ce, #64dfdf);
    color: #ffffff;
    border-radius: 999px;
    border: 1px solid rgba(94, 96, 206, 0.55);
}

.chord-cell {
    text-align: left;
    padding: 6px 4px;
    vertical-align: middle;
}

.chord-pill {
    border: 1px solid #c31919;
    background: rgba(195, 25, 25, 0.08);
    color: #c31919;
    border-radius: 999px;
    padding: 4px 10px;
    min-height: 28px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

.chord-pill:hover,
.chord-pill:focus-visible {
    background: rgba(195, 25, 25, 0.2);
    color: #9f1212;
    outline: none;
    box-shadow: 0 0 0 2px rgba(195, 25, 25, 0.18);
}

.chord-pill--empty {
    background: rgba(30, 30, 30, 0.04);
    border: 1px dashed rgba(30, 30, 30, 0.35);
    color: rgba(30, 30, 30, 0.65);
}

.chord-pill--empty:hover,
.chord-pill--empty:focus-visible {
    border-style: solid;
    border-color: #c31919;
    color: #c31919;
}

.chord-popover {
    position: absolute;
    width: min(680px, calc(100vw - 24px));
    min-width: 360px;
    background: #ffffff;
    color: #1d1d1d;
    padding: 12px;
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.15s ease, visibility 0.15s ease, transform 0.15s ease;
    transform: translateY(-4px);
    z-index: 1000;
}

.chord-popover--below {
    transform: translateY(4px);
}

.chord-popover--active {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transform: translateY(0);
}

.chord-popover__header {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 8px;
    font-weight: 600;
    font-size: 0.95rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.chord-popover__categories {
    display: flex;
    flex-wrap: nowrap;
    gap: 8px;
    margin-bottom: 12px;
    position: sticky;
    top: 0;
    background: inherit;
    padding: 6px 0;
    z-index: 1;
    overflow: hidden;
}

.chord-popover__category {
    border: 1px solid #1d4ed8;
    background: #2563eb;
    color: #fff;
    border-radius: 999px;
    padding: 5px 12px;
    font-weight: 600;
    font-size: 0.85rem;
    cursor: pointer;
    transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease, transform 0.2s ease;
    min-height: 32px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 1.2;
    text-align: center;
    flex-shrink: 0;
    white-space: nowrap;
}

.chord-popover__category:hover,
.chord-popover__category:focus-visible {
    outline: none;
    background: #1d4ed8;
    border-color: #1e40af;
}

.chord-popover__category.is-active {
    background: #1e3a8a;
    border-color: #1e3a8a;
    color: #f8fafc;
}

.chord-popover__groups {
    display: flex;
    flex-direction: column;
    gap: 16px;
    max-height: 320px;
    overflow-y: auto;
    padding-right: 4px;
}

.chord-popover__group-title {
    font-size: 0.85rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: rgba(29, 45, 83, 0.85);
    margin-bottom: 4px;
}

.chord-popover__group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.chord-popover__group-body {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.chord-popover__subgroup {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.chord-popover__subgroup-title {
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: rgba(29, 45, 83, 0.65);
}

.chord-popover__options {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.chord-popover__option,
.chord-popover__clear {
    border: 1px solid #b91c1c;
    background: rgba(220, 38, 38, 0.12);
    color: #b91c1c;
    border-radius: 999px;
    padding: 6px 12px;
    font-weight: 600;
    font-size: 0.88rem;
    cursor: pointer;
    transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease, transform 0.2s ease;
    min-height: 34px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    line-height: 1.2;
    word-break: normal;
    flex-shrink: 0;
    white-space: nowrap;
}

.chord-popover__option:hover,
.chord-popover__option:focus-visible,
.chord-popover__clear:hover,
.chord-popover__clear:focus-visible {
    background: rgba(220, 38, 38, 0.24);
    border-color: #b91c1c;
    outline: none;
}

.chord-popover__option.is-active,
.chord-popover__clear.is-active {
    background: #b91c1c;
    color: #fff;
    border-color: #b91c1c;
}

.theme-sombre .chord-popover {
    background: rgba(35, 35, 35, 0.98);
    color: #f5f5f5;
    box-shadow: 0 8px 28px rgba(0, 0, 0, 0.35);
}

.theme-sombre .chord-popover__header {
    color: inherit;
}

.theme-sombre .chord-popover__categories {
    background: transparent;
}

.theme-sombre .chord-popover__category {
    border-color: rgba(120, 162, 255, 0.45);
    background: rgba(59, 130, 246, 0.25);
    color: #f5f5f5;
}

.theme-sombre .chord-popover__category:hover,
.theme-sombre .chord-popover__category:focus-visible,
.theme-sombre .chord-popover__category.is-active {
    background: rgba(59, 130, 246, 0.45);
    border-color: rgba(120, 162, 255, 0.7);
}

.theme-sombre .chord-popover__group-title {
    color: rgba(245, 245, 245, 0.7);
}

.theme-sombre .chord-popover__subgroup-title {
    color: rgba(245, 245, 245, 0.6);
}

.theme-sombre .chord-popover__option,
.theme-sombre .chord-popover__clear {
    border-color: rgba(255, 255, 255, 0.35);
    background: rgba(255, 255, 255, 0.12);
    color: #f5f5f5;
}

.theme-sombre .chord-popover__option:hover,
.theme-sombre .chord-popover__option:focus-visible,
.theme-sombre .chord-popover__clear:hover,
.theme-sombre .chord-popover__clear:focus-visible {
    background: rgba(255, 255, 255, 0.24);
    border-color: rgba(255, 255, 255, 0.45);
}

.theme-sombre .chord-popover__option.is-active,
.theme-sombre .chord-popover__clear.is-active {
    background: #fff;
    color: #1d1d1d;
    border-color: #fff;
}

@media (max-width: 1024px) {
    .topbar {
        flex-wrap: wrap;
        align-items: flex-start;
        gap: 18px;
        padding: 16px 24px;
    }

    .topbar-left {
        width: 100%;
        justify-content: center;
    }

    .topbar-center {
        width: 100%;
    }

    .topbar-actions {
        width: 100%;
        justify-content: space-between;
        flex-wrap: wrap;
    }

    .topbar-actions-buttons {
        flex: 1 1 auto;
        flex-wrap: wrap;
        justify-content: center;
    }

    .topbar-selectors {
        width: 100%;
    }

    .topbar-meta {
        width: 100%;
        align-items: stretch;
        gap: 18px;
    }

    .topbar-right {
        width: 100%;
        flex-direction: row;
        flex-wrap: wrap;
        justify-content: flex-end;
        gap: 16px;
        margin-left: 0;
    }

    .topbar-account {
        width: 100%;
        max-width: 360px;
    }

    .header {
        flex-direction: column;
        align-items: stretch;
        gap: 20px;
    }

    .assistant-story-card-body {
        flex-direction: column;
    }

    .assistant-story-text,
    .assistant-story-lexical {
        min-width: 0;
        width: 100%;
    }

    .writing-section-row {
        flex-direction: column;
    }

    .writing-lyrics-wrapper,
    .writing-story-wrapper {
        min-width: 0;
        width: 100%;
    }

    .header-top {
        gap: 16px;
    }

    .header-top-controls {
        width: 100%;
        justify-content: center;
    }

    .header-top-controls .header-quick-controls {
        justify-content: center;
    }

    .header-top-controls .header-rhythm {
        margin-left: 0;
        justify-content: center;
    }

    .header-bottom {
        flex-direction: column;
        align-items: stretch;
    }

    .header-rhythm {
        margin-left: 0;
        justify-content: center;
    }

    .header-left,
    .header-center,
    .header-right {
        width: 100%;
    }

    .header-center {
        order: 2;
    }

    .header-right {
        justify-content: center;
    }

    .header-right-blocks {
        flex-direction: column;
        align-items: stretch;
        gap: 18px;
    }

    .control-stack {
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
    }

    .control-panel {
        width: 100%;
    }

    .instrument-stack {
        align-items: stretch;
    }

    .instrument-toggle {
        flex-direction: row;
        justify-content: center;
        gap: 12px;
    }

    .instrument-btn {
        flex: 1 1 auto;
        min-width: 0;
    }

    .layout-toggle {
        width: 100%;
    }

    .lyrics_container {
        gap: 16px;
    }

    .rhythm-panel {
        gap: 16px;
    }

    .rhythm-saved {
        border-right: none;
        border-bottom: 1px solid rgba(0, 0, 0, 0.1);
        padding-right: 0;
        padding-bottom: 16px;
    }

    .rhythm-generator {
        padding-left: 0;
    }

}

@media (max-width: 768px) {
    .account-settings {
        flex-direction: column;
        padding: 0 16px 32px;
        gap: 20px;
    }

    .account-settings-sidebar {
        background: rgba(255, 255, 255, 0.9);
        border-radius: 16px;
        position: static;
        flex-direction: row;
        flex-wrap: wrap;
        gap: 10px;
        padding: 16px;
    }

    .account-settings-group-label {
        width: 100%;
        text-align: center;
    }

    .account-settings-nav,
    .account-settings-nav--admin {
        flex-direction: row;
        flex-wrap: wrap;
        flex: 1 1 100%;
    }

    .account-settings-nav-button {
        flex: 1 1 140px;
        justify-content: center;
    }

    .account-settings-separator {
        width: 100%;
    }

    .account-details-row {
        grid-template-columns: 1fr;
    }

    .topbar {
        padding: 14px 20px;
        gap: 16px;
    }

    .topbar-left {
        justify-content: center;
    }

    .topbar-actions {
        position: relative;
        flex-direction: row;
        align-items: center;
    }

    .topbar-actions-buttons {
        position: absolute;
        top: calc(100% + 8px);
        right: 0;
        min-width: 220px;
        display: none;
        flex-direction: column;
        align-items: stretch;
        gap: 8px;
        padding: 12px;
        border-radius: 16px;
        border: 1px solid var(--theme-border-soft);
        background: var(--theme-surface-2);
        box-shadow: var(--theme-shadow, none);
        z-index: 20;
    }

    .topbar-actions.is-open .topbar-actions-buttons {
        display: flex;
    }

    .topbar-actions .export-buttons {
        flex-direction: column;
        width: 100%;
    }

    .topbar-actions-buttons .icon-btn,
    .topbar-actions-buttons .export-btn {
        width: 100%;
        justify-content: center;
    }

    .topbar-actions-toggle {
        display: inline-flex;
        order: 2;
    }

    .topbar-selectors {
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
    }

    .sidebar-rail-toggle {
        width: 100%;
        justify-content: center;
    }

    .topbar-meta {
        flex-direction: column;
        align-items: stretch;
        gap: 16px;
    }

    .topbar-right {
        align-items: stretch;
    }

    .topbar-account {
        width: 100%;
    }

    .header {
        gap: 1px;
    }

    .header-top-controls {
        width: 100%;
        justify-content: center;
    }

    .header-top-controls .header-quick-controls {
        justify-content: center;
    }

    .header-bottom {
        align-items: stretch;
        gap: 18px;
    }

    .header-rhythm {
        margin-left: 0;
        justify-content: center;
        width: 100%;
    }

    .assistant-story-card-body {
        flex-direction: column;
    }

    .assistant-story-text,
    .assistant-story-lexical {
        min-width: 0;
        width: 100%;
    }

    .title-author {
        width: 100%;
        max-width: none;
    }

    .title-input {
        font-size: 22px;
    }

    .header-center {
        order: 1;
    }

    .rhythm-primary-display {
        justify-content: center;
        text-align: center;
    }

    .layout-toggle {
        justify-content: center;
        width: 100%;
    }

    .layout-btn {
        flex: 1 1 48px;
    }

    .header-right-blocks {
        gap: 14px;
    }

    .instrument-stack {
        align-items: stretch;
    }

    .instrument-toggle {
        flex-direction: row;
        gap: 12px;
    }

    .instrument-btn {
        flex: 1 1 48px;
        min-width: 0;
        flex-direction: row;
        gap: 8px;
    }

    .instrument-icon {
        font-size: 18px;
    }

    .instrument-label {
        font-size: 12px;
    }

    .control-stack {
        align-items: stretch;
    }

    .control-panel {
        width: 100%;
    }

    .lyrics_container {
        flex-direction: column;
    }

    .rhythm-panel {
        flex-direction: column;
    }

    .rhythm-random-list {
        grid-template-columns: 1fr;
    }

    .rhythm-legend ul {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        padding-left: 0;
    }

    .rhythm-legend li {
        font-size: 13px;
    }

    .guide-panel {
        order: 3;
    }

    .lyrics-output,
    #tab-panel,
    #guide-panel,
    #lyrics-input {
        width: 100%;
    }

    .lyrics_container.layout-lyrics #lyrics-input {
        flex: 1 1 100%;
        max-width: 100%;
    }

    .tab-toolbar {
        flex-wrap: wrap;
    }

    .sidebar {
        padding: 12px;
    }
}

@media (max-width: 520px) {
    body {
        background: linear-gradient(to bottom, #ff7e5f, #feb47b);
    }

    .app-brand {
        padding: 6px 12px;
        flex-direction: column;
        align-items: center;
        gap: 2px;
    }

    .app-brand-name {
        font-size: 26px;
    }

    .app-brand-version {
        font-size: 16px;
    }

    .header {
        padding: 12px 16px;
    }

    .song-close-btn {
        font-size: 16px;
    }

    .song-list {
        max-height: 260px;
    }

    .topbar .icon-btn,
    .export-btn {
        font-size: 16px;
    }

    .toggle-sidebar-text {
        display: none;
    }

    .rhythm-legend ul {
        grid-template-columns: 1fr;
        gap: 8px;
    }

    .header-right-blocks {
        gap: 12px;
    }

    .instrument-toggle {
        flex-direction: column;
    }

    .instrument-btn {
        width: 100%;
    }
}

.admin-users-toolbar {
    margin-bottom: 12px;
}
