/* /public/assets/css/dashboard.css */

:root {
    --bg: #f5f7fb;
    --surface: #ffffff;
    --surface-muted: #f8fafc;
    --text: #172033;
    --muted: #718096;
    --line: #e5eaf2;
    --accent: #5b5ce2;
    --accent-hover: #4748c8;
    --success: #16804d;
    --success-bg: #eaf8f0;
    --danger: #b42318;
    --danger-bg: #fff0ef;
    --sidebar-width: 260px;
    --navigator-width: 300px;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-width: 320px;
    background: var(--bg);
    color: var(--text);
    font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}.auth-page {
    min-height: 100vh;
    background: #f5f7fb;
    color: #172033;
}

.auth-backdrop {
    display: flex;
    min-height: 100vh;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: rgba(23, 32, 51, 0.48);
}

.auth-modal {
    position: relative;
    width: min(100%, 400px);
    padding: 34px 32px 30px;
    border: 1px solid #e5eaf2;
    border-radius: 17px;
    background: #ffffff;
    box-shadow: 0 24px 70px rgba(23, 32, 51, 0.2);
}

.auth-modal h1 {
    margin: 0 0 2px;
    color: #172033;
    font-size: 24px;
    line-height: 1.2;
    letter-spacing: -0.5px;
}

.auth-subtitle {
    margin: 0 0 24px;
    color: #718096;
    font-size: 15px;
}

.auth-close {
    position: absolute;
    top: 14px;
    right: 19px;
    color: #718096;
    font-size: 31px;
    font-weight: 300;
    line-height: 1;
    text-decoration: none;
}

.auth-close:hover {
    color: #172033;
}

.auth-tabs {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 9px;
    margin-bottom: 16px;
}

.auth-tab-input {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
    pointer-events: none;
}

.auth-tab-label {
    padding: 9px;
    border: 1px solid #e5eaf2;
    border-radius: 8px;
    color: #718096;
    font-size: 13px;
    text-align: center;
    cursor: pointer;
}

.auth-tab-input:checked + .auth-tab-label {
    border-color: #5b5ce2;
    color: #5b5ce2;
    font-weight: 700;
}

.auth-tab-input:focus-visible + .auth-tab-label {
    outline: 2px solid #5b5ce2;
    outline-offset: 2px;
}

.auth-tab-input:checked ~ #auth-login-identifier {
    /* Поле входа общее: сервер определяет телефон или email по введённому значению. */
}

.auth-modal .form-field {
    margin-bottom: 16px;
}

.auth-modal input:not([type="checkbox"]) {
    height: 43px;
    padding: 10px 13px;
    border-color: #d8e0eb;
    border-radius: 8px;
    background: #ffffff;
    color: #172033;
}

.auth-modal input:not([type="checkbox"])::placeholder {
    color: #718096;
}

.auth-modal input:not([type="checkbox"]):focus {
    border-color: #5b5ce2;
    box-shadow: 0 0 0 3px rgba(91, 92, 226, 0.12);
}

.auth-modal .form-field > label:has(input[type="checkbox"]) {
    display: flex;
    align-items: flex-start;
    gap: 9px;
    color: #4b5a70;
    font-size: 13px;
    line-height: 1.45;
}

.auth-modal input[type="checkbox"] {
    width: 18px;
    height: 18px;
    flex: 0 0 18px;
    margin: 1px 0 0;
    padding: 0;
    accent-color: #5b5ce2;
    cursor: pointer;
}

.auth-modal .form-field > label:has(input[type="checkbox"]) a {
    color: inherit;
    text-decoration: underline;
    text-underline-offset: 2px;
}

.auth-submit {
    width: 100%;
    padding: 13px 16px;
    border: 0;
    border-radius: 8px;
    background: #5b5ce2;
    box-shadow: 0 8px 18px rgba(91, 92, 226, 0.22);
    color: #ffffff;
    font: inherit;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
}

.auth-submit:hover {
    background: #4748c8;
}

.auth-switch {
    margin: 22px 0 0;
    color: #718096;
    font-size: 13px;
    font-weight: 600;
    text-align: center;
}

.auth-switch a,
.auth-link-button {
    color: #5b5ce2;
    font-weight: 800;
    text-decoration: none;
}

.auth-errors,
.auth-message {
    margin: 0 0 16px;
    padding: 10px 12px;
    border-radius: 8px;
    background: #fff0ef;
    color: #b42318;
    font-size: 13px;
    line-height: 1.4;
}

.auth-message {
    background: #efefff;
    color: #4748c8;
}

.auth-errors p {
    margin: 0;
}

.auth-errors p + p {
    margin-top: 5px;
}

.auth-resend-form {
    margin-top: 17px;
    text-align: center;
}

.auth-link-button {
    padding: 0;
    border: 0;
    background: transparent;
    font: inherit;
    font-size: 13px;
    cursor: pointer;
}

@media (max-width: 480px) {
    .auth-backdrop {
        padding: 16px;
    }

    .auth-modal {
        padding: 31px 24px 26px;
    }
}

a {
    color: inherit;
}

.app {
    display: grid;
    min-height: 100vh;
    grid-template-columns: var(--sidebar-width) minmax(0, 1fr) var(--navigator-width);
}.sidebar:not(.sidebar-right) {
    grid-column: 1 / 2;
    grid-row: 1;
}

.workspace {
    grid-column: 2 / 3;
    grid-row: 1;
}

.sidebar-right {
    grid-column: 3 / 4;
    grid-row: 1;
}

.sidebar {
    padding: 24px 16px;
    border-right: 1px solid var(--line);
    background: var(--surface);
}

.sidebar-right {
    display: block;
    min-width: 0;
    min-height: 100vh;
    border-right: 0;
    border-left: 1px solid var(--line);
    background: var(--surface);
    color: var(--text);
    opacity: 1;
    visibility: visible;
}

.brand {
    display: block;
    margin: 0 10px 34px;
    color: var(--text);
    font-size: 24px;
    font-weight: 800;
    letter-spacing: -0.7px;
    text-decoration: none;
}

.brand span {
    color: var(--accent);
}.brand-logo {
    display: block;
    width: auto;
    max-width: 100%;
    height: 30px;
}

.menu-title {
    margin: 0 10px 10px;
    color: var(--muted);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

.menu {
    display: grid;
    gap: 4px;
    margin-bottom: 28px;
}

.menu a {
    padding: 11px 12px;
    border-radius: 10px;
    color: #4b5a70;
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
}

.menu a.active,
.menu a:hover {
    background: #efefff;
    color: var(--accent);
}

.workspace {
    display: flex;
    min-width: 0;
    height: 100dvh;
    flex-direction: column;
    padding: 32px;
}

.page-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 24px;
    margin-bottom: 28px;
}

.page-header-main {
    min-width: 0;
    flex: 1 1 auto;
}

.page-header-subtitle-row {
    display: flex;
    min-width: 0;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
}

.page-header-subtitle-row .subtitle {
    flex: 0 1 auto;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}.project-publication-form {
    display: flex;
    align-items: center;
    margin: 0;
}.project-publication-settings-form {
    display: grid;
    width: 100%;
    grid-template-columns: minmax(0, 1fr);
    align-items: stretch;
    gap: 14px;
    margin: 0;
}

.project-publication-settings-form .form-field {
    width: 100%;
    margin: 0;
}

.project-publication-settings-form .project-publication-toggle {
    justify-self: start;
}

.project-publication-settings-form .button {
    justify-self: start;
}.project-settings-content .project-publication-settings-form {
    display: grid;
    width: 100%;
    grid-template-columns: minmax(0, 1fr);
    align-items: stretch;
}

.project-settings-content .project-publication-settings-form > .form-field,
.project-settings-content .project-publication-settings-form > .button {
    grid-column: 1 / -1;
}

.project-publication-toggle {
    display: inline-flex;
    min-height: 42px;
    align-items: center;
    gap: 9px;
    padding: 6px 11px 6px 7px;
    border: 1px solid color-mix(in srgb, var(--accent) 26%, var(--line));
    border-radius: 12px;
    background:
        linear-gradient(
            135deg,
            color-mix(in srgb, var(--accent) 10%, var(--surface)),
            var(--surface)
        );
    color: var(--text);
    cursor: pointer;
    transition: border-color 0.18s ease, background-color 0.18s ease, box-shadow 0.18s ease;
}

.project-publication-toggle:hover {
    border-color: color-mix(in srgb, var(--accent) 58%, var(--line));
    box-shadow: 0 7px 18px color-mix(in srgb, var(--accent) 12%, transparent);
}

.project-publication-toggle > input {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
    pointer-events: none;
}

.project-publication-toggle-visual {
    position: relative;
    display: inline-flex;
    width: 38px;
    height: 22px;
    flex: 0 0 38px;
    align-items: center;
    padding: 3px;
    border: 1px solid var(--line);
    border-radius: 99px;
    background: var(--surface-muted);
    transition: background-color 0.18s ease, border-color 0.18s ease;
}

.project-publication-toggle-visual::after {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: var(--muted);
    box-shadow: 0 2px 5px rgba(23, 32, 51, 0.2);
    content: "";
    transition: background-color 0.18s ease, transform 0.18s ease;
}

.project-publication-toggle > input:checked + .project-publication-toggle-visual {
    border-color: var(--accent);
    background: var(--accent);
}

.project-publication-toggle > input:checked + .project-publication-toggle-visual::after {
    background: #ffffff;
    transform: translateX(16px);
}

.project-publication-toggle > input:focus-visible + .project-publication-toggle-visual {
    outline: 3px solid color-mix(in srgb, var(--accent) 28%, transparent);
    outline-offset: 3px;
}

.project-publication-toggle-content {
    display: grid;
    gap: 1px;
    min-width: 0;
}

.project-publication-toggle-content strong {
    color: var(--text);
    font-size: 12px;
    font-weight: 800;
    line-height: 1.2;
}

.project-publication-toggle-content small {
    color: var(--muted);
    font-size: 10px;
    line-height: 1.2;
}

.project-publication-toggle-settings {
    width: fit-content;
    min-width: min(100%, 260px);
    padding: 10px 13px 10px 9px;
}

.project-publication-toggle-settings .project-publication-toggle-content strong {
    font-size: 13px;
}

.project-publication-toggle-settings .project-publication-toggle-content small {
    font-size: 11px;
}

.ai-model-switch {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 8px 6px 11px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: var(--surface);
}

.ai-model-switch label {
    color: var(--muted);
    font-size: 12px;
    white-space: nowrap;
}

.ai-model-switch select {
    width: auto;
    min-width: 96px;
    padding: 6px 28px 6px 8px;
    font-size: 13px;
}

.ai-model-switch .button {
    padding: 7px 10px;
    font-size: 13px;
}

.theme-toggle {
    padding: 9px 12px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: var(--surface);
    color: var(--text);
    font: inherit;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    white-space: nowrap;
}

.theme-toggle:hover {
    background: var(--surface-muted);
}

html[data-theme="dark"] {
    color-scheme: dark;
    --bg: #101827;
    --surface: #182235;
    --surface-muted: #202d42;
    --text: #edf2f7;
    --muted: #a9b7ca;
    --line: #324158;
    --accent: #8b8df7;
    --accent-hover: #a5a7ff;
    --success: #68d391;
    --success-bg: #153d2c;
    --danger: #feb2b2;
    --danger-bg: #4a2024;
}html[data-theme="kraft"] {
    color-scheme: light;
    --bg: #e9dfca;
    --surface: #f8f1e3;
    --surface-muted: #efe3cc;
    --text: #403326;
    --muted: #7d6b58;
    --line: #d4c2a5;
    --accent: #916b3d;
    --accent-hover: #73522e;
    --success: #3f7655;
    --success-bg: #e0eddb;
    --danger: #a34735;
    --danger-bg: #f5dfd6;
}

html[data-theme="kraft"] .menu a,
html[data-theme="kraft"] .tree-item,
html[data-theme="kraft"] .tree-part,
html[data-theme="kraft"] label,
html[data-theme="kraft"] .book-illustration-style-picker legend {
    color: #675543;
}

html[data-theme="kraft"] .menu a.active,
html[data-theme="kraft"] .menu a:hover,
html[data-theme="kraft"] .button-secondary:hover,
html[data-theme="kraft"] .generator-recommended-action:hover,
html[data-theme="kraft"] .navigator-action-link:hover,
html[data-theme="kraft"] .sidebar-right .tree-chapter > .navigator-action-note + form .button:hover {
    background: #e7d5b8;
    color: var(--accent);
}

html[data-theme="kraft"] .project.selected,
html[data-theme="kraft"] .generator-tree-detail.is-generation-active {
    background: #f4e8d4;
}

html[data-theme="kraft"] .project:hover {
    border-color: #b99768;
    box-shadow: 0 8px 20px rgba(64, 51, 38, 0.12);
}

html[data-theme="kraft"] .status {
    background: #e6dac4;
    color: #6b5945;
}

html[data-theme="kraft"] .generation-task-panel.is-pending,
html[data-theme="kraft"] .generator-tree-chapter.is-pending,
html[data-theme="kraft"] .generator-tree-detail.is-generation-active {
    border-color: #c5a679;
    box-shadow: 0 0 0 3px rgba(145, 107, 61, 0.1);
}

html[data-theme="kraft"] .generation-task-panel.is-pending .generation-task-status,
html[data-theme="kraft"] .generator-tree-detail.is-generation-active .status {
    background: #ead8b9;
    color: var(--accent);
}

html[data-theme="kraft"] .generator-recommended-action,
html[data-theme="kraft"] .navigator-action-link,
html[data-theme="kraft"] .sidebar-right .tree-chapter > .navigator-action-note + form .button {
    border-color: #c5a679;
    background: #f4e8d4;
    color: var(--accent);
}

html[data-theme="kraft"] .book-illustration-progress {
    background: #dfcfb5;
}

html[data-theme="kraft"] .page-loader {
    background: rgba(233, 223, 202, 0.78);
}

html[data-theme="dark"] .menu a,
html[data-theme="dark"] .tree-item,
html[data-theme="dark"] .tree-part {
    color: #c2cede;
}

html[data-theme="dark"] .menu a.active,
html[data-theme="dark"] .menu a:hover,
html[data-theme="dark"] .navigator-action-link {
    background: #25265a;
    color: #b7b9ff;
}

html[data-theme="dark"] .project.selected,
html[data-theme="dark"] .navigator-action-link:hover {
    background: #24294b;
}

html[data-theme="dark"] .project:hover {
    border-color: #6668d8;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.28);
}

html[data-theme="dark"] input,
html[data-theme="dark"] textarea,
html[data-theme="dark"] select {
    border-color: var(--line);
    background: var(--surface-muted);
    color: var(--text);
}

html[data-theme="dark"] .status {
    background: #2b3a51;
    color: #c7d2e2;
}

html[data-theme="dark"] .navigator-next-step,
html[data-theme="dark"] .profile-note {
    background: var(--surface-muted);
    color: #c2cede;
}html[data-theme="dark"] .sidebar-right {
    background: var(--surface);
}

html[data-theme="dark"] .navigator-task.is-pending {
    border-color: #5559ba;
    background: var(--surface-muted);
}

html[data-theme="dark"] .navigator-task.is-success {
    border-color: #367b59;
}

html[data-theme="dark"] .navigator-task.is-error {
    border-color: #93444b;
}

html[data-theme="dark"] .navigator-task-status {
    background: var(--surface);
}

html[data-theme="dark"] .navigator-task-next {
    border-top-color: var(--line);
}

html[data-theme="dark"] .page-loader {
    background: rgba(16, 24, 39, 0.78);
}

h1,
h2,
h3,
p {
    margin-top: 0;
}

h1 {
    margin-bottom: 8px;
    font-size: 28px;
    letter-spacing: -0.7px;
}

.subtitle {
    margin: 0;
    color: var(--muted);
    line-height: 1.5;
}

.user-chip {
    padding: 9px 12px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: var(--surface);
    color: var(--muted);
    font-size: 13px;
    white-space: nowrap;
}

.alert {
    margin-bottom: 18px;
    padding: 13px 15px;
    border-radius: 10px;
    font-size: 14px;
}

.alert-success {
    background: var(--success-bg);
    color: var(--success);
}

.alert-error {
    background: var(--danger-bg);
    color: var(--danger);
}

.alert ul {
    margin: 0;
    padding-left: 18px;
}.dashboard-notifications {
    position: fixed;
    z-index: 200;
    top: 20px;
    right: 20px;
    display: grid;
    width: min(420px, calc(100vw - 32px));
    gap: 10px;
    pointer-events: none;
}

.dashboard-notification {
    padding: 13px 15px;
    border-radius: 10px;
    box-shadow: 0 12px 28px rgba(23, 32, 51, 0.16);
    font-size: 14px;
    line-height: 1.5;
    opacity: 1;
    transition: opacity 0.2s ease;
}

.dashboard-notification.is-success {
    background: var(--success-bg);
    color: var(--success);
}

.dashboard-notification.is-error {
    background: var(--danger-bg);
    color: var(--danger);
}

.dashboard-notification.is-hidden {
    opacity: 0;
}.dashboard-notification-welcome {
    display: grid;
    gap: 4px;
    animation: dashboard-welcome-notification-hide 0.35s ease 6s forwards;
}

.dashboard-notification-welcome strong {
    font-weight: 800;
}

@keyframes dashboard-welcome-notification-hide {
    to {
        opacity: 0;
        transform: translateY(-8px);
        visibility: hidden;
    }
}

.dashboard-notification ul {
    margin: 0;
    padding-left: 18px;
}

@media (max-width: 820px) {
    .dashboard-notifications {
        top: auto;
        right: 16px;
        bottom: 16px;
        left: 16px;
        width: auto;
    }

    .dashboard-notification {
        padding: 15px 16px;
        box-shadow: 0 14px 32px rgba(23, 32, 51, 0.28);
        font-size: 15px;
    }
}

.content-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 20px;
}.neurocoin-test-panel {
    margin-bottom: 20px;
}.neurocoin-maintenance-dialog {
    width: min(460px, calc(100vw - 32px));
    padding: 0;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: transparent;
    color: var(--text);
    box-shadow: 0 20px 50px rgba(23, 32, 51, 0.28);
}

.neurocoin-maintenance-dialog::backdrop {
    background: rgba(23, 32, 51, 0.48);
}

.neurocoin-maintenance-dialog-content {
    display: grid;
    gap: 20px;
    padding: 24px;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: var(--surface);
}

.neurocoin-maintenance-dialog-content p {
    margin: 0;
    color: var(--text);
    font-size: 15px;
    line-height: 1.55;
}

.neurocoin-maintenance-dialog-content .button {
    justify-self: end;
}.neurocoin-maintenance-dialog[open] {
    animation: neurocoin-maintenance-dialog-show 0.22s ease-out;
}

.neurocoin-maintenance-dialog[open]::backdrop {
    animation: neurocoin-maintenance-backdrop-show 0.22s ease-out;
}

.neurocoin-maintenance-dialog[open] .neurocoin-maintenance-dialog-content {
    animation: neurocoin-maintenance-content-show 0.22s ease-out;
}

@keyframes neurocoin-maintenance-dialog-show {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes neurocoin-maintenance-backdrop-show {
    from {
        background: rgba(23, 32, 51, 0);
    }

    to {
        background: rgba(23, 32, 51, 0.48);
    }
}

@keyframes neurocoin-maintenance-content-show {
    from {
        opacity: 0;
        transform: translateY(12px) scale(0.97);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@media (prefers-reduced-motion: reduce) {
    .neurocoin-maintenance-dialog[open],
    .neurocoin-maintenance-dialog[open]::backdrop,
    .neurocoin-maintenance-dialog[open] .neurocoin-maintenance-dialog-content {
        animation: none;
    }
}

.neurocoin-package-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 16px;
}

.neurocoin-package {
    position: relative;
    display: flex;
    min-width: 0;
    min-height: 254px;
    flex-direction: column;
    gap: 20px;
    padding: 22px;
    overflow: hidden;
    border: 1px solid color-mix(in srgb, var(--accent) 22%, var(--line));
    border-radius: 16px;
    background:
        radial-gradient(
            circle at 100% 0,
            color-mix(in srgb, var(--accent) 15%, transparent) 0,
            transparent 42%
        ),
        linear-gradient(
            145deg,
            var(--surface) 0%,
            var(--surface-muted) 100%
        );
    box-shadow:
        0 1px 0 color-mix(in srgb, #ffffff 65%, transparent) inset,
        0 12px 28px rgba(23, 32, 51, 0.06);
    transition: border-color 0.18s ease, box-shadow 0.18s ease;
}

.neurocoin-package::before {
    position: absolute;
    top: 0;
    right: 22px;
    left: 22px;
    height: 3px;
    border-radius: 0 0 99px 99px;
    background: var(--accent);
    content: "";
}

.neurocoin-package:hover {
    border-color: color-mix(in srgb, var(--accent) 58%, var(--line));
    box-shadow:
        0 1px 0 color-mix(in srgb, #ffffff 65%, transparent) inset,
        0 16px 34px color-mix(in srgb, var(--accent) 14%, transparent);
}

.neurocoin-package-content {
    position: relative;
    min-width: 0;
    padding-top: 5px;
}

.neurocoin-package h3 {
    margin: 0 0 9px;
    overflow-wrap: anywhere;
    color: var(--text);
    font-size: 18px;
    letter-spacing: -0.02em;
    line-height: 1.3;
}

.neurocoin-package p,
.neurocoin-test-sale p {
    margin: 0;
    color: var(--muted);
    font-size: 13px;
    line-height: 1.55;
}

.neurocoin-package-meta {
    position: relative;
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 8px;
    margin-top: auto;
    padding: 7px;
    border: 1px solid color-mix(in srgb, var(--accent) 13%, var(--line));
    border-radius: 13px;
    background: color-mix(in srgb, var(--surface) 74%, transparent);
}

.neurocoin-package-meta strong,
.neurocoin-package-meta span {
    display: flex;
    min-height: 52px;
    align-items: center;
    padding: 10px 11px;
    border-radius: 8px;
    font-weight: 800;
    white-space: nowrap;
}

.neurocoin-package-meta strong {
    background: color-mix(in srgb, var(--accent) 12%, var(--surface));
    color: var(--accent);
    font-size: 16px;
}

.neurocoin-package-meta span {
    justify-content: flex-end;
    background: var(--surface);
    color: var(--text);
    font-size: 13px;
    text-align: right;
}

.neurocoin-package form {
    position: relative;
    margin: 0;
}

.neurocoin-package .button {
    width: 100%;
    min-height: 44px;
    border: 1px solid color-mix(in srgb, #000000 8%, transparent);
    border-radius: 10px;
    box-shadow: 0 5px 12px color-mix(in srgb, var(--accent) 20%, transparent);
}

.neurocoin-package .button:hover:not(:disabled) {
    box-shadow: 0 7px 16px color-mix(in srgb, var(--accent) 28%, transparent);
}

.neurocoin-test-sales {
    display: grid;
    gap: 10px;
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid var(--line);
}

.neurocoin-test-sale {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 13px 14px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: var(--surface-muted);
}

.neurocoin-test-sale p {
    margin-top: 4px;
}

.neurocoin-test-sale-actions {
    display: flex;
    flex: 0 0 auto;
    flex-wrap: wrap;
    gap: 8px;
}

@media (max-width: 1120px) {
    .neurocoin-package-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 640px) {
    .neurocoin-package-grid {
        grid-template-columns: minmax(0, 1fr);
    }

    .neurocoin-package {
        min-height: 0;
    }

    .neurocoin-test-sale {
        align-items: flex-start;
        flex-direction: column;
    }
}

.card {
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: var(--surface);
}

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 18px 20px;
    border-bottom: 1px solid var(--line);
}

.card-header h2 {
    margin: 0;
    font-size: 17px;
}

.card-body {
    padding: 20px;
}

.projects {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 22px;
}.stories-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 14px;
}

.story-card {
    display: flex;
    min-width: 0;
    min-height: 170px;
    flex-direction: column;
    padding: 17px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: var(--surface-muted);
}.story-card,
.story-favorite-card {
    position: relative;
}

.story-card-trash-form {
    position: absolute;
    z-index: 1;
    top: 8px;
    left: 8px;
    margin: 0;
}

.story-card-title-row {
    padding-left: 28px;
}

.story-card-action-trash {
    width: 26px;
    height: 26px;
    border: 1px solid var(--line);
    border-radius: 7px;
    background: var(--surface);
    color: var(--muted);
    font-size: 20px;
    line-height: 1;
}

.story-card-action-trash:hover {
    border-color: var(--danger);
    background: var(--danger-bg);
    color: var(--danger);
}.story-card-action-trash.js-action-loading {
    color: transparent;
}

.story-card-action-trash.js-action-loading .button-loader {
    display: block;
}

.story-favorite-card > [data-text-navigation] {
    padding-left: 28px;
}

.story-trash-floating-button {
    position: fixed;
    z-index: 40;
    right: 24px;
    bottom: 24px;
    display: inline-flex;
    width: 48px;
    height: 48px;
    align-items: center;
    justify-content: center;
    padding: 0;
    border: 1px solid var(--line);
    border-radius: 50%;
    background: var(--surface);
    box-shadow: 0 12px 28px rgba(23, 32, 51, 0.2);
    color: var(--text);
    font: inherit;
    font-size: 21px;
    cursor: pointer;
}

.story-trash-floating-button:hover {
    border-color: var(--accent);
    color: var(--accent);
}

.story-trash-list {
    display: grid;
    gap: 10px;
}

.story-trash-empty {
    margin: 0;
    color: var(--muted);
}

.story-trash-item {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    padding: 13px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: var(--surface-muted);
}

.story-trash-item-content {
    min-width: 0;
}

.story-trash-item-type {
    display: block;
    margin-bottom: 4px;
    color: var(--muted);
    font-size: 11px;
    font-weight: 700;
}

.story-trash-item h3 {
    margin: 0 0 6px;
    overflow-wrap: anywhere;
    font-size: 14px;
    line-height: 1.4;
}

.story-trash-item p {
    margin: 0;
    color: var(--muted);
    font-size: 13px;
    line-height: 1.45;
}

.story-trash-item-actions {
    display: flex;
    flex: 0 0 auto;
    gap: 6px;
}

.story-trash-item-actions form {
    margin: 0;
}

.story-trash-action {
    display: inline-flex;
    width: 32px;
    height: 32px;
    align-items: center;
    justify-content: center;
    padding: 0;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface);
    color: var(--accent);
    font: inherit;
    font-size: 19px;
    line-height: 1;
    cursor: pointer;
}

.story-trash-action-purge {
    color: var(--danger);
}

@media (max-width: 820px) {
    .story-trash-floating-button {
        right: 16px;
        bottom: 16px;
    }
}

/* Удаление сюжетов выполняется через крестик и корзину без жестов свайпа. */

.story-card-new {
    border-color: #c9cafd;
    background: #f4f4ff;
}

html[data-theme="dark"] .story-card-new {
    border-color: #4e5090;
    background: #25294a;
}

.story-card-title-row {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 10px;
}

.story-card-title-row h3 {
    flex: 1 1 auto;
    min-width: 0;
    margin: 0;
}

.story-card-actions {
    display: flex;
    flex: 0 0 auto;
    margin: -7px -7px 0 0;
}

.story-card-actions form,
.story-card-create-form {
    margin: 0;
}

.story-card-create-form {
    display: flex;
    justify-content: flex-end;
    margin-top: auto;
    padding-top: 16px;
}.story-showcase-card {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    align-items: end;
    gap: 0 10px;
}

.story-showcase-card > h3,
.story-showcase-card > .story-card-meta,
.story-showcase-card > .story-card-logline {
    grid-column: 1 / -1;
}

.story-showcase-card > .story-card-logline {
    margin-bottom: 18px;
}

.story-showcase-card > .story-showcase-read-button {
    width: 100%;
    min-height: 42px;
    margin: 0;
    padding: 9px 10px;
    font-size: 13px;
    white-space: nowrap;
}

.story-showcase-card > .story-card-create-form {
    display: flex;
    width: 100%;
    align-items: stretch;
    margin: 0;
    padding: 0;
}

.story-showcase-card > .story-card-create-form .story-card-action-create {
    width: 100%;
    min-height: 42px;
    justify-content: center;
    gap: 7px;
    padding: 9px 10px;
    font-size: 13px;
    white-space: nowrap;
}

.story-showcase-card > .story-card-create-form .story-card-action-create svg {
    width: 16px;
    height: 16px;
    flex: 0 0 16px;
}

.story-card-action {
    display: inline-flex;
    width: 32px;
    height: 32px;
    align-items: center;
    justify-content: center;
    padding: 0;
    border: 0;
    border-radius: 7px;
    background: transparent;
    color: var(--text);
    cursor: pointer;
}

.story-card-action svg {
    width: 18px;
    height: 18px;
    fill: none;
    stroke: currentColor;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 1.7;
}

.story-card-action:hover {
    background: var(--surface);
}

.story-card-action:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}.story-card-action.js-action-loading,
.story-card-action:disabled {
    cursor: wait;
    opacity: 1;
    pointer-events: none;
    animation: story-card-action-loading 0.9s ease-in-out infinite;
}

.story-card-action.js-action-loading svg {
    display: none;
}

.story-card-action .button-loader {
    width: 16px;
    height: 16px;
    margin: 0;
}

@keyframes story-card-action-loading {
    0%,
    100% {
        opacity: 0.35;
    }

    50% {
        opacity: 1;
    }
}

.story-card-action-favorite {
    color: #c79a10;
}

.story-card-action-favorite svg {
    fill: currentColor;
    stroke: currentColor;
}.story-card-action-favorite[aria-label="Сохранить в избранное"] {
    color: var(--muted);
}

.story-card-action-favorite[aria-label="Сохранить в избранное"] svg {
    fill: none;
    stroke: currentColor;
}

.story-card-action-create {
    width: auto;
    min-width: 0;
    height: 36px;
    min-height: 36px;
    gap: 7px;
    padding: 0 12px;
    background: var(--accent);
    color: #fff;
    font: inherit;
    font-size: 13px;
    font-weight: 700;
    line-height: 1;
    white-space: nowrap;
}

.story-card-action-create span {
    display: inline-block;
    flex: 0 0 auto;
}

.story-card-action-create svg {
    width: 17px;
    height: 17px;
    flex: 0 0 17px;
}

.story-card-action-create:hover {
    background: var(--accent-hover);
}.style-profile-selector-dialog {
    width: min(100% - 32px, 520px);
    padding: 0;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: transparent;
    color: var(--text);
    box-shadow: 0 20px 50px rgba(23, 32, 51, 0.28);
}

.style-profile-selector-dialog::backdrop {
    background: rgba(23, 32, 51, 0.48);
}

.style-profile-selector {
    position: relative;
    padding: 24px;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: var(--surface);
}

.style-profile-selector h3 {
    margin: 0 34px 18px 0;
    font-size: 18px;
    line-height: 1.35;
}

.style-profile-selector-close {
    position: absolute;
    top: 12px;
    right: 12px;
    display: inline-flex;
    width: 30px;
    height: 30px;
    align-items: center;
    justify-content: center;
    padding: 0;
    border: 0;
    border-radius: 7px;
    background: transparent;
    color: var(--muted);
    font: inherit;
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
}

.style-profile-selector-close:hover {
    background: var(--surface-muted);
    color: var(--text);
}

.style-profile-selector-close:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

.story-card h3 {
    margin: 0 0 10px;
    overflow-wrap: anywhere;
    color: var(--text);
    font-size: 16px;
    line-height: 1.35;
}

.story-card-logline {
    margin: 0;
    overflow-wrap: anywhere;
    color: var(--muted);
    font-size: 13px;
    line-height: 1.5;
}.story-card-premise {
    position: relative;
    margin: 18px 0 0;
    padding: 16px 18px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: var(--surface-muted);
    color: var(--text);
    font-family: Georgia, "Times New Roman", serif;
    font-size: 15px;
    line-height: 1.72;
    text-align: justify;
    text-align-last: left;
    text-indent: 1.25em;
    overflow-wrap: anywhere;
    white-space: pre-line;
}

.story-card-premise::before {
    position: absolute;
    top: 14px;
    bottom: 14px;
    left: 0;
    width: 3px;
    border-radius: 99px;
    background: var(--accent);
    content: "";
}.story-card-premise p {
    margin: 0;
}

.story-card-premise p + p {
    margin-top: 1em;
}

.story-card-premise + .generator-entity-modal-actions {
    margin-top: 20px;
}.story-card-preview-logline {
    margin: 0 0 18px;
    padding: 0 2px;
    color: var(--text);
    font-size: 16px;
    font-weight: 700;
    line-height: 1.6;
    text-align: justify;
    text-align-last: left;
    overflow-wrap: anywhere;
}

html[data-theme="dark"] .story-card-premise {
    background: color-mix(in srgb, var(--surface-muted) 82%, #000000);
}

html[data-theme="kraft"] .story-card-premise {
    background: color-mix(in srgb, var(--surface-muted) 82%, var(--surface));
}

@media (max-width: 600px) {
    .story-card-premise {
        padding: 14px 15px;
        font-size: 14px;
        line-height: 1.65;
    }
}.story-card-meta {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 7px 10px;
    margin: 0 0 13px;
}

.story-card-meta div {
    min-width: 0;
}

.story-card-meta dt,
.story-card-meta dd {
    margin: 0;
    overflow-wrap: anywhere;
}

.story-card-meta dt {
    margin-bottom: 2px;
    color: var(--muted);
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.story-card-meta dd {
    color: var(--text);
    font-size: 11px;
    font-weight: 700;
    line-height: 1.35;
}.story-pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    margin: 22px 0 0;
}

.story-pagination-link {
    display: inline-flex;
    min-width: 34px;
    min-height: 34px;
    align-items: center;
    justify-content: center;
    padding: 7px 10px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface);
    color: var(--accent);
    font-size: 13px;
    font-weight: 800;
    text-decoration: none;
}

.story-pagination-link:hover,
.story-pagination-link.is-active {
    border-color: var(--accent);
    background: var(--accent);
    color: #ffffff;
}.story-showcase-read-button {
    width: fit-content;
    margin-top: auto;
    padding: 8px 11px;
    font-size: 13px;
}

.story-showcase-modal-premise {
    margin: 0;
    color: var(--text);
    font-size: 15px;
    line-height: 1.65;
}

.project {
    display: block;
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 16px;
    background: var(--surface);
    text-decoration: none;
    transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
}

.project:hover {
    border-color: #bbbdf9;
    box-shadow: 0 18px 34px rgba(23, 32, 51, 0.16);
    transform: translateY(-3px);
}

.project.selected {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(91, 92, 226, 0.1);
}

.project-cover {
    position: relative;
    display: flex;
    min-height: 410px;
    align-items: flex-end;
    overflow: hidden;
    padding: 30px;
    background:
        radial-gradient(circle at 20% 18%, rgba(167, 204, 255, 0.9) 0 2px, transparent 3px),
        radial-gradient(circle at 75% 30%, rgba(255, 255, 255, 0.75) 0 1px, transparent 2px),
        linear-gradient(150deg, #101827 0%, #263b65 48%, #5b5ce2 100%);
}

.project:nth-child(5n + 2) .project-cover {
    background:
        radial-gradient(circle at 18% 16%, rgba(219, 255, 246, 0.9) 0 2px, transparent 3px),
        radial-gradient(circle at 73% 26%, rgba(255, 255, 255, 0.75) 0 1px, transparent 2px),
        linear-gradient(150deg, #0a1730 0%, #164f67 46%, #63cfc3 100%);
}

.project:nth-child(5n + 3) .project-cover {
    background:
        radial-gradient(circle at 75% 18%, rgba(255, 255, 255, 0.8) 0 2px, transparent 3px),
        linear-gradient(155deg, #22163c 0%, #754b9c 52%, #f1a4d7 100%);
}

.project:nth-child(5n + 4) .project-cover {
    background:
        radial-gradient(circle at 77% 22%, #fff2b4 0 8%, rgba(255, 220, 105, 0.35) 9% 16%, transparent 17%),
        linear-gradient(155deg, #10172d 0%, #424b91 55%, #d98564 100%);
}

.project:nth-child(5n) .project-cover {
    background:
        radial-gradient(circle at 32% 24%, rgba(255, 224, 194, 0.88) 0 3px, transparent 4px),
        linear-gradient(155deg, #542239 0%, #b9535a 52%, #f4aa7b 100%);
}

.project-cover::before {
    position: absolute;
    inset: 18px;
    border: 1px solid rgba(255, 255, 255, 0.38);
    content: "";
}

.project-cover::after {
    position: absolute;
    right: 0;
    bottom: 0;
    left: 0;
    height: 68%;
    background: linear-gradient(transparent, rgba(8, 14, 29, 0.84));
    content: "";
}

.project-cover-content {
    position: relative;
    z-index: 1;
    display: grid;
    width: 100%;
    gap: 10px;
}.project-card-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 16px;
    border-top: 1px solid var(--line);
    color: var(--muted);
    font-size: 13px;
    line-height: 1.4;
}

.project-card-meta span {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.project-card-meta span:last-child {
    flex: 0 0 auto;
}

.project-title {
    color: #ffffff;
    font-family: Georgia, "Times New Roman", serif;
    font-size: clamp(26px, 2.2vw, 34px);
    font-weight: 700;
    letter-spacing: -0.035em;
    line-height: 1.08;
    text-shadow: 0 2px 12px rgba(0, 0, 0, 0.46);
}

.project-author {
    color: rgba(255, 255, 255, 0.9);
    font-size: 14px;
    font-weight: 700;
    line-height: 1.35;
}

.project-logline {
    display: -webkit-box;
    overflow: hidden;
    color: rgba(255, 255, 255, 0.78);
    font-size: 14px;
    line-height: 1.5;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 4;
}

.project-premise,
.project-meta,
.project-style {
    color: var(--muted);
    font-size: 12px;
    line-height: 1.5;
}

@media (max-width: 820px) {
    .project-cover {
        min-height: 360px;
        padding: 24px;
    }
}

.status {
    display: inline-flex;
    margin-left: 6px;
    padding: 2px 7px;
    border-radius: 99px;
    background: #edf0f5;
    color: #536276;
    font-size: 11px;
    font-weight: 700;
}

.form-field {
    display: grid;
    gap: 7px;
    margin-bottom: 15px;
}

label {
    color: #4b5a70;
    font-size: 13px;
    font-weight: 700;
}.project-readonly-label {
    display: block;
    color: var(--muted);
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.07em;
    line-height: 1.35;
    text-transform: uppercase;
}

.project-readonly-value {
    min-width: 0;
    margin-top: 5px;
    color: var(--text);
    font-size: 15px;
    font-weight: 600;
    line-height: 1.5;
    overflow-wrap: anywhere;
}

.project-readonly-value-multiline {
    font-weight: 400;
    line-height: 1.58;
    text-align: justify;
    text-align-last: left;
    text-indent: 1.25em;
    hyphens: auto;
    white-space: pre-wrap;
}/* Художественные и аналитические тексты оформляются как цельные абзацы. */
[data-text-navigation] > p:not(:has(strong)),
.scene-draft-content p,
.generator-entity-modal-body > p,
.generator-entity-modal-body .generator-entity-preview-section > p {
    text-align: justify;
    text-align-last: left;
    text-indent: 1.25em;
    hyphens: auto;
}

input,
textarea,
select {
    width: 100%;
    padding: 10px 11px;
    border: 1px solid #d8e0eb;
    border-radius: 9px;
    outline: none;
    background: #fff;
    color: var(--text);
    font: inherit;
    font-size: 14px;
}

textarea {
    min-height: 94px;
    resize: vertical;
}

input:focus,
textarea:focus,
select:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(91, 92, 226, 0.12);
}

.button {
    padding: 10px 14px;
    border: 0;
    border-radius: 9px;
    background: var(--accent);
    color: #fff;
    font: inherit;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
}

.button:hover {
    background: var(--accent-hover);
}

.button-danger {
    background: var(--danger);
}

.button-danger:hover {
    background: #8f1d14;
}

.button:disabled {
    cursor: wait;
    opacity: 0.72;
}

.button-loader {
    display: inline-block;
    width: 13px;
    height: 13px;
    margin-right: 8px;
    border: 2px solid rgba(255, 255, 255, 0.45);
    border-top-color: #fff;
    border-radius: 50%;
    vertical-align: -2px;
    animation: button-loader-spin 0.7s linear infinite;
}

.page-loader {
    position: fixed;
    z-index: 100;
    inset: 0;
    display: none;
    align-items: center;
    justify-content: center;
    background: rgba(245, 247, 251, 0.72);
}

.page-loader.is-visible {
    display: flex;
}

.page-loader-indicator {
    display: inline-flex;
    align-items: center;
    gap: 11px;
    padding: 14px 17px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: var(--surface);
    box-shadow: 0 12px 28px rgba(23, 32, 51, 0.14);
    color: var(--text);
    font-size: 14px;
    font-weight: 700;
}

.page-loader-spinner {
    width: 18px;
    height: 18px;
    border: 3px solid rgba(91, 92, 226, 0.2);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: button-loader-spin 0.7s linear infinite;
}

@keyframes button-loader-spin {
    to {
        transform: rotate(360deg);
    }
}#premise-options .generation-status.is-pending .status-loader {
    display: inline-block;
    width: 14px;
    height: 14px;
    flex: 0 0 14px;
    border: 2px solid rgba(91, 92, 226, 0.22);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: button-loader-spin 0.7s linear infinite;
}

.new-project-choices {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 20px;
    width: min(100%, 820px);
    margin: 0 auto;
    padding: 24px 0;
}

.new-project-choice {
    display: grid;
    min-height: 260px;
    place-items: center;
    gap: 18px;
    padding: 28px 24px;
    border: 1px solid var(--line);
    border-radius: 18px;
    background: var(--surface);
    box-shadow: 0 12px 28px rgba(23, 32, 51, 0.06);
    color: var(--text);
    cursor: pointer;
    font: inherit;
    font-size: 18px;
    font-weight: 800;
    letter-spacing: -0.02em;
    line-height: 1.35;
    text-align: center;
    transition: border-color 0.18s ease, box-shadow 0.18s ease, transform 0.18s ease;
}

.new-project-choice:hover {
    border-color: color-mix(in srgb, var(--accent) 52%, var(--line));
    box-shadow: 0 18px 34px color-mix(in srgb, var(--accent) 17%, transparent);
    transform: translateY(-4px);
}.new-project-choice.is-generation-pending,
.new-project-choice:disabled {
    border-color: var(--line);
    background: var(--surface-muted);
    box-shadow: none;
    cursor: not-allowed;
    filter: grayscale(0.2);
    opacity: 0.45;
    transform: none;
}

.new-project-choice.is-generation-pending:hover,
.new-project-choice:disabled:hover {
    border-color: var(--line);
    box-shadow: none;
    transform: none;
}

.new-project-choice:focus-visible {
    outline: 3px solid color-mix(in srgb, var(--accent) 30%, transparent);
    outline-offset: 3px;
}.new-project-choice {
    position: relative;
    isolation: isolate;
    min-height: 272px;
    overflow: hidden;
    border-color: color-mix(in srgb, var(--accent) 24%, var(--line));
    background:
        radial-gradient(
            circle at 82% 16%,
            color-mix(in srgb, var(--accent) 20%, transparent) 0,
            transparent 31%
        ),
        linear-gradient(
            145deg,
            color-mix(in srgb, var(--accent) 10%, var(--surface)) 0%,
            var(--surface) 52%,
            color-mix(in srgb, var(--surface-muted) 74%, var(--surface)) 100%
        );
    box-shadow:
        0 1px 0 color-mix(in srgb, #ffffff 44%, transparent) inset,
        0 18px 36px color-mix(in srgb, #000000 11%, transparent);
}

.new-project-choice::before {
    position: absolute;
    z-index: -1;
    top: -84px;
    right: -76px;
    width: 202px;
    height: 202px;
    border: 1px solid color-mix(in srgb, var(--accent) 32%, transparent);
    border-radius: 50%;
    box-shadow:
        0 0 0 24px color-mix(in srgb, var(--accent) 5%, transparent),
        0 0 0 50px color-mix(in srgb, var(--accent) 3%, transparent);
    content: "";
    transition: transform 0.35s ease;
}

.new-project-choice::after {
    position: absolute;
    z-index: -1;
    right: 24px;
    bottom: 0;
    left: 24px;
    height: 3px;
    border-radius: 99px 99px 0 0;
    background: linear-gradient(
        90deg,
        transparent,
        color-mix(in srgb, var(--accent) 72%, #ffffff),
        transparent
    );
    content: "";
    opacity: 0.78;
    transform: scaleX(0.55);
    transition: opacity 0.22s ease, transform 0.22s ease;
}

.new-project-choice:hover {
    border-color: color-mix(in srgb, var(--accent) 62%, var(--line));
    background:
        radial-gradient(
            circle at 82% 16%,
            color-mix(in srgb, var(--accent) 28%, transparent) 0,
            transparent 34%
        ),
        linear-gradient(
            145deg,
            color-mix(in srgb, var(--accent) 15%, var(--surface)) 0%,
            var(--surface) 52%,
            color-mix(in srgb, var(--surface-muted) 66%, var(--surface)) 100%
        );
    box-shadow:
        0 1px 0 color-mix(in srgb, #ffffff 52%, transparent) inset,
        0 24px 44px color-mix(in srgb, var(--accent) 22%, transparent);
    transform: none;
}

.new-project-choice:hover::before {
    transform: scale(1.13);
}

.new-project-choice:hover::after {
    opacity: 1;
    transform: scaleX(1);
}

.new-project-choice svg {
    position: relative;
    z-index: 1;
    padding: 19px;
    border: 1px solid color-mix(in srgb, var(--accent) 30%, transparent);
    border-radius: 22px;
    background:
        linear-gradient(
            145deg,
            color-mix(in srgb, var(--accent) 19%, var(--surface)),
            color-mix(in srgb, var(--accent) 5%, var(--surface))
        );
    box-shadow:
        0 1px 0 color-mix(in srgb, #ffffff 46%, transparent) inset,
        0 14px 28px color-mix(in srgb, var(--accent) 18%, transparent);
    transition: background-color 0.22s ease, box-shadow 0.22s ease, transform 0.22s ease;
}

.new-project-choice:hover svg {
    background:
        linear-gradient(
            145deg,
            color-mix(in srgb, var(--accent) 27%, var(--surface)),
            color-mix(in srgb, var(--accent) 9%, var(--surface))
        );
    box-shadow:
        0 1px 0 color-mix(in srgb, #ffffff 52%, transparent) inset,
        0 18px 34px color-mix(in srgb, var(--accent) 27%, transparent);
    transform: translateY(-4px) scale(1.03);
}

.new-project-choice > span {
    position: relative;
    z-index: 1;
    max-width: 290px;
    color: var(--text);
    font-size: 17px;
    line-height: 1.3;
}

html[data-theme="dark"] .new-project-choice {
    border-color: color-mix(in srgb, var(--accent) 34%, var(--line));
    background:
        radial-gradient(
            circle at 82% 16%,
            color-mix(in srgb, var(--accent) 19%, transparent) 0,
            transparent 32%
        ),
        linear-gradient(
            145deg,
            color-mix(in srgb, var(--accent) 10%, var(--surface)) 0%,
            color-mix(in srgb, var(--surface) 84%, #0b1220) 100%
        );
    box-shadow:
        0 1px 0 color-mix(in srgb, #ffffff 8%, transparent) inset,
        0 20px 42px rgba(0, 0, 0, 0.3);
}

html[data-theme="dark"] .new-project-choice:hover {
    border-color: color-mix(in srgb, var(--accent) 68%, var(--line));
    box-shadow:
        0 1px 0 color-mix(in srgb, #ffffff 11%, transparent) inset,
        0 26px 48px rgba(0, 0, 0, 0.42);
}

@media (prefers-reduced-motion: reduce) {
    .new-project-choice::before,
    .new-project-choice::after,
    .new-project-choice svg {
        transition: none;
    }
}

.new-project-choice svg {
    width: 108px;
    height: 108px;
    overflow: visible;
    color: var(--accent);
    filter: drop-shadow(0 14px 18px color-mix(in srgb, var(--accent) 19%, transparent));
}

.new-project-choice path {
    stroke: currentColor;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 3.6;
}

.new-project-choice-spark {
    fill: currentColor;
    stroke-width: 2.2 !important;
}

.new-project-dialog {
    width: min(100% - 32px, 620px);
    max-height: min(820px, calc(100dvh - 32px));
    padding: 0;
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 16px;
    background: transparent;
    color: var(--text);
    box-shadow: 0 24px 60px rgba(23, 32, 51, 0.3);
}

.new-project-dialog::backdrop {
    background: rgba(9, 16, 30, 0.6);
    backdrop-filter: blur(12px) saturate(0.78);
    -webkit-backdrop-filter: blur(12px) saturate(0.78);
}@media (min-width: 821px) {
    #custom-premise-dialog {
        width: min(100% - 48px, 960px);
    }

    #custom-premise-dialog .new-project-dialog-form {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        max-height: none;
        overflow-y: visible;
    }

    #custom-premise-dialog .new-project-dialog-close,
    #custom-premise-dialog .new-project-dialog-form > .button {
        grid-column: 1 / -1;
    }
}.new-project-dialog[open] {
    animation: new-project-dialog-show 0.24s ease-out;
}

.new-project-dialog[open]::backdrop {
    animation: new-project-dialog-backdrop-show 0.24s ease-out;
}

@keyframes new-project-dialog-show {
    from {
        opacity: 0;
        transform: translateY(14px) scale(0.98);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@keyframes new-project-dialog-backdrop-show {
    from {
        background: rgba(23, 32, 51, 0);
    }

    to {
        background: rgba(23, 32, 51, 0.52);
    }
}

@media (prefers-reduced-motion: reduce) {
    .new-project-dialog[open],
    .new-project-dialog[open]::backdrop {
        animation: none;
    }
}

.new-project-dialog-form {
    position: relative;
    display: grid;
    gap: 18px;
    max-height: min(820px, calc(100dvh - 32px));
    padding: 30px 30px 0;
    overflow-y: auto;
    border: 1px solid var(--line);
    border-radius: 16px;
    background:
        radial-gradient(
            circle at 100% 0,
            color-mix(in srgb, var(--accent) 12%, transparent) 0,
            transparent 32%
        ),
        var(--surface);
}

.new-project-dialog-form .form-field {
    display: grid;
    gap: 8px;
    margin: 0;
}

.new-project-dialog-form .form-field > label {
    color: var(--muted);
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.06em;
    line-height: 1.35;
    text-transform: uppercase;
}

.new-project-dialog-form input,
.new-project-dialog-form select,
.new-project-dialog-form textarea {
    min-height: 48px;
    padding: 12px 14px;
    border-color: color-mix(in srgb, var(--line) 78%, var(--accent));
    border-radius: 11px;
    background: color-mix(in srgb, var(--surface-muted) 72%, var(--surface));
    transition: border-color 0.18s ease, background-color 0.18s ease, box-shadow 0.18s ease;
}

.new-project-dialog-form textarea {
    min-height: 120px;
    line-height: 1.55;
}

.new-project-dialog-form input:hover,
.new-project-dialog-form select:hover,
.new-project-dialog-form textarea:hover {
    border-color: color-mix(in srgb, var(--accent) 38%, var(--line));
}

.new-project-dialog-form input:focus,
.new-project-dialog-form select:focus,
.new-project-dialog-form textarea:focus {
    background: var(--surface);
    box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 14%, transparent);
}

.new-project-dialog-footer {
    position: sticky;
    z-index: 10;
    bottom: 0;
    margin: 2px -30px 0;
    padding: 18px 30px 30px;
    border-top: 1px solid color-mix(in srgb, var(--line) 82%, var(--accent));
    background:
        linear-gradient(transparent, color-mix(in srgb, var(--surface) 92%, transparent) 22px),
        var(--surface);
    box-shadow: 0 -14px 24px color-mix(in srgb, var(--surface) 86%, transparent);
}

.new-project-dialog-footer .button {
    width: 100%;
    min-height: 48px;
    border: 1px solid color-mix(in srgb, #000000 8%, transparent);
    border-radius: 11px;
    box-shadow: 0 10px 22px color-mix(in srgb, var(--accent) 25%, transparent);
}

.new-project-dialog-footer .button:hover:not(:disabled) {
    box-shadow: 0 14px 28px color-mix(in srgb, var(--accent) 32%, transparent);
}body.dashboard-dialog-scroll-locked {
    position: fixed;
    width: 100%;
    overflow: hidden;
}

@media (min-width: 821px) {
    #custom-premise-dialog {
        width: min(100% - 48px, 900px);
        max-height: min(800px, calc(100dvh - 48px));
    }

    #custom-premise-dialog .new-project-dialog-form {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 18px 20px;
        max-height: none;
        padding: 0 34px;
        overflow: visible;
    }

    #custom-premise-dialog .new-project-dialog-form > .new-project-dialog-close {
        grid-column: 1 / -1;
    }

    #custom-premise-dialog .new-project-dialog-form > .form-field {
        min-width: 0;
        align-self: start;
    }

    #custom-premise-dialog .new-project-dialog-form > .form-field:has(#custom-project-title),
    #custom-premise-dialog .new-project-dialog-form > .form-field:has(#custom-project-genre),
    #custom-premise-dialog .new-project-dialog-form > .form-field:has(#custom-project-ending-effect),
    #custom-premise-dialog .new-project-dialog-form > .form-field:has(#custom-project-romance-line-mode),
    #custom-premise-dialog .new-project-dialog-form > .form-field:has(#custom-project-source-literary-culture),
    #custom-premise-dialog .new-project-dialog-form > .form-field:has(#custom-project-target-audience) {
        grid-column: auto;
    }

    #custom-premise-dialog .new-project-dialog-form > .form-field:has(#custom-project-logline),
    #custom-premise-dialog .new-project-dialog-form > .form-field:has(#custom-project-premise),
    #custom-premise-dialog .new-project-dialog-form > .form-field:has(#custom-project-target-word-count),
    #custom-premise-dialog .new-project-dialog-footer {
        grid-column: 1 / -1;
    }

    #custom-premise-dialog .new-project-dialog-form textarea {
        min-height: 96px;
    }

    #custom-premise-dialog .new-project-dialog-footer {
        margin: 2px -34px 0;
        padding: 18px 34px 34px;
    }
}

.new-project-dialog-close {
    position: sticky;
    z-index: 1;
    top: -16px;
    justify-self: end;
    width: 32px;
    height: 32px;
    margin: -16px -16px -32px 0;
    padding: 0;
    border: 0;
    border-radius: 8px;
    background: var(--surface-muted);
    color: var(--muted);
    cursor: pointer;
    font: inherit;
    font-size: 24px;
    line-height: 1;
}

.new-project-dialog-close:hover {
    background: var(--danger-bg);
    color: var(--danger);
}

.new-project-choice-magic-pulse {
    fill: none;
    stroke: currentColor;
    stroke-linecap: round;
    stroke-width: 1.4;
    opacity: 0;
}

.new-project-choice.is-generation-pending .new-project-choice-spark,
.new-project-choice:disabled .new-project-choice-spark {
    transform-box: fill-box;
    transform-origin: center;
    animation: new-project-choice-magic-spark 2.4s ease-in-out infinite;
}

.new-project-choice.is-generation-pending .new-project-choice-magic-pulse,
.new-project-choice:disabled .new-project-choice-magic-pulse {
    stroke-dasharray: 5 22;
    animation: new-project-choice-magic-pulse 2.4s ease-in-out infinite;
}

@keyframes new-project-choice-magic-spark {
    0%,
    100% {
        opacity: 0.68;
        transform: scale(0.92) rotate(-5deg);
    }

    50% {
        opacity: 1;
        transform: scale(1.1) rotate(10deg);
    }
}

@keyframes new-project-choice-magic-pulse {
    0%,
    15% {
        opacity: 0;
        stroke-dashoffset: 22;
    }

    30% {
        opacity: 0.9;
    }

    62% {
        opacity: 0.25;
        stroke-dashoffset: -18;
    }

    78%,
    100% {
        opacity: 0;
        stroke-dashoffset: -18;
    }
}

@media (prefers-reduced-motion: reduce) {
    .new-project-choice.is-generation-pending .new-project-choice-spark,
    .new-project-choice:disabled .new-project-choice-spark,
    .new-project-choice.is-generation-pending .new-project-choice-magic-pulse,
    .new-project-choice:disabled .new-project-choice-magic-pulse {
        animation: none;
    }

    .new-project-choice.is-generation-pending .new-project-choice-spark,
    .new-project-choice:disabled .new-project-choice-spark {
        opacity: 0.72;
        transform: none;
    }

    .new-project-choice.is-generation-pending .new-project-choice-magic-pulse,
    .new-project-choice:disabled .new-project-choice-magic-pulse {
        opacity: 0.3;
        stroke-dasharray: none;
    }
}@media (max-width: 640px) {
    .new-project-choices {
        grid-template-columns: minmax(0, 1fr);
        min-height: 0;
        padding: 8px 0 24px;
    }

    .new-project-choice {
        min-height: 194px;
        grid-template-columns: auto minmax(0, 1fr);
        gap: 20px;
        padding: 24px;
        text-align: left;
    }

    .new-project-choice svg {
        width: 76px;
        height: 76px;
    }

    .new-project-dialog {
        position: fixed;
        right: 0;
        bottom: 0;
        left: 0;
        width: 100%;
        max-width: none;
        max-height: 88dvh;
        margin: 0;
        border-radius: 20px 20px 0 0;
    }

    .new-project-dialog[open] {
        animation-name: new-project-dialog-mobile-show;
    }

    .new-project-dialog-form {
        max-height: 88dvh;
        padding: 24px 16px max(24px, env(safe-area-inset-bottom));
        border-right: 0;
        border-bottom: 0;
        border-left: 0;
        border-radius: 20px 20px 0 0;
    }

    @keyframes new-project-dialog-mobile-show {
        from {
            opacity: 0;
            transform: translateY(100%);
        }

        to {
            opacity: 1;
            transform: translateY(0);
        }
    }
}.empty {
    padding: 20px;
    color: var(--muted);
    font-size: 14px;
    line-height: 1.5;
}

.empty-books-state {
    display: grid;
    min-height: clamp(340px, 52vh, 560px);
    place-content: center;
    justify-items: center;
    gap: 22px;
    padding: 40px 24px;
    color: var(--muted);
    text-align: center;
}

.empty-books-state-icon {
    width: clamp(112px, 16vw, 156px);
    height: auto;
    overflow: visible;
    color: var(--accent);
    filter: drop-shadow(0 18px 20px color-mix(in srgb, var(--accent) 20%, transparent));
    animation: empty-books-state-float 4.2s ease-in-out infinite;
}

.empty-books-state-icon path {
    stroke: currentColor;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 4;
}

.empty-books-state-spark {
    fill: currentColor;
    stroke-width: 2.5 !important;
    transform-box: fill-box;
    transform-origin: center;
    animation: empty-books-state-spark 2.4s ease-in-out infinite;
}

.empty-books-state p {
    max-width: 360px;
    margin: 0;
    color: var(--text);
    font-size: clamp(17px, 2vw, 21px);
    font-weight: 700;
    letter-spacing: -0.02em;
    line-height: 1.4;
}.empty-books-state-action {
    min-width: 168px;
    padding: 12px 18px;
    border-radius: 10px;
    box-shadow: 0 10px 22px color-mix(in srgb, var(--accent) 28%, transparent);
    text-decoration: none;
}

.empty-books-state-action:hover {
    box-shadow: 0 13px 26px color-mix(in srgb, var(--accent) 34%, transparent);
}

html[data-theme="dark"] .empty-books-state-icon {
    color: #a9b4ff;
}

html[data-theme="kraft"] .empty-books-state-icon {
    color: #b97845;
}

@keyframes empty-books-state-float {
    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-7px);
    }
}

@keyframes empty-books-state-spark {
    0%,
    100% {
        opacity: 0.72;
        transform: scale(0.88) rotate(-8deg);
    }

    50% {
        opacity: 1;
        transform: scale(1.12) rotate(8deg);
    }
}

@media (prefers-reduced-motion: reduce) {
    .empty-books-state-icon,
    .empty-books-state-spark {
        animation: none;
    }
}

.project-overview {
    padding: 20px;
    border-bottom: 1px solid var(--line);
}

.project-overview h2 {
    margin-bottom: 8px;
    font-size: 21px;
}

.project-overview p {
    margin-bottom: 0;
    color: var(--muted);
    font-size: 14px;
    line-height: 1.55;
}

.profile-note {
    margin-top: 14px;
    padding: 11px 12px;
    border-radius: 9px;
    background: var(--surface-muted);
    color: #536276;
    font-size: 13px;
    line-height: 1.45;
}

.profile-note strong {
    color: var(--text);
}

.project-settings {
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 16px;
    background: var(--surface);
    box-shadow: 0 12px 30px rgba(23, 32, 51, 0.05);
}

.project-settings summary {
    display: flex;
    align-items: center;
    min-height: 64px;
    padding: 19px 22px;
    background:
        linear-gradient(
            90deg,
            color-mix(in srgb, var(--accent) 10%, transparent),
            transparent 42%
        );
    color: var(--text);
    font-size: 16px;
    font-weight: 800;
    cursor: pointer;
    letter-spacing: -0.01em;
    list-style: none;
}

.project-settings summary::-webkit-details-marker {
    display: none;
}

.project-settings summary::after {
    display: inline-flex;
    width: 28px;
    height: 28px;
    align-items: center;
    justify-content: center;
    margin-left: auto;
    border-radius: 50%;
    background: color-mix(in srgb, var(--accent) 11%, var(--surface));
    color: var(--accent);
    content: "⌄";
    font-size: 18px;
    line-height: 1;
}

.project-settings[open] summary::after {
    content: "⌃";
}

.project-settings-content {
    border-top: 1px solid var(--line);
}

.project-settings-content > .card-body:first-child {
    padding: 0;
}

.project-settings-title-section,
.project-settings-book-details {
    padding: 20px 24px;
}

.project-settings-style {
    display: grid;
    gap: 16px;
    padding: 20px 24px 24px;
    border-top: 1px solid var(--line);
    background: linear-gradient(
        180deg,
        var(--surface),
        color-mix(in srgb, var(--surface-muted) 54%, var(--surface))
    );
}

.project-style-profile {
    padding: 16px;
    border: 1px solid color-mix(in srgb, var(--accent) 20%, var(--line));
    border-radius: 12px;
    background: var(--surface);
}

.project-style-profile-form {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 16px;
    align-items: end;
}

.project-style-profile-selection {
    min-width: 0;
}

.project-style-profile-selection .form-field {
    margin: 0;
}

.project-style-profile-hint {
    margin: 8px 0 0;
    color: var(--muted);
    font-size: 13px;
    line-height: 1.5;
}

.project-style-profile-save-button {
    min-height: 42px;
    padding-right: 18px;
    padding-left: 18px;
    white-space: nowrap;
}.project-settings-book-details {
    border-top: 1px solid var(--line);
    background: linear-gradient(
        180deg,
        color-mix(in srgb, var(--surface-muted) 66%, transparent),
        var(--surface)
    );
}

.project-settings-section-heading {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 14px;
}

.project-settings-section-heading > span {
    color: var(--text);
    font-size: 15px;
    font-weight: 800;
    letter-spacing: -0.015em;
}

.project-settings-section-heading > small {
    color: var(--muted);
    font-size: 12px;
    line-height: 1.4;
    text-align: right;
}

.project-settings-title-field {
    margin: 0;
}

.project-settings-title-field input {
    min-height: 48px;
    padding: 12px 14px;
    border-color: color-mix(in srgb, var(--accent) 19%, var(--line));
    background: var(--surface-muted);
    font-size: 16px;
    font-weight: 600;
}

.project-settings-save-button {
    min-height: 42px;
    margin-top: 12px;
    padding-right: 18px;
    padding-left: 18px;
    box-shadow: 0 8px 18px color-mix(in srgb, var(--accent) 20%, transparent);
}

.project-settings-readonly-list {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
}

.project-readonly-item {
    min-width: 0;
    padding: 13px 16px;
    border: 1px solid color-mix(in srgb, var(--line) 82%, var(--accent));
    border-radius: 11px;
    background: color-mix(in srgb, var(--surface) 90%, var(--surface-muted));
}

.project-readonly-item-wide {
    grid-column: 1 / -1;
    padding: 15px 16px;
}

.project-readonly-item-wide .project-readonly-value {
    max-width: 920px;
}

html[data-theme="dark"] .project-settings-title-field input {
    background: color-mix(in srgb, var(--surface-muted) 84%, #000000);
}

html[data-theme="dark"] .project-readonly-item {
    background: color-mix(in srgb, var(--surface-muted) 84%, #000000);
}

@media (max-width: 640px) {
    .project-settings {
        border-right: 0;
        border-left: 0;
        border-radius: 0;
        box-shadow: none;
    }

    .project-settings summary {
        min-height: 60px;
        padding: 17px 16px;
    }

    .project-settings-style {
        gap: 14px;
        padding: 16px;
    }

    .project-style-profile {
        padding: 14px;
        border-radius: 10px;
    }

    .project-style-profile-form {
        grid-template-columns: minmax(0, 1fr);
        gap: 14px;
        align-items: stretch;
    }

    .project-style-profile-save-button {
        width: 100%;
    }.project-settings-title-section,
    .project-settings-book-details {
        padding: 16px;
    }

    .project-settings-section-heading {
        align-items: flex-start;
        flex-direction: column;
        gap: 4px;
        margin-bottom: 14px;
    }

    .project-settings-section-heading > small {
        text-align: left;
    }

    .project-settings-readonly-list {
        grid-template-columns: minmax(0, 1fr);
        gap: 8px;
    }

    .project-readonly-item,
    .project-readonly-item-wide {
        grid-column: auto;
        padding: 12px 14px;
        border-radius: 10px;
    }

    .project-readonly-value {
        font-size: 15px;
    }

    .project-readonly-value-multiline {
        font-size: 16px;
        line-height: 1.58;
    }

    .project-settings-save-button {
        width: 100%;
    }
}

.collapsible-section > summary {
    display: flex;
    align-items: center;
    min-height: 58px;
    padding: 18px 20px;
    border-top: 1px solid var(--line);
    color: var(--accent);
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    list-style: none;
}

.collapsible-section > summary::-webkit-details-marker {
    display: none;
}

.collapsible-section > summary::after {
    margin-left: auto;
    content: "⌄";
    font-size: 18px;
    line-height: 1;
}

.collapsible-section[open] > summary::after {
    content: "⌃";
}

.structure-options {
    display: grid;
    gap: 14px;
}

.structure-option {
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: var(--surface-muted);
}

.structure-option h3 {
    margin-bottom: 8px;
    font-size: 15px;
}.structure-option-title-preview {
    color: inherit;
    text-decoration: none;
}

.structure-option-title-preview:hover {
    color: var(--accent);
}

.structure-option-title-preview:focus-visible {
    border-radius: 3px;
    outline: 2px solid var(--accent);
    outline-offset: 3px;
}

.structure-option p {
    margin-bottom: 10px;
    color: var(--muted);
    font-size: 13px;
    line-height: 1.5;
}

.structure-option-part {
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid var(--line);
}

.structure-option-part strong {
    display: block;
    margin-bottom: 5px;
    font-size: 13px;
}

.structure-option-chapters {
    margin: 0;
    padding-left: 18px;
    color: var(--muted);
    font-size: 12px;
    line-height: 1.5;
}.structure-option-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 14px;
}

.button-secondary {
    border: 1px solid var(--accent);
    background: transparent;
    color: var(--accent);
}

.button-secondary:hover {
    background: #efefff;
}

html[data-theme="dark"] .button-secondary:hover {
    background: #25265a;
}

.character-card-details {
    margin-top: 12px;
}

.character-card-details > summary {
    color: var(--accent);
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
}

.character-card-details-content {
    margin-top: 12px;
}

.scene-draft-versions {
    display: grid;
    gap: 10px;
    margin-top: 10px;
}

.scene-draft-version {
    width: fit-content;
    padding: 0;
    border: 0;
    background: transparent;
    color: var(--accent);
    font: inherit;
    font-size: 13px;
    font-weight: 700;
    text-align: left;
    cursor: pointer;
}

.scene-draft-content {
    overflow-wrap: anywhere;
    color: var(--muted);
    font-size: 13px;
    line-height: 1.45;
    text-indent: 0;
    white-space: normal;
}.scene-draft-content p {
    margin: 0 0 8px;
    text-indent: 1.2em;
}

.scene-draft-content p:last-child {
    margin-bottom: 0;
}.has-text-block-navigation {
    position: relative;
    padding-right: 42px;
}

.text-block-navigation-button {
    position: absolute;
    right: 0;
    display: inline-flex;
    width: 30px;
    height: 30px;
    align-items: center;
    justify-content: center;
    padding: 0;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface);
    color: var(--accent);
    font: inherit;
    font-size: 18px;
    font-weight: 700;
    line-height: 1;
    cursor: pointer;
}

.text-block-navigation-button-down {
    top: 0;
}

.text-block-navigation-button-up {
    bottom: 0;
}

.text-block-navigation-button:hover {
    border-color: var(--accent);
    background: var(--surface-muted);
}

@media (max-width: 820px) {
    .has-text-block-navigation {
        padding-right: 36px;
    }

    .text-block-navigation-button {
        width: 28px;
        height: 28px;
    }
}

.character-card-description {
    display: -webkit-box;
    overflow: hidden;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 3;
}

.book-generator {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.generator-tabs {
    display: flex;
    gap: 6px;
    padding: 5px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: var(--surface);
}

@media (min-width: 821px) {
    .book-generator.is-desktop-tabs-fixed {
        position: sticky;
        z-index: 9;
        top: var(--generator-desktop-top);
        right: auto;
        bottom: auto;
        left: auto;
        width: 100%;
        min-height: 320px;
        height: 100%;
        gap: 0;
        overflow: hidden;
    }.workspace:has(.book-generator) > .content-grid {
        display: flex;
        min-height: 0;
        flex: 1 1 0;
    }.workspace:has(.book-generator) > .content-grid > .book-generator {
        min-height: 0;
        flex: 1 1 auto;
    }

    .book-generator.is-desktop-tabs-fixed > .generator-tabs {
        position: relative;
        z-index: 1;
        width: 100%;
        flex: 0 0 auto;
        box-shadow: 0 -2px 0 var(--bg);
    }

    /* Sticky-контейнер остаётся в потоке и резервирует место перед юридическим footer. */
    .book-generator.is-desktop-tabs-fixed > .generator-scroll-content {
        min-height: 0;
        flex: 1 1 auto;
        margin-top: 24px;
        padding: 0 0 32px;
        overflow-y: auto;
        overscroll-behavior: contain;
        border-radius: 14px;
        -ms-overflow-style: none;
        scrollbar-width: none;
    }

    .book-generator.is-desktop-tabs-fixed > .generator-scroll-content::-webkit-scrollbar {
        display: none;
    }
}

.generator-tab {
    flex: 1 1 0;
    padding: 11px 14px;
    border-radius: 8px;
    color: var(--muted);
    font-size: 14px;
    font-weight: 700;
    text-align: center;
    text-decoration: none;
}

.generator-tab:hover {
    background: var(--surface-muted);
    color: var(--accent);
}

.generator-tab.is-active {
    background: var(--accent);
    color: #fff;
}.style-profiles-page {
    min-width: 0;
}

.style-profile-creation-card,
.style-profile-list-card {
    margin-bottom: 20px;
}

.style-profile-job-status {
    margin-top: 14px;
}

.style-profile-sample-list,
.style-profile-list {
    display: grid;
    gap: 12px;
    margin-top: 18px;
}

.style-profile-sample,
.style-profile-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    padding: 15px;
    border: 1px solid var(--line);
    border-radius: 11px;
    background: var(--surface-muted);
}

.style-profile-sample form,
.style-profile-item form {
    flex: 0 0 auto;
    margin: 0;
}

.style-profile-clear-form,
.style-profile-generate-form {
    margin-top: 16px;
}

.style-profile-item-content {
    min-width: 0;
}

.style-profile-item-heading {
    display: flex;
    align-items: flex-start;
    gap: 10px;
}

.style-profile-item-heading h3 {
    margin: 0;
    overflow-wrap: anywhere;
    font-size: 16px;
    line-height: 1.4;
}

.style-profile-item-heading .status {
    flex: 0 0 auto;
    margin: 0;
}

.style-profile-item p {
    margin: 8px 0;
    color: var(--muted);
    font-size: 13px;
    line-height: 1.55;
}

.style-profile-item small {
    color: var(--muted);
    font-size: 12px;
    line-height: 1.45;
}

@media (max-width: 820px) {
    .style-profiles-page {
        margin-top: -20px;
    }

    .style-profile-creation-card,
    .style-profile-list-card {
        border-right: 0;
        border-left: 0;
        border-radius: 0;
    }

    .style-profile-sample,
    .style-profile-item {
        align-items: stretch;
        flex-direction: column;
    }

    .style-profile-sample form,
    .style-profile-item form,
    .style-profile-sample .button,
    .style-profile-item .button {
        width: 100%;
    }
}/* Параметры книги отображаются отдельной вкладкой генератора. */.generator-project-heading {
    display: flex;
    min-width: 0;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin: 16px 0 16px;
}

.generator-project-heading .generator-book-title {
    margin: 0;
    min-width: 0;
}

.generator-project-heading .project-publication-form {
    flex: 0 0 auto;
}

.generator-book-title {
    color: var(--text);
    font-size: 22px;
    line-height: 1.3;
}.generator-structure-status-slot {
    display: grid;
    gap: 8px;
    padding: 12px 0;
}

.generator-structure-status-slot .generator-character-generation-status {
    margin: 0;
}

.generator-structure-status-slot .generator-card-subtitle {
    margin: 0;
}.generator-character-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 16px;
}

.generator-character-actions form {
    margin: 0;
}.generator-character-actions:empty {
    display: none;
}.generator-approved-result-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 0 0 14px;
}

.generator-approved-result-pill {
    display: inline-flex;
    min-height: 34px;
    align-items: center;
    justify-content: center;
    padding: 7px 13px;
    border: 1px solid color-mix(in srgb, var(--accent) 34%, var(--line));
    border-radius: 99px;
    background: color-mix(in srgb, var(--accent) 8%, var(--surface));
    color: var(--accent);
    font: inherit;
    font-size: 12px;
    font-weight: 800;
    line-height: 1.2;
    cursor: pointer;
    transition: border-color 0.18s ease, background-color 0.18s ease, color 0.18s ease;
}

.generator-approved-result-pill:hover {
    border-color: var(--accent);
    background: var(--accent);
    color: #ffffff;
}

.generator-approved-result-pill:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

html[data-theme="dark"] .generator-approved-result-pill {
    border-color: color-mix(in srgb, var(--accent) 48%, var(--line));
    background: color-mix(in srgb, var(--accent) 14%, var(--surface));
    color: #b7b9ff;
}

html[data-theme="dark"] .generator-approved-result-pill:hover {
    background: var(--accent);
    color: #ffffff;
}

[assistantanalysis 񟿿]We need assess issue: first patch inserted before `?> <section` likely there are two `?>`? Anchor exact occurs near beginning after initial PHP. Good.

But major issue template insertion anchor is before script; output occurs after closing section and within generator structure branch? Let's inspect location: In source after `</section>` (structure tree), then `<?php ... $generatorEntityPreviewItems... ?>`, then script. Anchor script within else branch, so templates inserted there. Fine.

Potential undefined `$approvedPlotlines` if loader? exists. `$selectedStructureOption` only set if structure options query completed; variable can be undefined but null coalesce safe.

Potential selected structure loader query patch: selected option ID selected field now. Good.

But action pills only on generatorTab structure because tree code else? Let's understand: `<section ...>` and if generatorTab structure then status/actions; then tabs; if settings etc; `else` after illustrations leads structure tree for any not tabs. PIll inserted right before structure section, so yes structure only.

Need maybe display premise full text: if premise selected content is likely JSON, okay. But user asked "full text structure", likely format JSON displays fields. Fine.

Need ensure JS branch ordering: inserted before storyTrash after book chars branch? We inserted before storyTrash, after bookCharacters branch. It will be reached. Good.

But maybe `openTemplateModal` defined as const inside click handler before branch; yes.

Need likely add `data-text-navigation`? no.

Need check patch #1/2/3 maybe #2 inserted selectedStructureOption only inside if, but structureDecision status approved and structureOptions loaded only if job status completed. For approved decision job may status completed yes. Fine.

Need likely no need further. But we should perhaps request current file because patch after one? Rules say if patch applied successful no request. We can now give patches only; user asked act and continuation. We have done.

Wait developer says if user asks change code return only machine-readable patches, no text. Good.

But does patch format allow blank `[REPLACE]`? no issue.

Need perhaps syntax: insertion before `?>` with content includes `<?php` then `?>`, resulting existing `?>` after content? We replace anchor `?>\n<section` with content ending `?>\n<section`, fine. Great.

Potential `$generatorApprovedPremise` if `$premiseDecision` null. Good.

One problem `$generatorApprovedCharacters`: `$importedCharacters` includes approved and draft, filter. Fine.

Need maybe the user says patches #1 #2 #3 applied, which refer loader patches. Our patch is next. No need explain.

We should output exactly blocks no markdown. Done. But wait maybe patch [ACTION] insert_before with anchor only `?>\n<section` might match first after PHP but there may be another? Unique likely exact. Fine.

Let's consider if user's current patch applicator expects `[FILE]` path directly no code fence. yes.

No need include full file.

Could there be `data-generator-approved-result-title` naming and JS dataset returns `generatorApprovedResultTitle`, yes.

One issue modal templates inserted after `</section>` but there is an existing `<?php /* ... */ ?>` before `$generatorEntityPreviewItems`. Fine.

Potential all templates inside `else` branch, but pills also inside else. yes.

No more. final with patches..generator-character-generation-status {
    width: fit-content;
    padding: 10px 14px;
    border: 1px solid var(--line);
    border-radius: 9px;
    background: var(--surface-muted);
    color: var(--muted);
}

.generator-character-actions .button {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.character-modal-list {
    display: grid;
    gap: 14px;
}

.character-modal-card {
    padding: 15px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: var(--surface-muted);
}.character-modal-card > .character-modal-card {
    margin-top: 14px;
}

.character-modal-card h3 {
    margin: 0 0 8px;
    font-size: 16px;
    line-height: 1.4;
}

.character-modal-card > p {
    margin: 0;
    color: var(--muted);
    font-size: 13px;
    line-height: 1.5;
}

.character-modal-card-concept {
    margin-bottom: 12px !important;
}

.character-modal-members {
    display: grid;
    gap: 10px;
    margin: 12px 0;
}

.character-modal-member {
    padding-top: 10px;
    border-top: 1px solid var(--line);
}

.character-modal-member:first-child {
    padding-top: 0;
    border-top: 0;
}

.character-modal-member strong,
.character-modal-member span {
    display: block;
}

.character-modal-member span {
    margin-top: 3px;
    color: var(--muted);
    font-size: 12px;
    line-height: 1.45;
}

.character-modal-member p {
    margin: 5px 0 0;
    color: var(--muted);
    font-size: 13px;
    line-height: 1.45;
}

@media (max-width: 820px) {
    .generator-project-heading {
        align-items: flex-start;
        flex-wrap: wrap;
        gap: 10px;
        margin: 0 0 16px;
        padding: 18px 16px 0;
    }

    .generator-project-heading .generator-book-title {
        flex: 1 1 220px;
        font-size: 20px;
    }

    .generator-project-heading .project-publication-form {
        flex: 0 1 auto;
    }

    .generator-scroll-content > .generator-card-subtitle {
        padding-right: 16px;
        padding-left: 16px;
    }

    .generator-character-actions {
        padding: 0 16px;
    }

    .generator-character-actions .button {
        width: 100%;
        justify-content: center;
    }

    .generator-character-actions form {
        width: 100%;
    }
}@media (max-width: 820px) {
    .generator-character-actions .generator-character-generation-status {
        width: calc(100% + 32px);
        margin-right: -16px;
        margin-left: -16px;
        border-right: 0;
        border-left: 0;
        border-radius: 0;
    }
}@media (max-width: 820px) {
    .generator-scroll-content > .generator-character-generation-status,
    .generator-structure-status-slot > .generator-character-generation-status {
        display: flex;
        width: 100vw;
        max-width: 100vw;
        margin: 0;
        padding-right: 16px;
        padding-left: 16px;
        border-right: 0;
        border-left: 0;
        border-radius: 0;
    }
}

.generation-task-panel {
    display: grid;
    gap: 18px;
    padding: 20px;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: var(--surface);
}

.generation-task-panel.is-pending {
    border-color: #bbbdf9;
    box-shadow: 0 0 0 3px rgba(91, 92, 226, 0.08);
}

.generation-task-panel.is-success {
    border-color: #9bd8b7;
    background: var(--success-bg);
}

.generation-task-panel.is-error {
    border-color: #f0b3ad;
    background: var(--danger-bg);
}

.generation-task-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
}

.generation-task-eyebrow {
    margin: 0 0 5px;
    color: var(--muted);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.generation-task-header h2 {
    margin: 0;
    font-size: 20px;
}

.generation-task-status {
    flex: 0 0 auto;
    padding: 5px 9px;
    border-radius: 99px;
    background: var(--surface-muted);
    color: var(--muted);
    font-size: 12px;
    font-weight: 700;
}

.generation-task-panel.is-pending .generation-task-status {
    background: #efefff;
    color: var(--accent);
}

.generation-task-panel.is-success .generation-task-status {
    background: #d8f2e3;
    color: var(--success);
}

.generation-task-panel.is-error .generation-task-status {
    background: #ffe1de;
    color: var(--danger);
}

.generation-task-grid {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 10px;
}

.generation-task-item {
    min-width: 0;
    padding: 11px 12px;
    border: 1px solid var(--line);
    border-radius: 9px;
    background: var(--surface-muted);
}

.generation-task-item span {
    display: block;
    margin-bottom: 5px;
    color: var(--muted);
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
}

.generation-task-item strong {
    display: block;
    overflow-wrap: anywhere;
    color: var(--text);
    font-size: 13px;
    line-height: 1.45;
}

.generation-task-error {
    margin: 0;
    padding: 11px 12px;
    border-radius: 9px;
    background: var(--danger-bg);
    color: var(--danger);
    font-size: 13px;
    line-height: 1.5;
}

.generation-task-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.generation-task-footer p {
    margin: 0;
    color: var(--muted);
    font-size: 13px;
    line-height: 1.5;
}

.generation-task-footer form {
    flex: 0 0 auto;
}

.generator-placeholder {
    min-height: 220px;
}

.generator-card-subtitle {
    margin: 5px 0 0;
    color: var(--muted);
    font-size: 13px;
    line-height: 1.45;
}

.generator-tree {
    display: grid;
    gap: 12px;
}.generator-structure-options-tree {
    gap: 8px;
    justify-items: start;
}

.generator-structure-tree-root {
    width: fit-content;
    max-width: 100%;
    background: var(--surface-muted);
}

.generator-structure-options-branch {
    width: min(100%, 560px);
    gap: 6px;
    justify-self: start;
}

.generator-structure-option-node {
    position: relative;
    width: 100%;
    min-height: 40px;
    padding: 0;
    overflow: visible;
    border-radius: 9px;
}

.generator-structure-option-preview {
    display: flex;
    min-width: 0;
    min-height: 38px;
    flex: 1 1 auto;
    align-items: center;
    padding: 6px 10px;
    color: var(--text);
    text-decoration: none;
    cursor: pointer;
}

.generator-structure-option-preview:hover {
    background: var(--surface-muted);
}

.generator-structure-option-preview:focus-visible {
    position: relative;
    z-index: 1;
    outline: 2px solid var(--accent);
    outline-offset: -2px;
}.generator-structure-option-preview .generator-tree-node-main {
    gap: 7px;
}

.generator-structure-option-preview .generator-tree-node-type {
    font-size: 10px;
    letter-spacing: 0.045em;
}

.generator-structure-option-preview .generator-tree-node-main strong {
    font-size: 13px;
    line-height: 1.3;
}

.generator-structure-option-action-form {
    position: relative;
    display: flex;
    flex: 0 0 auto;
    align-items: center;
    align-self: stretch;
    margin: 0;
    padding: 0 6px;
    border-left: 1px solid var(--line);
}

.generator-structure-option-action {
    position: relative;
    display: inline-flex;
    width: 26px;
    height: 26px;
    min-height: 0;
    align-items: center;
    justify-content: center;
    padding: 0;
    border: 1px solid #c9cafd;
    border-radius: 7px;
    background: transparent;
    color: var(--accent);
    cursor: pointer;
    transition: border-color 0.15s ease, background 0.15s ease, color 0.15s ease;
}

.generator-structure-option-action svg {
    display: block;
    width: 14px;
    height: 14px;
    fill: none;
    stroke: currentColor;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 1.7;
}

.generator-structure-option-action:hover {
    border-color: var(--accent);
    background: var(--accent);
    color: #fff;
}

.generator-structure-option-action:focus-visible {
    position: relative;
    z-index: 1;
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

.generator-structure-option-action::after {
    position: absolute;
    z-index: 30;
    top: calc(100% + 8px);
    right: 0;
    bottom: auto;
    width: max-content;
    max-width: min(260px, 70vw);
    padding: 8px 10px;
    border-radius: 8px;
    background: #172033;
    color: #fff;
    content: attr(data-tooltip);
    font-size: 12px;
    font-weight: 400;
    line-height: 1.45;
    opacity: 0;
    pointer-events: none;
    text-align: left;
    transform: translateY(-4px);
    transition: opacity 0.15s ease, transform 0.15s ease, visibility 0s linear 0.2s;
    visibility: hidden;
    white-space: nowrap;
}

.generator-structure-option-action:hover::after,
.generator-structure-option-action:focus-visible::after {
    opacity: 1;
    transform: translateY(0);
    transition-delay: 0.2s;
    visibility: visible;
}

html[data-theme="dark"] .generator-structure-option-action {
    border-color: #6668d8;
    background: #25265a;
    color: #b7b9ff;
}

html[data-theme="dark"] .generator-structure-option-action:hover {
    border-color: #8b8df7;
    background: #5b5ce2;
    color: #fff;
}

.generator-tree-node {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    min-width: 0;
    padding: 13px 14px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: var(--surface);
}

.generator-tree-part {
    display: grid;
    gap: 10px;
    align-items: stretch;
    padding: 15px;
    background: var(--surface-muted);
}.generator-tree-part > .generator-tree-node-main {
    justify-content: center;
    padding: 4px 16px;
    text-align: center;
}

.generator-tree-part > .generator-tree-node-main .generator-tree-node-type {
    font-size: 13px;
}

.generator-tree-part > .generator-tree-node-main strong {
    font-size: 18px;
}

.generator-tree-node-main {
    display: flex;
    align-items: baseline;
    gap: 8px;
    min-width: 0;
}

.generator-tree-node-main strong {
    overflow-wrap: anywhere;
    font-size: 14px;
    line-height: 1.45;
}

.generator-tree-node-type {
    flex: 0 0 auto;
    color: var(--accent);
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.generator-tree-branch {
    display: grid;
    gap: 7px;
    margin-left: 18px;
    padding-left: 16px;
    border-left: 2px solid var(--line);
}

.generator-tree-chapter {
    background: var(--surface);
}.generator-tree-chapter.is-approved,
.generator-tree-detail.is-approved {
    border-color: #9bd8b7;
    background: var(--success-bg);
}

.generator-tree-chapter.is-approved .status {
    background: #d8f2e3;
    color: var(--success);
}

.generator-tree-chapter.is-pending,
.generator-tree-detail.is-pending {
    border-color: #bbbdf9;
}.generator-tree-plan.is-pending .status {
    background: #fff0cf;
    color: #9a5c00;
}

html[data-theme="dark"] .generator-tree-plan.is-pending .status {
    background: #513c15;
    color: #ffd078;
}

html[data-theme="kraft"] .generator-tree-plan.is-pending .status {
    background: #ead8b9;
    color: #815a25;
}

.generator-tree-details {
    display: grid;
    gap: 6px;
    margin-left: 18px;
    padding-left: 14px;
    border-left: 1px dashed var(--line);
}.generator-tree-drafts {
    margin-left: 8px;
}

.generator-tree-detail {
    display: grid;
    min-width: 0;
    gap: 6px;
    padding: 8px 10px;
    border-radius: 8px;
    background: var(--surface);
    color: var(--muted);
    font-size: 12px;
    line-height: 1.45;
}

.generator-tree-detail-header {
    display: flex;
    min-width: 0;
    align-items: baseline;
    gap: 8px;
}

.generator-tree-detail-header strong {
    min-width: 0;
    overflow-wrap: anywhere;
    color: var(--text);
    font-size: 13px;
}

.generator-tree-detail-header > .status {
    flex: 0 0 auto;
    margin-left: auto;
}.generator-tree-detail.is-generation-active {
    border-color: var(--accent);
    background: #f4f4ff;
    box-shadow: 0 0 0 2px rgba(91, 92, 226, 0.12);
}.generator-tree-chapter.is-generation-failed,
.generator-tree-detail.is-generation-failed {
    border-color: #f0b3ad;
    background: var(--danger-bg);
    box-shadow: 0 0 0 2px rgba(180, 35, 24, 0.1);
}/* Упавшая автоматическая задача определяется по доступному действию повтора у сцены. */
.generator-tree-detail:has(
    .generator-recommended-action-form input[name="action"][value="retry_scene_nuance"]
) {
    border-color: #f0b3ad;
    background: var(--danger-bg);
    box-shadow: 0 0 0 2px rgba(180, 35, 24, 0.1);
}

.generator-tree-generation-loader {
    display: inline-flex;
    flex: 0 0 auto;
    align-items: center;
    justify-content: center;
    margin-left: auto;
}

.generator-tree-detail-header > .generator-tree-generation-loader {
    margin-left: 0;
}

.generator-tree-detail.is-generation-active .status {
    background: #efefff;
    color: var(--accent);
}

html[data-theme="dark"] .generator-tree-detail.is-generation-active {
    border-color: #6668d8;
    background: #25265a;
}html[data-theme="dark"] .generator-tree-chapter.is-generation-failed,
html[data-theme="dark"] .generator-tree-detail.is-generation-failed {
    border-color: #93444b;
    background: #4a2024;
}.generator-recommended-action-form {
    position: relative;
    flex: 0 0 auto;
    margin-left: auto;
}

.generator-recommended-action {
    display: inline-flex;
    width: 25px;
    height: 25px;
    align-items: center;
    justify-content: center;
    padding: 0;
    border: 1px solid #bbbdf9;
    border-radius: 7px;
    background: #f9f9ff;
    color: var(--accent);
    font: inherit;
    font-size: 16px;
    font-weight: 800;
    line-height: 1;
    cursor: pointer;
}.generator-recommended-action-arrow {
    width: 30px;
    height: 30px;
    border-color: color-mix(in srgb, var(--accent) 42%, var(--line));
    border-radius: 8px;
    background: var(--surface);
}

.generator-recommended-action-arrow svg {
    display: block;
    width: 18px;
    height: 18px;
    fill: none;
    stroke: currentColor;
    stroke-linecap: square;
    stroke-linejoin: miter;
    stroke-width: 1.8;
}

.generator-recommended-action-arrow:hover {
    border-color: var(--accent);
    background: var(--accent);
    color: #ffffff;
}

.generator-recommended-action:hover {
    background: #efefff;
}

.generator-recommended-action::after {
    position: absolute;
    z-index: 30;
    right: 0;
    bottom: calc(100% + 8px);
    width: min(300px, 70vw);
    padding: 9px 10px;
    border-radius: 8px;
    background: #172033;
    color: #fff;
    content: attr(data-tooltip);
    font-size: 12px;
    font-weight: 400;
    line-height: 1.45;
    opacity: 0;
    pointer-events: none;
    text-align: left;
    transform: translateY(4px);
    transition: opacity 0.15s ease, transform 0.15s ease;
    visibility: hidden;
}

.generator-recommended-action:hover::after,
.generator-recommended-action:focus-visible::after {
    opacity: 1;
    transform: translateY(0);
    visibility: visible;
}

.generator-recommended-action:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

html[data-theme="dark"] .generator-recommended-action {
    border-color: #6668d8;
    background: #25265a;
    color: #b7b9ff;
}

.generator-tree-orphan-chapter {
    margin-left: 18px;
}

.generator-tree-orphan-details {
    margin-bottom: -3px;
}

.generator-empty-state {
    padding: 28px 20px;
    border: 1px dashed var(--line);
    border-radius: 10px;
    background: var(--surface-muted);
    text-align: center;
}

.generator-empty-state strong {
    display: block;
    margin-bottom: 7px;
    font-size: 15px;
}

.generator-empty-state p {
    margin: 0;
    color: var(--muted);
    font-size: 13px;
    line-height: 1.5;
}

.generation-status {
    margin: 0;
    color: var(--muted);
    font-size: 13px;
    line-height: 1.5;
}

.generation-status.error {
    color: var(--danger);
}

.generation-status.is-pending,
.navigator-action-note.is-pending {
    display: flex;
    align-items: center;
    gap: 8px;
}

.status-loader {
    display: inline-block;
    width: 14px;
    height: 14px;
    flex: 0 0 auto;
    border: 2px solid rgba(91, 92, 226, 0.22);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: button-loader-spin 0.7s linear infinite;
}

.navigator-toggle {
    display: none;
}

.navigator-heading {
    margin: 0 10px 22px;
    font-size: 18px;
}

.navigator-project {
    margin: -8px 10px 20px;
    color: var(--muted);
    font-size: 13px;
    line-height: 1.45;
}

.tree {
    display: grid;
    gap: 3px;
}

.tree-item,
.tree-part {
    padding: 9px 10px;
    border-radius: 8px;
    color: #46556b;
    font-size: 13px;
}

.tree-part {
    font-weight: 700;
}

.tree-chapters {
    display: grid;
    gap: 2px;
    margin-left: 12px;
    padding-left: 12px;
    border-left: 1px solid var(--line);
}

.tree-chapter {
    padding: 7px 8px;
    color: var(--muted);
    font-size: 13px;
}

/* В правом навигаторе остаётся компактная структура и состояние планирования. */
.sidebar-right .tree-chapter > form,
.sidebar-right .tree-chapter > details {
    display: none;
}

/* Кнопка после сообщения об ошибке повторно ставит план главы в очередь. */
.sidebar-right .tree-chapter > .navigator-action-note + form {
    display: inline-block;
    margin-top: 7px;
}

.sidebar-right .tree-chapter > .navigator-action-note + form .button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    padding: 0;
    border: 1px solid #bbbdf9;
    border-radius: 7px;
    background: #f9f9ff;
    color: transparent;
    font-size: 0;
    line-height: 1;
}

.sidebar-right .tree-chapter > .navigator-action-note + form .button::after {
    color: var(--accent);
    content: "↻";
    font-size: 17px;
    font-weight: 700;
}

.sidebar-right .tree-chapter > .navigator-action-note + form .button:hover {
    background: #efefff;
}

html[data-theme="dark"] .sidebar-right .tree-chapter > .navigator-action-note + form .button {
    border-color: #6668d8;
    background: #25265a;
}

html[data-theme="dark"] .sidebar-right .tree-chapter > .navigator-action-note + form .button::after {
    color: #b7b9ff;
}

/* Ручные формы и отображение сцен отключены до следующих этапов. */
.navigator-actions {
    display: grid;
    gap: 10px;
    margin: 26px 10px 0;
    padding-top: 20px;
    border-top: 1px solid var(--line);
}

.navigator-actions .button {
    width: 100%;
}

.navigator-task {
    display: grid;
    gap: 12px;
    margin: 0 10px;
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: 11px;
    background: var(--surface);
}

.navigator-task.is-pending {
    border-color: #bbbdf9;
    background: var(--surface-muted);
}

.navigator-task.is-success {
    border-color: #9bd8b7;
    background: var(--success-bg);
}

.navigator-task.is-error {
    border-color: #f0b3ad;
    background: var(--danger-bg);
}

.navigator-task-title {
    color: var(--text);
    font-size: 14px;
    font-weight: 800;
    line-height: 1.35;
}

.navigator-task-status {
    display: inline-flex;
    width: fit-content;
    align-items: center;
    gap: 6px;
    padding: 4px 8px;
    border-radius: 99px;
    background: var(--surface-muted);
    color: var(--muted);
    font-size: 11px;
    font-weight: 800;
}

.navigator-task-status .status-loader {
    width: 12px;
    height: 12px;
    flex-basis: 12px;
}

.navigator-task.is-pending .navigator-task-status {
    background: var(--surface);
    color: var(--accent);
}

.navigator-task.is-success .navigator-task-status {
    background: var(--surface);
    color: var(--success);
}

.navigator-task.is-error .navigator-task-status {
    background: var(--surface);
    color: var(--danger);
}

.navigator-task-details {
    display: grid;
    gap: 9px;
    margin: 0;
}

.navigator-task-details div {
    display: grid;
    gap: 3px;
}

.navigator-task-details dt {
    color: var(--muted);
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.navigator-task-details dd {
    margin: 0;
    color: var(--text);
    font-size: 12px;
    line-height: 1.45;
}

.navigator-task-error {
    margin: 0;
    color: var(--danger);
    font-size: 12px;
    line-height: 1.45;
}

.navigator-task-next {
    margin: 0;
    padding-top: 10px;
    border-top: 1px solid var(--line);
    color: var(--muted);
    font-size: 12px;
    line-height: 1.45;
}

.navigator-task .button,
.navigator-task .navigator-action-link {
    width: 100%;
}.navigator-structure-action {
    display: grid;
    gap: 8px;
    padding-top: 12px;
    border-top: 1px solid var(--line);
}

.navigator-structure-option-link {
    color: var(--accent);
    font-size: 13px;
    font-weight: 700;
    line-height: 1.45;
    text-decoration: underline;
    text-underline-offset: 3px;
}

.navigator-structure-option-link:hover {
    color: var(--accent-hover);
}

.navigator-structure-option-link:focus-visible {
    border-radius: 3px;
    outline: 2px solid var(--accent);
    outline-offset: 3px;
}button.navigator-structure-option-link {
    padding: 0;
    border: 0;
    background: transparent;
    font: inherit;
    text-align: left;
    cursor: pointer;
}.navigator-scene-action-group {
    display: grid;
    gap: 8px;
    padding-top: 12px;
    border-top: 1px solid var(--line);
}

.navigator-scene-action-title {
    margin: 0;
    color: var(--text);
    font-size: 13px;
    font-weight: 800;
    line-height: 1.45;
}.navigator-scene-action-title-preview {
    color: var(--accent);
    text-decoration: underline;
    text-underline-offset: 3px;
}

.navigator-scene-action-title-preview:hover {
    color: var(--accent-hover);
}

.navigator-scene-action-title-preview:focus-visible {
    border-radius: 3px;
    outline: 2px solid var(--accent);
    outline-offset: 3px;
}.navigator-scene-plan-link {
    color: var(--accent);
    font-size: 12px;
    font-weight: 700;
    line-height: 1.45;
    text-decoration: underline;
    text-underline-offset: 3px;
}

.navigator-scene-plan-link:hover {
    color: var(--accent-hover);
}

.navigator-scene-plan-link:focus-visible {
    border-radius: 3px;
    outline: 2px solid var(--accent);
    outline-offset: 3px;
}.navigator-action-note {
    margin: 0;
    color: var(--muted);
    font-size: 12px;
    line-height: 1.5;
}

.navigator-action-link {
    display: block;
    padding: 10px;
    border: 1px solid #bbbdf9;
    border-radius: 9px;
    background: #f9f9ff;
    color: var(--accent);
    font-size: 13px;
    font-weight: 700;
    text-align: center;
    text-decoration: none;
}

.navigator-action-link:hover {
    background: #efefff;
}

.navigator-catalog {
    display: grid;
    gap: 7px;
    margin: 0 10px;
}

.navigator-catalog-branch {
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: var(--surface-muted);
}

.navigator-catalog-branch > summary {
    display: flex;
    min-height: 40px;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 9px 11px;
    color: var(--text);
    cursor: pointer;
    font-size: 13px;
    font-weight: 700;
    line-height: 1.35;
    list-style: none;
}

.navigator-catalog-branch > summary::-webkit-details-marker {
    display: none;
}

.navigator-catalog-branch > summary::before {
    width: 7px;
    height: 7px;
    flex: 0 0 auto;
    margin-right: 2px;
    border-right: 1.5px solid currentColor;
    border-bottom: 1.5px solid currentColor;
    content: "";
    transform: rotate(-45deg);
    transition: transform 0.2s ease;
}

.navigator-catalog-branch[open] > summary::before {
    transform: rotate(45deg);
}

.navigator-catalog-branch > summary > span:first-of-type {
    min-width: 0;
    margin-right: auto;
    overflow-wrap: anywhere;
}

.navigator-catalog-count {
    display: inline-flex;
    min-width: 22px;
    min-height: 22px;
    flex: 0 0 auto;
    align-items: center;
    justify-content: center;
    padding: 3px 7px;
    border-radius: 99px;
    background: var(--surface);
    color: var(--muted);
    font-size: 11px;
    font-weight: 800;
}

.navigator-catalog-branch-content {
    display: grid;
    grid-template-rows: 0fr;
    padding: 0 10px;
    opacity: 0;
    transition: grid-template-rows 0.24s ease, padding 0.24s ease, opacity 0.18s ease;
}

.navigator-catalog-branch[open] > .navigator-catalog-branch-content {
    grid-template-rows: 1fr;
    padding: 0 10px 10px;
    opacity: 1;
}

.navigator-catalog-branch-content > * {
    min-height: 0;
    overflow: hidden;
}

.navigator-catalog-branch-nested {
    border-radius: 8px;
}

.navigator-catalog-branch-nested > summary {
    min-height: 36px;
    padding: 8px 9px;
    color: var(--muted);
    font-size: 12px;
}

.navigator-catalog-item {
    padding: 8px 10px;
    border-top: 1px solid var(--line);
    color: var(--muted);
    font-size: 12px;
    line-height: 1.45;
    overflow-wrap: anywhere;
}

.navigator-catalog-branch-content > .navigator-catalog-item:first-child {
    border-top: 0;
}.navigator-story-filter {
    display: grid;
    gap: 8px;
    margin: 0 10px;
}

.navigator-story-filter-branch {
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: var(--surface-muted);
}

.navigator-story-filter-branch > summary {
    display: flex;
    min-height: 40px;
    align-items: center;
    padding: 9px 11px;
    color: var(--text);
    cursor: pointer;
    font-size: 13px;
    font-weight: 800;
    line-height: 1.35;
    list-style: none;
}

.navigator-story-filter-branch > summary::-webkit-details-marker {
    display: none;
}

.navigator-story-filter-branch > summary::before {
    width: 7px;
    height: 7px;
    flex: 0 0 auto;
    margin-right: 9px;
    border-right: 1.5px solid currentColor;
    border-bottom: 1.5px solid currentColor;
    content: "";
    transform: rotate(-45deg);
    transition: transform 0.2s ease;
}

.navigator-story-filter-branch[open] > summary::before {
    transform: rotate(45deg);
}

.navigator-story-filter-options {
    display: grid;
    gap: 2px;
    padding: 0 9px 9px;
}

.navigator-story-filter-branch-nested {
    border-width: 1px 0 0;
    border-radius: 0;
    background: transparent;
}

.navigator-story-filter-branch-nested > summary {
    min-height: 34px;
    padding: 7px 2px;
    color: var(--muted);
    font-size: 12px;
}

.navigator-story-filter-branch-nested > summary::before {
    margin-right: 8px;
}

.navigator-story-filter-option {
    display: flex;
    min-width: 0;
    align-items: flex-start;
    gap: 8px;
    padding: 7px 4px;
    border-radius: 6px;
    color: var(--muted);
    cursor: pointer;
    font-size: 12px;
    line-height: 1.4;
}

.navigator-story-filter-option:hover {
    background: var(--surface);
    color: var(--text);
}

.navigator-story-filter-option input {
    width: auto;
    flex: 0 0 auto;
    margin: 2px 0 0;
    accent-color: var(--accent);
}

.navigator-story-filter-option span {
    min-width: 0;
    overflow-wrap: anywhere;
}.navigator-story-filter-count {
    display: inline-flex;
    min-width: 21px !important;
    min-height: 21px;
    flex: 0 0 auto;
    align-items: center;
    justify-content: center;
    margin-left: auto;
    padding: 2px 6px;
    border-radius: 99px;
    background: var(--surface);
    color: var(--muted);
    font-size: 10px;
    font-weight: 800;
    line-height: 1;
}

.navigator-story-filter-reset {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface);
    color: var(--accent);
    font: inherit;
    font-size: 12px;
    font-weight: 800;
    cursor: pointer;
}

.navigator-story-filter-reset:hover:not(:disabled) {
    border-color: var(--accent);
    background: var(--surface-muted);
}

.navigator-story-filter-reset:disabled {
    cursor: default;
    opacity: 0.5;
}.navigator-next-step {
    padding: 11px 12px;
    border-radius: 9px;
    background: var(--surface-muted);
    color: #536276;
    font-size: 13px;
    font-weight: 700;
    line-height: 1.45;
}

.tree-chapter a {
    color: inherit;
    text-decoration: none;
}

.tree-chapter a:hover {
    color: var(--accent);
}

.manuscript-body {
    margin: 0 auto;
    padding: 36px clamp(20px, 6vw, 72px);
    max-width: 900px;
}

.manuscript-cover {
    display: flex;
    min-height: 100%;
    align-items: center;
    justify-content: center;
}

.manuscript-cover img {
    display: block;
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}.manuscript-chapter {
    scroll-margin-top: 24px;
}

.manuscript-chapter + .manuscript-chapter {
    margin-top: 48px;
}

.manuscript-chapter h2 {
    margin: 0 0 28px;
    font-size: 21px;
    line-height: 1.35;
}

.manuscript-scene {
    scroll-margin-top: 24px;
    color: var(--text);
    font-family: Georgia, "Times New Roman", serif;
    font-size: 18px;
    line-height: 1.65;
}

.manuscript-scene + .manuscript-scene {
    margin-top: 28px;
}

.manuscript-scene p {
    margin: 0 0 8px;
    text-indent: 1.2em;
}

.manuscript-scene p:last-child {
    margin-bottom: 0;
}

.manuscript-scene .manuscript-scene-missing {
    color: var(--danger);
    font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    font-size: 13px;
    font-weight: 700;
    line-height: 1.5;
    text-indent: 0;
}

.manuscript-part-divider {
    margin: 56px 0;
    color: var(--muted);
    font-family: Georgia, "Times New Roman", serif;
    font-size: 20px;
    letter-spacing: 0.18em;
    text-align: center;
}@media (min-width: 821px) {
    .sidebar:not(.sidebar-right) {
        position: sticky;
        top: 0;
        align-self: start;
        height: 100vh;
        overflow-y: auto;
    }
}

.page-header {
    position: sticky;
    z-index: 10;
    top: 0;
    margin: -32px -32px 20px;
    padding: 20px 32px 14px;
    background: var(--bg);
}

@media (min-width: 821px) {
    .sidebar-right {
        align-self: start;
    }
}@media (min-width: 821px) {
    .sidebar-right {
        position: sticky;
        top: 0;
        height: 100vh;
        overflow-y: auto;
    }
}/* Адаптивное поведение сайдбаров определено в dashboard-sidebar.css. */

.terms-content {
    max-width: 920px;
    color: var(--text);
}

.terms-content h3 {
    margin: 28px 0 9px;
    font-size: 17px;
    line-height: 1.4;
}

.terms-content h3:first-child {
    margin-top: 0;
}

.terms-content p {
    margin: 0;
    color: var(--muted);
    font-size: 14px;
    line-height: 1.65;
}.tariffs-card {
    width: 100%;
    max-width: 1040px;
}.tariffs-workspace {
    padding-top: 0;
    overflow-y: auto;
}

.tariffs-workspace > .page-header {
    margin-top: 0;
}

.tariffs-workspace .tariffs-card,
.tariffs-workspace .legal-footer {
    flex-shrink: 0;
}

.tariffs-workspace .legal-footer {
    margin-top: 24px;
}

.tariffs-sidebar {
    display: grid;
    align-content: start;
    gap: 12px;
}

.tariffs-sidebar .navigator-heading {
    margin-bottom: 6px;
}

.tariffs-sidebar .navigator-project {
    margin-bottom: 8px;
}

.tariffs-sidebar-card {
    display: grid;
    gap: 9px;
    margin: 0 10px;
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: 11px;
    background: var(--surface-muted);
}

.tariffs-sidebar-card h3,
.tariffs-sidebar-card p {
    margin: 0;
}

.tariffs-sidebar-card h3 {
    color: var(--text);
    font-size: 14px;
    line-height: 1.4;
}

.tariffs-sidebar-card p {
    color: var(--muted);
    font-size: 12px;
    line-height: 1.55;
}

.tariffs-sidebar-balance {
    color: var(--accent) !important;
    font-size: 20px !important;
    font-weight: 800;
}

.tariffs-sidebar-card .navigator-action-link {
    margin-top: 2px;
}.tariffs-sidebar-card-featured {
    position: relative;
    gap: 11px;
    overflow: hidden;
    padding: 18px;
    border-color: color-mix(in srgb, var(--accent) 28%, var(--line));
    background:
        radial-gradient(
            circle at 100% 0,
            color-mix(in srgb, var(--accent) 14%, transparent) 0,
            transparent 48%
        ),
        var(--surface-muted);
    box-shadow: 0 10px 24px color-mix(in srgb, var(--accent) 8%, transparent);
}

.tariffs-sidebar-card-featured::before {
    position: absolute;
    top: 0;
    right: 18px;
    left: 18px;
    height: 3px;
    border-radius: 0 0 99px 99px;
    background: var(--accent);
    content: "";
}

.tariffs-sidebar-card-featured h3 {
    font-size: 15px;
    line-height: 1.45;
}

.tariffs-sidebar-card-featured p {
    font-size: 13px;
    line-height: 1.6;
}

.tariffs-sidebar-eyebrow {
    margin-top: 4px;
    color: var(--accent);
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 0.08em;
    line-height: 1.4;
    text-transform: uppercase;
}

.tariffs-card .card-body {
    padding: 0;
}

.tariffs-table-wrap {
    width: 100%;
    overflow-x: auto;
}

.tariffs-table {
    width: 100%;
    min-width: 560px;
    border-collapse: collapse;
    table-layout: fixed;
}

.tariffs-table th,
.tariffs-table td {
    padding: 14px 20px;
    border-bottom: 1px solid var(--line);
    text-align: left;
    vertical-align: middle;
}

.tariffs-table th {
    background: var(--surface-muted);
    color: var(--muted);
    font-size: 12px;
    font-weight: 700;
}

.tariffs-table th:last-child,
.tariffs-table td:last-child {
    width: 160px;
}

.tariffs-table tbody tr:last-child td {
    border-bottom: 0;
}

.tariffs-table tbody tr:hover {
    background: var(--surface-muted);
}

.tariff-name {
    color: var(--text);
    font-size: 14px;
    font-weight: 600;
    line-height: 1.45;
}

.tariff-cost {
    white-space: nowrap;
}

.tariff-cost-value {
    display: inline-flex;
    min-width: 104px;
    min-height: 40px;
    align-items: center;
    justify-content: center;
    padding: 8px 13px;
    border: 1px solid var(--line);
    border-radius: 9px;
    background: var(--surface-muted);
    color: var(--accent);
    font-size: 14px;
    font-weight: 800;
    line-height: 1;
}

@media (max-width: 820px) {
    .tariffs-card {
        width: 100%;
    }
}

@media (max-width: 480px) {
    .tariffs-card {
        border-right: 0;
        border-left: 0;
        border-radius: 0;
    }

    .tariffs-table th,
    .tariffs-table td {
        padding: 12px 16px;
    }

    .tariffs-table th:last-child,
    .tariffs-table td:last-child {
        width: 136px;
    }

    .tariff-name {
        font-size: 13px;
    }

    .tariff-cost-value {
        min-width: 88px;
    }
}@media (max-width: 820px) {
    .generator-tabs {
        overflow-x: auto;
    }

    .generator-tab {
        min-width: 120px;
        white-space: nowrap;
    }

    .generation-task-header,
    .generation-task-footer {
        align-items: flex-start;
        flex-direction: column;
    }

    .generation-task-grid {
        grid-template-columns: 1fr 1fr;
    }

    .generator-tree-node-main {
        align-items: baseline;
        flex-flow: row wrap;
        gap: 8px;
    }

    .generator-tree-branch,
    .generator-tree-orphan-chapter {
        margin-left: 8px;
        padding-left: 10px;
    }
}

@media (max-width: 480px) {
    .generation-task-grid {
        grid-template-columns: 1fr;
    }

    .generation-task-panel,
    .card-body {
        padding: 16px;
    }
}@media (min-width: 1181px) {
    .app {
        display: grid;
        grid-template-columns: var(--sidebar-width) minmax(0, 1fr) var(--navigator-width);
    }

    .workspace {
        min-width: 0;
    }

    .sidebar-right {
        display: block;
        position: fixed;
        z-index: 20;
        top: 0;
        right: 0;
        bottom: 0;
        left: auto;
        width: var(--navigator-width);
        height: 100vh;
        overflow-y: auto;
        visibility: visible;
    }
}.legal-footer {
    flex: 0 0 auto;
    margin-top: auto;
    padding: 18px 20px 24px;
    border-top: 1px solid var(--line);
    color: var(--muted);
    font-size: 11px;
    line-height: 1.55;
}

.legal-footer-details {
    display: flex;
    flex-wrap: wrap;
    gap: 4px 12px;
}

.legal-footer-details span,
.legal-footer-details a {
    overflow-wrap: anywhere;
}

.legal-footer-details a {
    color: inherit;
}@media (max-width: 820px) {
    .book-generator {
        gap: 0;
        margin-top: -20px;
    }

    .generator-tabs {
        position: sticky;
        z-index: 11;
        top: 0;
        width: 100%;
        gap: 0;
        padding: 0;
        border-right: 0;
        border-left: 0;
        border-radius: 0;
    }

    .generator-tab {
        border-radius: 0;
    }

    .generator-tree-chapter {
        width: 100%;
        justify-self: stretch;
        border-right: 0;
        border-left: 0;
        border-radius: 0;
    }

    .generator-structure {
        border-right: 0;
        border-left: 0;
        border-radius: 0;
    }

    .generator-structure .card-body {
        padding-right: 0;
        padding-left: 0;
    }

    .generator-tree-part {
        padding-right: 0;
        padding-left: 0;
    }

    .generator-tree-part > .generator-tree-node-main {
        padding-right: 16px;
        padding-left: 16px;
    }

    .generator-tree-details {
        width: calc(100% - 10px);
        max-width: calc(100% - 10px);
        margin-left: 10px;
        padding-left: 0;
    }

    .generator-tree-orphan-chapter {
        width: calc(100% - 8px);
    }.generator-tree-part,
    .generator-tree-part > .generator-tree-branch > .generator-tree-chapter {
        width: 100%;
        max-width: 100%;
        justify-self: stretch;
    }

    .generator-tree-part > .generator-tree-branch > .generator-tree-details {
        width: calc(100% - 10px);
        max-width: calc(100% - 10px);
        justify-self: stretch;
    }

    .generator-tree,
    .generator-tree-part,
    .generator-tree-branch,
    .generator-tree-details {
        grid-template-columns: minmax(0, 1fr);
    }.generator-tree-part > .generator-tree-branch {
        width: 100%;
        max-width: 100%;
        margin-left: 0;
        padding-left: 0;
        border-left: 0;
        justify-self: stretch;
    }
}@media (max-width: 1180px) {
    html,
    body {
        width: 100%;
        min-width: 0;
        max-width: 100%;
        margin: 0;
        overflow-x: hidden;
    }

    .app {
        display: block;
        width: 100%;
        min-width: 0;
        max-width: 100%;
    }

    .app > .workspace {
        position: static;
        display: flex;
        width: 100%;
        min-width: 0;
        height: 100dvh;
        max-width: 100%;
        flex-direction: column;
        margin: 0;
        grid-column: auto;
        grid-row: auto;
    }

    .app > .workspace > .content-grid {
        display: grid;
        width: 100%;
        min-width: 0;
        max-width: 100%;
        grid-template-columns: minmax(0, 1fr);
    }

    .app > .workspace > .content-grid > .card,
    .stories-grid,
    .story-card {
        width: 100%;
        min-width: 0;
        max-width: 100%;
    }

    .stories-grid {
        grid-template-columns: minmax(0, 1fr);
    }

    .page-header {
        align-items: stretch;
        flex-direction: column;
    }

    .page-header > div:first-child {
        min-width: 0;
    }

    .page-header h1,
    .page-header .subtitle {
        overflow-wrap: anywhere;
    }

    .header-actions {
        display: grid;
        width: 100%;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 8px;
    }

    .header-actions > form,
    .header-actions > a,
    .header-actions > button {
        min-width: 0;
    }

    .header-actions > form:not(.ai-model-switch) .theme-toggle,
    .header-actions > .theme-toggle {
        display: inline-flex;
        width: 100%;
        min-height: 42px;
        align-items: center;
        justify-content: center;
        white-space: normal;
        text-align: center;
    }

    .header-actions .ai-model-switch {
        grid-column: 1 / -1;
        min-width: 0;
        justify-content: space-between;
    }
}

@media (max-width: 820px) {
    .brand {
        margin: 0 0 16px;
    }

    .menu {
        grid-template-columns: repeat(3, minmax(0, 1fr));
        margin-bottom: 0;
    }

    .menu-title {
        display: none;
    }

    .workspace {
        padding: 20px 0;
    }

    .page-header {
        gap: 12px;
        margin: -20px 0 20px;
        padding: 20px 14px 14px;
    }

    .page-header-subtitle-row {
        align-items: flex-start;
        gap: 10px;
    }

    .page-header-subtitle-row .subtitle {
        flex: 1 1 auto;
        min-width: min(100%, 220px);
    }

    .page-header-subtitle-row .project-publication-form {
        flex: 0 1 auto;
    }

    .projects {
        grid-template-columns: minmax(0, 1fr);
    }

    .user-chip {
        display: none;
    }
}.book-illustration-settings-grid,
.book-illustration-generation-options {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 14px;
}

.book-illustration-settings-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    margin-bottom: 18px;
}

.book-illustration-settings-grid .form-field.full-width {
    grid-column: 1 / -1;
}.book-illustration-reference-style-picker {
    grid-column: 1 / -1;
    margin: 0 0 4px;
}

.book-illustration-reference-style-picker:disabled {
    opacity: 0.52;
}

.book-illustration-reference-style-picker:disabled .book-illustration-style-option {
    cursor: not-allowed;
}

.reference-dropzone {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 140px;
    padding: 20px;
    border: 2px dashed var(--line);
    border-radius: 12px;
    background: var(--surface-muted);
    cursor: pointer;
    transition: border-color 0.2s ease, background-color 0.2s ease;
    outline: none;
}

.reference-dropzone:hover,
.reference-dropzone:focus-visible,
.reference-dropzone.drag-over {
    border-color: var(--accent);
    background: color-mix(in srgb, var(--accent) 5%, var(--surface-muted));
}

.reference-dropzone.has-file {
    padding: 12px;
    border-style: solid;
    border-color: var(--line);
    cursor: default;
}

.dropzone-empty-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 8px;
}

.dropzone-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: color-mix(in srgb, var(--accent) 10%, var(--surface));
    color: var(--accent);
}

.dropzone-text strong {
    display: block;
    font-size: 14px;
    color: var(--text);
}

.dropzone-text span {
    font-size: 12px;
    color: var(--muted);
}

.dropzone-hint {
    font-size: 11px;
    color: var(--muted);
    opacity: 0.8;
}

.dropzone-preview-content {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

.dropzone-preview-content img {
    max-width: 100%;
    max-height: 220px;
    border-radius: 8px;
    object-fit: contain;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.dropzone-remove-btn {
    position: absolute;
    top: -10px;
    right: -10px;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border: 1px solid var(--line);
    border-radius: 50%;
    background: var(--surface);
    color: var(--text);
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    transition: background 0.15s ease, color 0.15s ease, transform 0.15s ease;
}

.dropzone-remove-btn:hover {
    background: var(--danger);
    color: #ffffff;
    border-color: var(--danger);
    transform: scale(1.1);
}

.book-illustration-generation-form {
    display: grid;
    gap: 18px;
}

.book-illustration-style-picker {
    min-width: 0;
    margin: 0;
    padding: 0;
    border: 0;
}

.book-illustration-style-picker legend {
    margin-bottom: 9px;
    color: #4b5a70;
    font-size: 13px;
    font-weight: 700;
}

.book-illustration-style-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(215px, 1fr));
    gap: 10px;
}

.book-illustration-style-option {
    position: relative;
    display: flex;
    min-width: 0;
    align-items: center;
    gap: 10px;
    padding: 10px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: var(--surface-muted);
    cursor: pointer;
}

.book-illustration-style-option:has(input:checked) {
    border-color: var(--accent);
    box-shadow: 0 0 0 2px rgba(91, 92, 226, 0.12);
}

.book-illustration-style-option > input {
    width: auto;
    flex: 0 0 auto;
}

.book-illustration-style-option > img {
    width: 42px;
    height: 42px;
    flex: 0 0 auto;
    border-radius: 7px;
    object-fit: cover;
}

.book-illustration-style-option > span:not(.book-illustration-style-preview) {
    display: grid;
    min-width: 0;
    gap: 3px;
}

.book-illustration-style-option strong,
.book-illustration-style-option small {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.book-illustration-style-option strong {
    font-size: 13px;
}

.book-illustration-style-option small {
    color: var(--muted);
    font-size: 11px;
}

.book-illustration-style-preview {
    position: absolute;
    z-index: 35;
    right: 8px;
    bottom: calc(100% + 8px);
    display: block;
    width: min(320px, 70vw);
    padding: 6px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: var(--surface);
    box-shadow: 0 16px 34px rgba(23, 32, 51, 0.22);
    opacity: 0;
    pointer-events: none;
    transform: translateY(4px);
    transition: opacity 0.15s ease, transform 0.15s ease, visibility 0s linear 0.2s;
    visibility: hidden;
}

.book-illustration-style-preview img {
    display: block;
    width: 100%;
    border-radius: 6px;
}

.book-illustration-style-option:has(> img:hover) .book-illustration-style-preview {
    opacity: 1;
    transform: translateY(0);
    transition-delay: 0.2s, 0.2s, 0s;
    visibility: visible;
}

.book-illustration-tree {
    display: grid;
    gap: 16px;
}

.book-illustration-tree-section {
    display: grid;
    gap: 9px;
}

.book-illustration-tree-section > h3,
.book-illustration-target-history > h3 {
    margin: 0;
    font-size: 15px;
}

.book-illustration-part {
    display: grid;
    gap: 9px;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: var(--surface-muted);
}

.book-illustration-part > strong {
    font-size: 13px;
}

.book-illustration-target {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 10px;
    padding: 11px;
    border: 1px solid var(--line);
    border-radius: 9px;
    background: var(--surface);
}

.book-illustration-scene {
    margin-left: 20px;
    background: var(--surface-muted);
}

.book-illustration-target-main {
    display: flex;
    min-width: 0;
    align-items: flex-start;
    gap: 9px;
    cursor: pointer;
}

.book-illustration-target-main input {
    width: auto;
    flex: 0 0 auto;
    margin-top: 2px;
}

.book-illustration-target-main span {
    display: grid;
    min-width: 0;
    gap: 3px;
}

.book-illustration-target-main strong {
    overflow-wrap: anywhere;
    font-size: 13px;
    line-height: 1.4;
}

.book-illustration-target-main small {
    color: var(--muted);
    font-size: 11px;
    line-height: 1.4;
}

.book-illustration-target-actions {
    display: flex;
    align-items: center;
    gap: 7px;
}

.book-illustration-target-actions .button {
    padding: 7px 10px;
    font-size: 12px;
}

.book-illustration-history {
    display: grid;
    grid-column: 1 / -1;
    grid-template-columns: repeat(auto-fill, minmax(132px, 1fr));
    gap: 8px;
}

.book-illustration-variant {
    position: relative;
    overflow: visible;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface-muted);
}

.book-illustration-variant.is-selected {
    border-color: var(--success);
    box-shadow: 0 0 0 2px rgba(22, 128, 77, 0.13);
}

.book-illustration-variant.is-outdated {
    opacity: 0.62;
}

.book-illustration-variant.is-failed {
    border-color: #f0b3ad;
}

.book-illustration-variant > img {
    display: block;
    width: 100%;
    aspect-ratio: 1 / 1;
    border-radius: 7px 7px 0 0;
    object-fit: contain;
    background: var(--surface-muted);
}

.book-illustration-variant-preview {
    position: absolute;
    z-index: 1000;
    top: auto;
    right: 50%;
    bottom: calc(100% + 8px);
    display: block;
    width: min(320px, 70vw);
    padding: 6px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: var(--surface);
    box-shadow: 0 16px 34px rgba(23, 32, 51, 0.22);
    opacity: 0;
    pointer-events: none;
    transform: translate(50%, 4px);
    transition: opacity 0.15s ease, transform 0.15s ease, visibility 0s linear 0.2s;
    visibility: hidden;
}

.book-illustration-variant-preview img {
    display: block;
    width: 100%;
    max-height: min(560px, 70vh);
    border-radius: 6px;
    object-fit: contain;
}

.book-illustration-variant:has(> img:hover) > .book-illustration-variant-preview {
    opacity: 1;
    transform: translate(50%, 0);
    transition-delay: 0.2s, 0.2s, 0s;
    visibility: visible;
}

.book-illustration-variant-loader,
.book-illustration-variant-error,
.book-illustration-variant-placeholder,
.book-illustration-empty-slot {
    display: grid;
    min-height: 94px;
    place-items: center;
    padding: 10px;
    color: var(--muted);
    font-size: 11px;
    line-height: 1.4;
    text-align: center;
}

.book-illustration-variant-loader {
    gap: 8px;
}

.book-illustration-variant-error {
    color: var(--danger);
}

.book-illustration-variant-meta {
    display: grid;
    gap: 5px;
    padding: 7px;
}

.book-illustration-variant-meta .status {
    width: fit-content;
    margin: 0;
}

.book-illustration-variant-meta strong,
.book-illustration-variant-meta p {
    margin: 0;
    font-size: 11px;
    line-height: 1.4;
}

.book-illustration-variant-meta p {
    color: var(--danger);
}

.book-illustration-empty-slot {
    grid-column: 1 / -1;
    min-height: 70px;
    border: 1px dashed var(--line);
    border-radius: 8px;
    background: var(--surface-muted);
}

.book-illustration-empty-slot span {
    width: 24px;
    height: 24px;
    border: 2px solid var(--line);
    border-radius: 7px;
}

.book-illustration-unavailable {
    margin-bottom: 14px;
    padding: 10px 12px;
    border-radius: 9px;
    background: var(--danger-bg);
    color: var(--danger);
    font-size: 13px;
    line-height: 1.45;
}

.book-illustration-target-history {
    display: grid;
    gap: 10px;
    margin-top: 18px;
}

.book-illustration-batch-list {
    display: grid;
    gap: 10px;
}

.book-illustration-batch {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px 14px;
    padding: 13px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: var(--surface-muted);
}

.book-illustration-batch p,
.book-illustration-batch small,
.book-illustration-batch-error {
    margin: 4px 0 0;
    color: var(--muted);
    font-size: 12px;
    line-height: 1.45;
}

.book-illustration-batch .status {
    width: fit-content;
    height: fit-content;
    margin: 0;
}

.book-illustration-progress {
    grid-column: 1 / -1;
    overflow: hidden;
    height: 7px;
    border-radius: 99px;
    background: #e3e8f0;
}

.book-illustration-progress span {
    display: block;
    height: 100%;
    border-radius: inherit;
    background: var(--accent);
    transition: width 0.25s ease;
}

.book-illustration-batch-error {
    grid-column: 1 / -1;
    color: var(--danger);
}

html[data-theme="dark"] .book-illustration-style-option,
html[data-theme="dark"] .book-illustration-part,
html[data-theme="dark"] .book-illustration-variant,
html[data-theme="dark"] .book-illustration-target {
    background: var(--surface-muted);
}

@media (max-width: 820px) {
    .book-illustration-settings,
    .book-illustration-cover,
    .book-illustration-internal,
    .book-illustration-batches {
        border-right: 0;
        border-left: 0;
        border-radius: 0;
    }.book-illustration-cover {
    overflow: visible;
}

    .book-illustration-settings-grid,
    .book-illustration-generation-options {
        grid-template-columns: 1fr;
    }

    .book-illustration-reference-preview {
        grid-row: auto;
    }

    .book-illustration-target {
        grid-template-columns: minmax(0, 1fr);
    }

    .book-illustration-target-actions {
        justify-content: space-between;
    }

    .book-illustration-scene {
        margin-left: 10px;
    }
}@media (max-width: 820px) {
    .generator-structure-options-tree {
        justify-items: stretch;
    }

    .generator-structure-tree-root {
        width: 100%;
    }

    .generator-structure-options-branch {
        width: 100%;
        margin-left: 10px;
        padding-left: 10px;
        border-left: 1px solid var(--line);
    }

    .generator-structure-option-node {
        width: 100%;
    }
}/* Компактные узлы вариантов переопределяют базовые размеры дерева, объявленные выше. */
.generator-structure-tree-root {
    padding: 0;
}

.generator-structure-tree-root-preview {
    display: flex;
    min-width: 0;
    min-height: 38px;
    align-items: center;
    padding: 7px 10px;
    border-radius: inherit;
    color: var(--text);
    text-decoration: none;
    cursor: pointer;
}.generator-structure-tree-root {
    width: 100%;
    justify-self: stretch;
}

.generator-structure-tree-root-preview {
    display: grid;
    width: 100%;
    grid-template-columns: minmax(0, 1fr);
    justify-items: center;
    text-align: center;
}

.generator-structure-tree-root-preview .generator-tree-node-main {
    width: fit-content;
    max-width: 100%;
    justify-content: center;
    text-align: center;
}

.generator-structure-tree-root-preview .generator-tree-node-main strong {
    flex: 0 1 auto;
}

.generator-structure-tree-root-preview .generator-tree-node-type {
    display: none;
}

.generator-structure-tree-root-preview .generator-tree-node-main strong {
    font-size: 20px;
    text-align: center;
}

.generator-structure-tree-root-preview:hover {
    background: var(--surface-muted);
}

.generator-structure-tree-root-preview:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: -2px;
}

.generator-structure-option-node {
    min-height: 38px;
    gap: 0;
    padding: 0;
    overflow: visible;
}.generator-structure-option-node.is-selection-pending {
    opacity: 0.45;
}

.generator-structure-option-node.is-selection-pending .generator-structure-option-action {
    cursor: not-allowed;
}

.generator-structure-option-action:disabled,
.generator-structure-option-action.is-loading {
    cursor: wait;
    opacity: 0.55;
    pointer-events: none;
}

.generator-structure-option-action.is-loading svg {
    display: none;
}

.generator-structure-option-action .button-loader {
    display: block;
    width: 14px;
    height: 14px;
    margin: 0;
    border-color: currentColor;
    border-top-color: transparent;
}

.generator-structure-option-action::after {
    content: none;
}

.dashboard-tooltip {
    position: fixed;
    z-index: 300;
    width: max-content;
    max-width: min(260px, calc(100vw - 20px));
    padding: 8px 10px;
    border-radius: 8px;
    background: #172033;
    box-shadow: 0 8px 20px rgba(23, 32, 51, 0.18);
    color: #fff;
    font-size: 12px;
    font-weight: 400;
    line-height: 1.45;
    pointer-events: none;
    white-space: nowrap;
}

.dashboard-tooltip[hidden] {
    display: none;
}

.cookie-notice {
    position: fixed;
    z-index: 1100;
    right: 24px;
    bottom: 24px;
    display: flex;
    width: min(460px, calc(100vw - 48px));
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    padding: 16px 18px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: var(--surface);
    box-shadow: 0 16px 38px rgba(23, 32, 51, 0.2);
    color: var(--text);
}

.cookie-notice[hidden] {
    display: none;
}

.cookie-notice p {
    margin: 0;
    font-size: 13px;
    line-height: 1.5;
}

.cookie-notice-button {
    flex: 0 0 auto;
    padding: 9px 13px;
    border: 0;
    border-radius: 8px;
    background: var(--accent);
    color: #ffffff;
    font: inherit;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
}

.cookie-notice-button:hover {
    background: var(--accent-hover);
}

@media (max-width: 600px) {
    .cookie-notice {
        right: 16px;
        bottom: 16px;
        width: calc(100vw - 32px);
        align-items: stretch;
        flex-direction: column;
        gap: 12px;
        padding: 15px 16px;
    }

    .cookie-notice-button {
        width: 100%;
    }
}@media (max-width: 820px) {
    .generator-structure-tree-root,
    .generator-structure-option-node {
        border-right: 0;
        border-left: 0;
        border-radius: 0;
    }.generator-structure-option-action-form {
        padding-right: 20px;
    }

    .generator-structure-options-branch {
        position: relative;
        width: 100%;
        margin-left: 0;
        padding-left: 0;
        border-left: 0;
    }

    .generator-structure-options-branch::before {
        position: absolute;
        z-index: 2;
        top: 0;
        bottom: 0;
        left: 10px;
        width: 1px;
        background: var(--line);
        content: "";
        pointer-events: none;
    }

    .generator-structure-option-preview {
        min-height: 38px;
        padding: 6px 10px 6px 28px;
    }.generator-structure-option-node {
        flex-wrap: nowrap;
    }

    .generator-structure-option-preview {
        width: calc(100% - 74px);
        min-width: 0;
        flex: 0 1 calc(100% - 74px);
    }

    .generator-structure-option-action-form {
        width: 59px;
        min-width: 59px;
        padding-right: 5px;
        padding-left: 6px;
    }.generator-structure-option-node > .generator-tree-generation-loader {
        width: 59px;
        min-width: 59px;
        align-self: stretch;
        justify-content: flex-start;
        margin-left: 0;
        padding: 0 5px 0 6px;
        border-left: 1px solid var(--line);
    }.generator-structure-option-node > .generator-tree-generation-loader > .status-loader {
        margin-left: 6px;
    }

    .generator-structure-option-preview .generator-tree-node-main {
        min-width: 0;
        flex: 1 1 auto;
        flex-wrap: nowrap;
        overflow: hidden;
    }

    .generator-structure-option-preview .generator-tree-node-type {
        flex: 0 0 auto;
    }

    .generator-structure-option-preview .generator-tree-node-main strong {
        min-width: 0;
        flex: 1 1 auto;
        overflow: hidden;
        text-overflow: clip;
        white-space: nowrap;
        -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 28px), transparent 100%);
        mask-image: linear-gradient(to right, #000 calc(100% - 28px), transparent 100%);
    }.generator-tree-detail-header {
        align-items: flex-start;
        flex-wrap: wrap;
    }

    .generator-tree-detail-header > strong {
        flex: 1 1 120px;
    }

    .generator-tree-plans,
    .generator-tree-drafts {
        min-width: 0;
    }

    .generator-tree-plan,
    .generator-tree-draft {
        width: 100%;
    }.generator-tree-chapter {
        flex-wrap: nowrap;
    }

    .generator-tree-chapter .generator-tree-node-main {
        min-width: 0;
        flex: 1 1 auto;
        flex-wrap: nowrap;
        overflow: hidden;
    }

    .generator-tree-chapter .generator-tree-node-type {
        flex: 0 0 auto;
    }

    .generator-tree-chapter .generator-tree-node-main strong {
        min-width: 0;
        flex: 1 1 auto;
        overflow: hidden;
        text-overflow: clip;
        white-space: nowrap;
        -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 28px), transparent 100%);
        mask-image: linear-gradient(to right, #000 calc(100% - 28px), transparent 100%);
    }

    .generator-tree-chapter > .status,
    .generator-tree-chapter > .generator-recommended-action-form {
        flex: 0 0 auto;
    }
}/* Специальные переопределения витрины сюжетов в dashboard.css не используются. *//* Все нативные модальные окна получают визуальное отделение от основного контента. */
dialog {
    border: 1px solid var(--line);
    box-shadow: 0 24px 60px rgba(23, 32, 51, 0.3);
}html[data-theme="dark"] dialog,
html[data-theme="dark"] .auth-modal {
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.62);
}

.range-label-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.range-value-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 28px;
    height: 24px;
    padding: 0 8px;
    border-radius: 99px;
    background: color-mix(in srgb, var(--accent) 12%, var(--surface-muted));
    color: var(--accent);
    font-size: 13px;
    font-weight: 800;
    line-height: 1;
}

input[type="range"].custom-range-slider {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 8px;
    margin: 8px 0 4px;
    padding: 0;
    border: 0;
    border-radius: 99px;
    background: var(--line);
    outline: none;
    cursor: pointer;
    transition: background-color 0.18s ease;
}

input[type="range"].custom-range-slider:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 4px;
}

input[type="range"].custom-range-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 22px;
    height: 22px;
    border: 2px solid var(--surface);
    border-radius: 50%;
    background: var(--accent);
    box-shadow: 0 3px 8px color-mix(in srgb, var(--accent) 35%, transparent);
    cursor: pointer;
    transition: transform 0.15s ease, background-color 0.15s ease, box-shadow 0.15s ease;
}

input[type="range"].custom-range-slider::-webkit-slider-thumb:hover {
    transform: scale(1.12);
    background: var(--accent-hover);
    box-shadow: 0 4px 12px color-mix(in srgb, var(--accent) 45%, transparent);
}

input[type="range"].custom-range-slider::-webkit-slider-thumb:active {
    transform: scale(0.98);
}

input[type="range"].custom-range-slider::-moz-range-thumb {
    width: 22px;
    height: 22px;
    border: 2px solid var(--surface);
    border-radius: 50%;
    background: var(--accent);
    box-shadow: 0 3px 8px color-mix(in srgb, var(--accent) 35%, transparent);
    cursor: pointer;
    transition: transform 0.15s ease, background-color 0.15s ease, box-shadow 0.15s ease;
}

input[type="range"].custom-range-slider::-moz-range-thumb:hover {
    transform: scale(1.12);
    background: var(--accent-hover);
    box-shadow: 0 4px 12px color-mix(in srgb, var(--accent) 45%, transparent);
}

input[type="range"].custom-range-slider::-moz-range-thumb:active {
    transform: scale(0.98);
}

input[type="range"].custom-range-slider::-moz-range-track {
    height: 8px;
    border-radius: 99px;
    background: var(--line);
}/* Компактные размеры полей и подвала модалки создания книги. */
#custom-project-logline {
    height: 46px;
    min-height: 46px;
    resize: none;
}

#custom-project-premise {
    min-height: 150px;
    max-height: 320px;
    overflow-y: hidden;
    resize: none;
}

.new-project-dialog-footer {
    padding: 8px 32px 12px;
}

.new-project-dialog-footer .button {
    min-height: 42px;
}

@media (max-width: 820px) {
    #custom-project-premise {
        min-height: 140px;
    }

    .new-project-dialog-footer {
        padding: 8px 20px max(12px, env(safe-area-inset-bottom));
    }
}/* Финальные размеры ключевых полей не должны переопределяться правилами сетки. */
#custom-premise-dialog #custom-project-logline {
    height: 46px;
    min-height: 46px;
    max-height: 46px;
    resize: none;
}

#custom-premise-dialog #custom-project-premise {
    min-height: 150px;
    max-height: 320px;
}

#custom-premise-dialog #custom-project-premise::placeholder,
#custom-premise-dialog #custom-project-character-composition::placeholder {
    color: var(--muted);
    opacity: 1;
}#custom-premise-dialog #custom-project-title,
#custom-premise-dialog #custom-project-logline {
    height: 46px;
    min-height: 46px;
    max-height: 46px;
}

#custom-premise-dialog #custom-project-logline {
    overflow-y: hidden;
    resize: none;
}

#custom-premise-dialog #custom-project-premise {
    height: 150px;
    min-height: 150px;
    max-height: 320px;
    overflow-y: hidden;
    resize: none;
}

#custom-premise-dialog #custom-project-premise::placeholder,
#custom-premise-dialog #custom-project-character-composition::placeholder {
    color: var(--muted);
    opacity: 1;
}

@media (max-width: 820px) {
    #custom-premise-dialog #custom-project-premise {
        height: 140px;
        min-height: 140px;
    }
}/* Компактные однострочные поля сохраняют читаемый размер текста. */
#custom-premise-dialog input,
#custom-premise-dialog select {
    min-height: 40px;
    padding: 8px 12px;
    font-size: 14px;
    line-height: 1.4;
}

#custom-premise-dialog #custom-project-title,
#custom-premise-dialog #custom-project-logline {
    height: 40px;
    min-height: 40px;
    max-height: 40px;
}

#custom-premise-dialog .new-project-dialog-footer .button {
    min-height: 40px;
    font-size: 14px;
}

@media (max-width: 820px) {
    #custom-premise-dialog #custom-project-premise {
        min-height: 140px;
    }
}/* Формы создания книги используют единый компактный диалог без вложенных карточек. */
.new-project-dialog {
    width: min(100% - 32px, 860px);
    border-color: color-mix(in srgb, var(--line) 72%, var(--accent));
    border-radius: 20px;
    background: var(--surface);
    box-shadow:
        0 1px 0 color-mix(in srgb, #ffffff 18%, transparent) inset,
        0 28px 80px rgba(0, 0, 0, 0.42);
}

.new-project-dialog-form {
    display: grid;
    gap: 18px 20px;
    max-height: min(820px, calc(100dvh - 32px));
    padding: 0 32px;
    overflow-y: auto;
    border: 0;
    border-radius: inherit;
    background: transparent;
}

.new-project-dialog-header {
    display: flex;
    grid-column: 1 / -1;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    margin: 0 -32px;
    padding: 11px 32px;
    border-bottom: 1px solid var(--line);
    background:
        radial-gradient(
            circle at 100% 0,
            color-mix(in srgb, var(--accent) 17%, transparent) 0,
            transparent 44%
        ),
        linear-gradient(
            135deg,
            color-mix(in srgb, var(--accent) 7%, var(--surface)),
            var(--surface) 68%
        );
}

.new-project-dialog-eyebrow {
    margin: 0 0 2px;
    color: var(--accent);
    font-size: 9px;
    font-weight: 800;
    letter-spacing: 0.1em;
    line-height: 1.1;
    text-transform: uppercase;
}

.new-project-dialog-header h2 {
    margin: 0;
    color: var(--text);
    font-size: 19px;
    letter-spacing: -0.035em;
    line-height: 1.1;
}

.new-project-dialog-header h2 + p {
    max-width: 590px;
    margin: 3px 0 0;
    color: var(--muted);
    font-size: 11px;
    line-height: 1.3;
}

.new-project-dialog-close {
    position: static;
    display: inline-flex;
    width: 34px;
    height: 34px;
    flex: 0 0 34px;
    align-items: center;
    justify-content: center;
    margin: 0;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: color-mix(in srgb, var(--surface-muted) 78%, var(--surface));
    color: var(--muted);
    font-size: 23px;
    line-height: 1;
    transition: border-color 0.18s ease, background-color 0.18s ease, color 0.18s ease;
}

.new-project-dialog-close:hover {
    border-color: color-mix(in srgb, var(--danger) 35%, var(--line));
    background: var(--danger-bg);
    color: var(--danger);
}

.new-project-dialog-close:focus-visible {
    outline: 3px solid color-mix(in srgb, var(--accent) 28%, transparent);
    outline-offset: 2px;
}

.new-project-dialog-form .form-field {
    display: grid;
    min-width: 0;
    gap: 7px;
    margin: 0;
}

.new-project-dialog-form .form-field > label {
    color: var(--muted);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0;
    line-height: 1.4;
    text-transform: none;
}

.new-project-dialog-form input,
.new-project-dialog-form select,
.new-project-dialog-form textarea {
    min-height: 46px;
    padding: 11px 13px;
    border-color: color-mix(in srgb, var(--line) 86%, var(--accent));
    border-radius: 10px;
    background: var(--surface-muted);
    box-shadow: none;
}

.new-project-dialog-form textarea {
    min-height: 84px;
    line-height: 1.55;
}

.new-project-dialog-form input:hover,
.new-project-dialog-form select:hover,
.new-project-dialog-form textarea:hover {
    border-color: color-mix(in srgb, var(--accent) 42%, var(--line));
}

.new-project-dialog-form input:focus,
.new-project-dialog-form select:focus,
.new-project-dialog-form textarea:focus {
    border-color: var(--accent);
    background: var(--surface);
    box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 13%, transparent);
}

.new-project-dialog-footer {
    grid-column: 1 / -1;
    position: sticky;
    z-index: 2;
    bottom: 0;
    margin: 2px -32px 0;
    padding: 8px 32px 10px;
    border-top: 1px solid var(--line);
    background:
        linear-gradient(
            transparent,
            color-mix(in srgb, var(--surface) 94%, transparent) 10px,
            var(--surface) 18px
        );
}

.new-project-dialog-footer .button {
    width: 100%;
    min-height: 42px;
    border: 1px solid color-mix(in srgb, #000000 9%, transparent);
    border-radius: 10px;
    box-shadow: 0 8px 18px color-mix(in srgb, var(--accent) 22%, transparent);
}

@media (min-width: 821px) {
    #custom-premise-dialog {
        width: min(100% - 48px, 860px);
        max-height: min(820px, calc(100dvh - 48px));
    }

    #custom-premise-dialog .new-project-dialog-form,
    #ai-premise-dialog .new-project-dialog-form {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    #custom-premise-dialog .new-project-dialog-form > .form-field:has(#custom-project-logline),
    #custom-premise-dialog .new-project-dialog-form > .form-field:has(#custom-project-premise) {
        grid-column: 1 / -1;
    }
}

@media (max-width: 820px) {
    .new-project-dialog-form {
        gap: 16px;
        max-height: 88dvh;
        padding: 0 20px;
        border-radius: 20px 20px 0 0;
    }

    .new-project-dialog-header {
        gap: 12px;
        margin: 0 -20px 2px;
        padding: 14px 20px 12px;
    }

    .new-project-dialog-header h2 {
        font-size: 19px;
    }

    .new-project-dialog-header h2 + p {
        margin-top: 4px;
        font-size: 11px;
        line-height: 1.35;
    }

    .new-project-dialog-footer {
        margin: 2px -20px 0;
        padding: 16px 20px max(24px, env(safe-area-inset-bottom));
    }
}@media (min-width: 1021px) {
    /* Поля сгруппированы по смыслу: ввод основы, затем равномерная сетка параметров. */
    #custom-premise-dialog {
        width: min(100% - 48px, 1060px);
    }

    #custom-premise-dialog .new-project-dialog-form {
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 12px 18px;
        max-height: none;
        overflow: visible;
    }

    #custom-premise-dialog .new-project-dialog-header,
    #custom-premise-dialog .new-project-dialog-footer {
        grid-column: 1 / -1;
    }

    #custom-premise-dialog .new-project-dialog-form textarea {
        min-height: 64px;
        resize: none;
    }

    #custom-premise-dialog .new-project-dialog-form > .form-field:has(#custom-project-title) {
        grid-column: 1;
    }

    #custom-premise-dialog .new-project-dialog-form > .form-field:has(#custom-project-logline) {
        grid-column: 2 / -1;
    }

    #custom-premise-dialog .new-project-dialog-form > .form-field:has(#custom-project-premise) {
        grid-column: 1 / -1;
    }

    #custom-premise-dialog .new-project-dialog-form > .form-field:has(#custom-project-genre) {
        grid-column: 1;
    }

    #custom-premise-dialog .new-project-dialog-form > .form-field:has(#custom-project-ending-effect) {
        grid-column: 2;
    }

    #custom-premise-dialog .new-project-dialog-form > .form-field:has(#custom-project-romance-line-mode) {
        grid-column: 3;
    }

    #custom-premise-dialog .new-project-dialog-form > .form-field:has(#custom-project-source-literary-culture) {
        grid-column: 1;
    }

    #custom-premise-dialog .new-project-dialog-form > .form-field:has(#custom-project-target-audience) {
        grid-column: 2;
    }

    #custom-premise-dialog .new-project-dialog-form > .form-field:has(#custom-project-target-word-count) {
        grid-column: 3;
    }

    #custom-premise-dialog .new-project-dialog-footer {
        position: static;
        display: flex;
        justify-content: flex-end;
        margin-top: 0;
    }

    #custom-premise-dialog .new-project-dialog-footer .button {
        width: auto;
        min-width: 260px;
        padding-right: 24px;
        padding-left: 24px;
    }
}

@media (min-width: 821px) and (max-width: 1020px) {
    /* На узких ноутбуках форма остаётся двухколоночной и сохраняет доступность полей. */
    #custom-premise-dialog .new-project-dialog-form {
        max-height: min(820px, calc(100dvh - 48px));
        overflow-y: auto;
    }

    #custom-premise-dialog .new-project-dialog-form > .form-field:has(#custom-project-logline),
    #custom-premise-dialog .new-project-dialog-form > .form-field:has(#custom-project-premise) {
        grid-column: auto;
    }
}