/* Назначение файла: стилизует единую тёмную страницу создания и редактирования голосового профиля. */

.voice-profile-editor-page {
    --vp-bg:var(--as-bg);
    --vp-panel:var(--as-surface);
    --vp-panel-soft:var(--as-surface-soft);
    --vp-line:var(--as-border);
    --vp-line-strong:var(--as-border-strong);
    --vp-text:var(--as-text);
    --vp-muted:var(--as-muted);
    --vp-accent:var(--as-accent);
    --vp-accent-soft:var(--as-accent-soft);
    --vp-success:var(--as-success);
    --vp-danger:var(--as-danger);
    min-height: calc(100vh - 74px);
    margin: -20px;
    padding: 22px 24px 0;
    color: var(--vp-text);
    background:
        radial-gradient(circle at 78% 0, rgba(var(--as-accent-rgb), 0.12), transparent 34%),
        linear-gradient(145deg, var(--as-surface) 0%, var(--as-surface) 72%);
}

.voice-profile-editor-page,
.voice-profile-editor-page * {
    box-sizing: border-box;
}

.voice-profile-editor-page button,
.voice-profile-editor-page input,
.voice-profile-editor-page textarea,
.voice-profile-editor-page select {
    font: inherit;
}

.voice-profile-editor-page__header {
    max-width: 1500px;
    margin: 0 auto 18px;
}

.voice-profile-editor-page__breadcrumbs {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 10px;
    color: var(--vp-muted);
    font-size: 13px;
}

.voice-profile-editor-page__breadcrumbs a {
    color: var(--as-secondary);
    text-decoration: none;
}

.voice-profile-editor-page__breadcrumbs a:hover {
    color: var(--vp-text);
}

.voice-profile-editor-page__heading-row {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 20px;
}

.voice-profile-editor-page__heading-row h1 {
    margin: 0;
    font-size: clamp(25px, 2.4vw, 36px);
    line-height: 1.12;
    letter-spacing: -0.025em;
}

.voice-profile-editor-page__heading-row p {
    max-width: 780px;
    margin: 8px 0 0;
    color: var(--vp-muted);
    line-height: 1.5;
}

.voice-profile-editor-page__close,
.voice-profile-icon-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    border: 1px solid var(--vp-line);
    border-radius: 9px;
    color: var(--as-secondary);
    background: rgba(var(--as-surface-rgb), 0.72);
    cursor: pointer;
}

.voice-profile-editor-page__close:hover,
.voice-profile-icon-button:hover {
    color: var(--vp-text);
    border-color: var(--vp-line-strong);
    background: var(--as-surface);
}

.voice-profile-editor-page svg {
    width: 19px;
    height: 19px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.voice-profile-editor-alert {
    max-width: 1500px;
    margin: 0 auto 16px;
    padding: 12px 14px;
    border: 1px solid var(--as-danger);
    border-radius: 9px;
    color: var(--as-danger);
    background: var(--as-danger-soft);
}

.voice-profile-editor {
    max-width: 1500px;
    margin: 0 auto;
}

.voice-profile-editor__workspace {
    display: grid;
    grid-template-columns: minmax(260px, 0.72fr) minmax(520px, 1.55fr) minmax(290px, 0.78fr);
    gap: 14px;
    align-items: start;
}

.voice-profile-editor__left,
.voice-profile-editor__center,
.voice-profile-editor__right {
    display: grid;
    gap: 14px;
    min-width: 0;
}

.voice-profile-panel,
.voice-profile-test-panel {
    border: 1px solid var(--vp-line);
    border-radius: 12px;
    background: linear-gradient(150deg, rgba(var(--as-surface-rgb), 0.96), rgba(var(--as-surface-rgb), 0.96));
    box-shadow: 0 16px 40px rgba(var(--as-shadow-rgb), 0.12);
}

.voice-profile-panel {
    padding: 14px;
    container-type: inline-size;
}

.voice-profile-panel__title-row {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 13px;
}

.voice-profile-panel__title-row h2,
.voice-profile-test-panel h2 {
    margin: 0;
    font-size: 16px;
    line-height: 1.3;
}

.voice-profile-panel__title-row p,
.voice-profile-test-panel__header p {
    margin: 4px 0 0;
    color: var(--vp-muted);
    font-size: 12.5px;
    line-height: 1.45;
}

.voice-profile-field {
    display: grid;
    gap: 6px;
    min-width: 0;
    margin-bottom: 12px;
}

.voice-profile-field:last-child {
    margin-bottom: 0;
}

.voice-profile-field > span,
.voice-profile-segmented-field legend {
    color: var(--as-text);
    font-size: 12.5px;
    font-weight: 600;
}

.voice-profile-field small {
    color: var(--vp-muted);
    font-size: 11.5px;
    line-height: 1.4;
}

.voice-profile-field input[type="text"],
.voice-profile-field input[type="number"],
.voice-profile-field textarea,
.voice-profile-field select {
    width: 100%;
    min-height: 38px;
    border: 1px solid var(--vp-line);
    border-radius: 8px;
    outline: none;
    color: var(--vp-text);
    background: rgba(var(--as-surface-rgb), 0.56);
    transition: border-color 0.16s ease, background 0.16s ease, box-shadow 0.16s ease;
}

.voice-profile-field input[type="text"],
.voice-profile-field input[type="number"],
.voice-profile-field select {
    padding: 0 10px;
}

.voice-profile-field textarea {
    min-height: 80px;
    padding: 9px 10px;
    resize: vertical;
    line-height: 1.45;
}

.voice-profile-field input:focus,
.voice-profile-field textarea:focus,
.voice-profile-field select:focus {
    border-color: var(--as-accent);
    background: rgba(var(--as-surface-rgb), 0.82);
    box-shadow: 0 0 0 3px rgba(var(--as-shadow-rgb), 0.12);
}

.voice-profile-field option {
    color: var(--as-text);
    background: var(--as-surface);
}

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





.voice-profile-segmented-field {
    padding: 0;
    margin: 0 0 12px;
    border: 0;
}

.voice-profile-segmented-field legend {
    margin-bottom: 6px;
}

.voice-profile-segmented {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    padding: 3px;
    border: 1px solid var(--vp-line);
    border-radius: 8px;
    background: rgba(var(--as-surface-rgb), 0.52);
}

.voice-profile-segmented label {
    cursor: pointer;
}

.voice-profile-segmented input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.voice-profile-segmented span {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 30px;
    border-radius: 6px;
    color: var(--vp-muted);
    font-size: 11.5px;
}

.voice-profile-segmented input:checked + span {
    color: var(--vp-text);
    background: var(--as-surface);
}

.voice-profile-derived-value {
    display: grid;
    gap: 3px;
    padding-top: 10px;
    border-top: 1px solid var(--as-border);
}

.voice-profile-derived-value span {
    color: var(--vp-muted);
    font-size: 11.5px;
}

.voice-profile-derived-value strong {
    font-size: 13px;
}

.voice-profile-derived-value small {
    color: var(--as-muted);
    font-size: 11px;
    line-height: 1.4;
}

.voice-profile-scope-toggle {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 10px;
    align-items: start;
    cursor: pointer;
}

.voice-profile-scope-toggle > input {
    position: absolute;
    opacity: 0;
}

.voice-profile-scope-toggle__track {
    position: relative;
    display: block;
    width: 37px;
    height: 21px;
    margin-top: 2px;
    border-radius: 99px;
    background: var(--as-surface);
    transition: background 0.16s ease;
}

.voice-profile-scope-toggle__track span {
    position: absolute;
    top: 3px;
    left: 3px;
    width: 15px;
    height: 15px;
    border-radius: 50%;
    background: var(--as-surface);
    transition: transform 0.16s ease;
}

.voice-profile-scope-toggle input:checked + .voice-profile-scope-toggle__track {
    background: var(--vp-accent);
}

.voice-profile-scope-toggle input:checked + .voice-profile-scope-toggle__track span {
    transform: translateX(16px);
}

.voice-profile-scope-toggle__text,
.voice-profile-readonly-scope > div {
    display: grid;
    gap: 4px;
}

.voice-profile-scope-toggle__text strong,
.voice-profile-readonly-scope strong {
    font-size: 13px;
}

.voice-profile-scope-toggle__text small,
.voice-profile-readonly-scope small {
    color: var(--vp-muted);
    font-size: 11.5px;
    line-height: 1.4;
}

.voice-profile-readonly-scope {
    display: flex;
    gap: 10px;
    align-items: flex-start;
}

.voice-profile-readonly-scope svg {
    flex: 0 0 auto;
    color: var(--as-accent-text);
}

.voice-profile-model-summary {
    display: grid;
    gap: 5px;
    padding: 10px;
    border: 1px solid var(--as-border);
    border-radius: 8px;
    background: rgba(var(--as-accent-rgb), 0.42);
}

.voice-profile-model-summary strong {
    font-size: 12.5px;
}

.voice-profile-model-summary span {
    color: var(--vp-muted);
    font-size: 11px;
}

.voice-profile-model-summary__status {
    color: var(--vp-success) !important;
}

.voice-profile-mode-tabs {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 9px;
}

.voice-profile-mode-tab {
    display: grid;
    gap: 5px;
    min-height: 74px;
    padding: 11px;
    border: 1px solid var(--vp-line);
    border-radius: 9px;
    text-align: left;
    color: var(--vp-text);
    background: rgba(var(--as-surface-rgb), 0.46);
    cursor: pointer;
}

.voice-profile-mode-tab strong {
    font-size: 13px;
}

.voice-profile-mode-tab span {
    color: var(--vp-muted);
    font-size: 11px;
    line-height: 1.35;
}

.voice-profile-mode-tab:hover {
    border-color: var(--as-accent);
    background: rgba(var(--as-accent-rgb), 0.46);
}

.voice-profile-mode-tab.is-active {
    border-color: var(--as-accent);
    background: linear-gradient(145deg, rgba(var(--as-accent-rgb), 0.45), rgba(var(--as-accent-rgb), 0.4));
    box-shadow: inset 0 0 0 1px rgba(var(--as-shadow-rgb), 0.18);
}

.voice-profile-panel__title-row--responsive {
    align-items: center;
}

.voice-profile-filter-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
}

.voice-profile-filter-pills button {
    min-height: 29px;
    padding: 0 9px;
    border: 1px solid transparent;
    border-radius: 7px;
    color: var(--vp-muted);
    background: transparent;
    cursor: pointer;
    font-size: 11.5px;
}

.voice-profile-filter-pills button:hover,
.voice-profile-filter-pills button.is-active {
    color: var(--vp-text);
    border-color: var(--vp-line);
    background: var(--as-surface);
}

.voice-profile-voice-list {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    max-height: 520px;
    overflow-y: auto;
    padding-right: 4px;
}

.voice-profile-voice-card {
    position: relative;
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    gap: 12px;
    align-items: start;
    min-height: 132px;
    padding: 14px;
    border: 1px solid var(--vp-line);
    border-radius: 12px;
    text-align: left;
    color: var(--vp-text);
    background: rgba(var(--as-surface-rgb), 0.54);
    cursor: pointer;
}

.voice-profile-voice-card:hover {
    border-color: var(--as-accent);
    background: var(--as-surface);
}

.voice-profile-voice-card.is-selected {
    border-color: var(--vp-accent);
    background: var(--as-accent);
    box-shadow: inset 0 0 0 1px rgba(var(--as-shadow-rgb), 0.18);
}

.voice-profile-voice-card__radio {
    width: 18px;
    height: 18px;
    margin-top: 2px;
    border: 1px solid var(--as-accent);
    border-radius: 50%;
    flex: 0 0 auto;
}

.voice-profile-voice-card.is-selected .voice-profile-voice-card__radio {
    border: 5px solid var(--vp-accent);
}

.voice-profile-voice-card__body {
    display: grid;
    gap: 9px;
    min-width: 0;
}

.voice-profile-voice-card__heading {
    display: flex;
    align-items: flex-start;
    min-width: 0;
}

.voice-profile-voice-card__heading strong {
    display: block;
    min-width: 0;
    color: var(--vp-text);
    font-size: 14px;
    font-weight: 750;
    line-height: 1.25;
    overflow-wrap: anywhere;
}

.voice-profile-voice-card__badges {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.voice-profile-voice-card__badges span {
    display: inline-flex;
    align-items: center;
    min-height: 23px;
    padding: 3px 8px;
    border: 1px solid var(--as-border);
    border-radius: 999px;
    color: var(--as-accent-text);
    background: rgba(var(--as-accent-rgb), 0.42);
    font-size: 10.5px;
    font-weight: 650;
    line-height: 1;
}

.voice-profile-voice-card__description {
    display: -webkit-box;
    overflow: hidden;
    color: var(--vp-muted);
    font-size: 11.5px;
    font-style: normal;
    line-height: 1.45;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 3;
}

.voice-profile-voice-card:hover .voice-profile-voice-card__description,
.voice-profile-voice-card.is-selected .voice-profile-voice-card__description {
    display: block;
    overflow: visible;
}

.voice-profile-voice-card__preview {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    color: var(--as-text);
    background: var(--vp-accent);
    font-size: 12px;
    box-shadow: 0 6px 16px rgba(var(--as-shadow-rgb), 0.18);
}

.voice-profile-selected-summary {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 11px;
    padding: 9px 10px;
    border-radius: 8px;
    color: var(--vp-muted);
    background: rgba(var(--as-accent-rgb), 0.38);
    font-size: 11.5px;
}

.voice-profile-selected-summary strong {
    color: var(--vp-text);
}

.voice-profile-reference-audio {
    display: grid;
    gap: 10px;
    margin-bottom: 13px;
}

.voice-profile-reference-audio__dropzone {
    position: relative;
    display: grid;
    justify-items: center;
    gap: 6px;
    padding: 20px;
    border: 1px dashed var(--as-accent);
    border-radius: 10px;
    text-align: center;
    color: var(--vp-muted);
    background: rgba(var(--as-surface-rgb), 0.55);
    cursor: pointer;
}

.voice-profile-reference-audio__dropzone:hover {
    border-color: var(--as-accent);
    background: var(--as-surface);
}

.voice-profile-reference-audio__dropzone input {
    position: absolute;
    inset: 0;
    opacity: 0;
    cursor: pointer;
}

.voice-profile-reference-audio__dropzone svg {
    width: 28px;
    height: 28px;
    color: var(--as-accent-text);
}

.voice-profile-reference-audio__dropzone strong {
    color: var(--vp-text);
    font-size: 13px;
}

.voice-profile-reference-audio__dropzone span {
    font-size: 11px;
}

.voice-profile-reference-audio__file {
    display: grid;
    grid-template-columns: auto minmax(120px, 1fr) minmax(190px, 0.8fr) auto;
    gap: 10px;
    align-items: center;
    padding: 10px;
    border: 1px solid var(--vp-line);
    border-radius: 9px;
    background: var(--as-surface);
}

.voice-profile-reference-audio__file[hidden] {
    display: none;
}

.voice-profile-reference-audio__file-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    border-radius: 9px;
    color: var(--as-accent-text);
    background: rgba(var(--as-accent-rgb), 0.15);
}

.voice-profile-reference-audio__file-info {
    display: grid;
    gap: 3px;
    min-width: 0;
}

.voice-profile-reference-audio__file-info strong,
.voice-profile-reference-audio__file-info span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.voice-profile-reference-audio__file-info strong {
    font-size: 12px;
}

.voice-profile-reference-audio__file-info span {
    color: var(--vp-muted);
    font-size: 10.5px;
}

.voice-profile-reference-audio__file audio {
    width: 100%;
    height: 34px;
}

.voice-profile-inline-status,
.voice-profile-test-status {
    min-height: 18px;
    color: var(--vp-muted);
    font-size: 11.5px;
    line-height: 1.4;
}

.voice-profile-inline-status[data-status-kind="error"],
.voice-profile-test-status[data-status-kind="error"] {
    color: var(--as-danger);
}

.voice-profile-inline-status[data-status-kind="success"],
.voice-profile-test-status[data-status-kind="success"] {
    color: var(--as-success);
}

.voice-profile-test-status[data-status-kind="info"] {
    color: var(--as-accent-text);
}

.voice-profile-panel--collapsible {
    padding: 0;
    overflow: hidden;
}

.voice-profile-panel__toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 13px 14px;
    border: 0;
    color: var(--vp-text);
    background: transparent;
    cursor: pointer;
}

.voice-profile-panel__toggle > span {
    display: grid;
    gap: 3px;
    text-align: left;
}

.voice-profile-panel__toggle strong {
    font-size: 15px;
}

.voice-profile-panel__toggle small {
    color: var(--vp-muted);
    font-size: 11.5px;
}

.voice-profile-panel__toggle svg {
    transition: transform 0.16s ease;
}

.voice-profile-panel--collapsible.is-open .voice-profile-panel__toggle svg {
    transform: rotate(180deg);
}

.voice-profile-panel__collapsible-content {
    display: none;
    padding: 0 14px 14px;
}

.voice-profile-panel--collapsible.is-open .voice-profile-panel__collapsible-content {
    display: block;
}

.voice-profile-advanced-group {
    display: grid;
    gap: 12px;
    padding: 16px 0;
    border-top: 1px solid var(--as-border);
}

.voice-profile-advanced-group:first-child {
    padding-top: 2px;
    border-top: 0;
}

.voice-profile-advanced-group:last-child {
    padding-bottom: 0;
}

.voice-profile-advanced-group__header {
    display: grid;
    gap: 4px;
}

.voice-profile-advanced-group__header h3 {
    margin: 0;
    color: var(--as-text);
    font-size: 13px;
}

.voice-profile-advanced-group__header p {
    margin: 0;
    color: var(--vp-muted);
    font-size: 11.5px;
    line-height: 1.45;
}

.voice-profile-dynamic-fields {
    display: grid;
    gap: 13px;
}

.voice-profile-dynamic-group {
    display: grid;
    gap: 8px;
}

.voice-profile-dynamic-group h3 {
    margin: 0;
    color: var(--as-accent-text);
    font-size: 12px;
}

.voice-profile-dynamic-group__grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
}

.voice-profile-dynamic-field input[type="range"] {
    width: 100%;
    accent-color: var(--vp-accent);
}

.voice-profile-dynamic-field input[type="checkbox"] {
    width: 19px;
    height: 19px;
    accent-color: var(--vp-accent);
}

.voice-profile-empty-inline {
    padding: 16px;
    border: 1px dashed var(--vp-line);
    border-radius: 9px;
    text-align: center;
    color: var(--vp-muted);
    font-size: 12px;
}

.voice-profile-test-panel {
    position: sticky;
    top: 14px;
    padding: 14px;
}

.voice-profile-test-panel__header {
    margin-bottom: 13px;
}

.voice-profile-character-counter {
    justify-self: end;
    margin-top: -3px;
}

.voice-profile-test-panel__quick-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    margin: -3px 0 10px;
}

.voice-profile-test-panel__quick-actions button {
    min-height: 34px;
    border: 1px solid var(--vp-line);
    border-radius: 8px;
    color: var(--as-text);
    background: var(--as-surface);
    cursor: pointer;
    font-size: 11.5px;
}

.voice-profile-test-panel__quick-actions button:hover {
    border-color: var(--vp-line-strong);
    color: var(--vp-text);
}

.voice-profile-primary-button,
.voice-profile-secondary-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    min-height: 38px;
    padding: 0 14px;
    border-radius: 8px;
    text-decoration: none;
    cursor: pointer;
    font-weight: 600;
    font-size: 12px;
}

.voice-profile-primary-button {
    border: 1px solid var(--as-accent);
    color:var(--as-on-accent);
    background: linear-gradient(135deg, var(--as-accent), var(--as-accent));
    box-shadow: 0 10px 24px rgba(var(--as-shadow-rgb), 0.18);
}

.voice-profile-primary-button:hover {
    filter: brightness(1.06);
}

.voice-profile-primary-button--wide {
    width: 100%;
}

.voice-profile-secondary-button {
    border: 1px solid var(--vp-line);
    color: var(--as-text);
    background: rgba(var(--as-surface-rgb), 0.72);
}

.voice-profile-secondary-button:hover {
    border-color: var(--vp-line-strong);
    color: var(--as-text);
    background: var(--as-surface);
}

.voice-profile-test-status {
    margin-top: 10px;
    padding: 9px;
    border-radius: 8px;
    background: rgba(var(--as-surface-rgb), 0.5);
}

.voice-profile-test-player {
    margin-top: 10px;
    padding: 10px;
    border-radius: 9px;
    background: var(--as-surface);
}

.voice-profile-test-player audio {
    width: 100%;
}

.voice-profile-test-panel__note {
    margin: 9px 0 0;
    color: var(--as-muted);
    font-size: 10.5px;
}

.voice-profile-test-summary {
    margin-top: 18px;
    padding-top: 13px;
    border-top: 1px solid var(--as-border);
}

.voice-profile-test-summary h3 {
    margin: 0 0 9px;
    font-size: 12px;
}

.voice-profile-test-summary dl {
    display: grid;
    gap: 7px;
    margin: 0;
}

.voice-profile-test-summary dl > div {
    display: grid;
    grid-template-columns: 70px 1fr;
    gap: 8px;
    font-size: 11px;
}

.voice-profile-test-summary dt {
    color: var(--vp-muted);
}

.voice-profile-test-summary dd {
    margin: 0;
    color: var(--as-text);
    overflow-wrap: anywhere;
}

.voice-profile-editor__footer {
    position: sticky;
    bottom: 0;
    z-index: 4;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    margin-top: 15px;
    padding: 11px 0 14px;
    border-top: 1px solid var(--as-border);
    background: linear-gradient(to bottom, rgba(var(--as-border-rgb), 0.1), rgba(var(--as-surface-rgb), 0.98) 30%);
    backdrop-filter: blur(12px);
}

.voice-profile-editor__footer-actions {
    display: flex;
    gap: 8px;
}

.voice-profile-voice-list,
.voice-profile-editor-page textarea {
    scrollbar-width: thin;
    scrollbar-color: rgba(115, 133, 169, 0.5) transparent;
}

@media (max-width: 1280px) {
    .voice-profile-editor__workspace {
        grid-template-columns: minmax(250px, 0.72fr) minmax(460px, 1.35fr);
    }

    .voice-profile-editor__right {
        grid-column: 1 / -1;
    }

    .voice-profile-test-panel {
        position: static;
        display: grid;
        grid-template-columns: minmax(320px, 1fr) minmax(280px, 0.7fr);
        gap: 0 18px;
    }

    .voice-profile-test-panel__header,
    .voice-profile-test-panel > .voice-profile-field,
    .voice-profile-test-panel__quick-actions,
    .voice-profile-test-panel > .voice-profile-primary-button,
    .voice-profile-test-status,
    .voice-profile-test-player,
    .voice-profile-test-panel__note {
        grid-column: 1;
    }

    .voice-profile-test-summary {
        grid-column: 2;
        grid-row: 1 / span 7;
        margin-top: 0;
        padding: 0 0 0 18px;
        border-top: 0;
        border-left: 1px solid var(--as-border);
    }
}

@media (max-width: 920px) {
    .voice-profile-editor-page {
        margin: -12px;
        padding: 16px 14px 0;
    }

    .voice-profile-editor__workspace {
        grid-template-columns: 1fr;
    }

    .voice-profile-editor__right {
        grid-column: auto;
    }

    .voice-profile-test-panel {
        display: block;
    }

    .voice-profile-test-summary {
        margin-top: 18px;
        padding: 13px 0 0;
        border-top: 1px solid var(--as-border);
        border-left: 0;
    }
}

@media (max-width: 680px) {
    .voice-profile-editor-page__heading-row p {
        font-size: 13px;
    }

    .voice-profile-grid--two,
    .voice-profile-grid--four,
    .voice-profile-mode-tabs,
    .voice-profile-dynamic-group__grid,
    .voice-profile-voice-list {
        grid-template-columns: 1fr;
    }

    .voice-profile-panel__title-row--responsive {
        display: grid;
    }

    .voice-profile-reference-audio__file {
        grid-template-columns: auto 1fr auto;
    }

    .voice-profile-reference-audio__file audio {
        grid-column: 1 / -1;
    }

    .voice-profile-editor__footer {
        align-items: stretch;
        flex-direction: column;
    }

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

    .voice-profile-editor__footer .voice-profile-secondary-button,
    .voice-profile-editor__footer .voice-profile-primary-button {
        width: 100%;
    }
}

@media (max-width: 1100px) {
    .voice-profile-voice-list {
        grid-template-columns: 1fr;
    }
}



/* Schema-aware toolbar генерации голосового профиля через text-модель. */
.voice-profile-ai-toolbar {
    display: grid;
    grid-template-columns: minmax(220px, 1fr) auto;
    gap: 12px;
    align-items: end;
    margin: 8px 0 10px;
    padding: 12px;
    border: 1px solid var(--as-border);
    border-radius: 11px;
    background: rgba(var(--as-accent-rgb), 0.07);
}

.voice-profile-ai-toolbar__model {
    display: grid;
    gap: 6px;
}

.voice-profile-ai-toolbar__model > span {
    color: var(--vp-text, #eef3fb);
    font-size: 12px;
    font-weight: 700;
}

.voice-profile-ai-toolbar__model select {
    width: 100%;
}

.voice-profile-ai-toolbar__model small,
.voice-profile-ai-toolbar__status {
    color: var(--vp-muted, #9ca8ba);
    font-size: 12px;
    line-height: 1.4;
}

.voice-profile-ai-toolbar__model small.is-error,
.voice-profile-ai-toolbar__status[data-status-kind="error"] {
    color: var(--as-danger);
}

.voice-profile-ai-toolbar__status[data-status-kind="success"] {
    color: var(--as-success);
}

.voice-profile-ai-toolbar__status[data-status-kind="loading"] {
    color: var(--as-accent-text);
}

.voice-profile-ai-toolbar__button {
    min-height: 42px;
    white-space: nowrap;
}

@media (max-width: 720px) {
    .voice-profile-ai-toolbar {
        grid-template-columns: 1fr;
    }

    .voice-profile-ai-toolbar__button {
        width: 100%;
    }
}


/* Stage 20: удерживает AI-toolbar и поля строго внутри левой колонки редактора. */
.voice-profile-editor__left,
.voice-profile-editor__center,
.voice-profile-editor__right,
.voice-profile-panel,
.voice-profile-field,
.voice-profile-ai-toolbar,
.voice-profile-ai-toolbar__model {
    min-width: 0;
    max-width: 100%;
}

.voice-profile-field textarea,
.voice-profile-field select,
.voice-profile-ai-toolbar__model select {
    display: block;
    max-width: 100%;
}

.voice-profile-ai-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    width: 100%;
    gap: 10px;
    overflow: hidden;
}

.voice-profile-ai-toolbar__model {
    flex: 1 1 190px;
}

.voice-profile-ai-toolbar__model select {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
}

.voice-profile-ai-toolbar__button {
    flex: 0 1 205px;
    width: auto;
    min-width: 165px;
    max-width: 100%;
    min-height: 42px;
    height: auto;
    padding: 9px 12px;
    white-space: normal;
    text-align: center;
    line-height: 1.25;
}

.voice-profile-ai-toolbar__status,
.voice-profile-ai-toolbar__model small {
    max-width: 100%;
    overflow-wrap: anywhere;
}

/* В стандартной левой колонке элементы располагаются вертикально.
   Горизонтальный вариант включается только когда самой панели реально хватает ширины. */
@container (max-width: 440px) {
    .voice-profile-ai-toolbar__model,
    .voice-profile-ai-toolbar__button {
        flex-basis: 100%;
        width: 100%;
    }
}

/* Fallback для браузеров без container queries и для двухколоночного режима страницы. */
@media (max-width: 1500px) {
    .voice-profile-editor__left .voice-profile-ai-toolbar__model,
    .voice-profile-editor__left .voice-profile-ai-toolbar__button {
        flex-basis: 100%;
        width: 100%;
    }
}

@media (max-width: 920px) {
    .voice-profile-ai-toolbar__model,
    .voice-profile-ai-toolbar__button {
        flex-basis: 100%;
        width: 100%;
    }
}

/* Назначение блока: оформляет контекст локального владельца и успешное сохранение переиспользуемого редактора. */
.voice-profile-editor-page__owner {
    display: inline-flex;
    align-items: center;
    margin-top: 10px;
    padding: 7px 11px;
    border: 1px solid var(--as-border);
    border-radius: 999px;
    background: rgba(var(--as-accent-rgb), 0.1);
    color: var(--vp-text, #e8edf8);
    font-size: 13px;
    font-weight: 700;
}

.voice-profile-editor-alert--success {
    border-color: var(--as-success);
    background: var(--as-success-soft);
    color: var(--as-success);
}

/*
 * Назначение блока: возвращает редактору голосового профиля компактную
 * трёхколоночную компоновку по утверждённому макету внутри общего layout AiServise.
 * Backend, Razor data-контракты и JavaScript-логика не изменяются.
 */
.voice-profile-editor-page {
    --vp-bg:var(--as-bg);
    --vp-panel:var(--as-surface);
    --vp-panel-soft:var(--as-surface-soft);
    --vp-line:var(--as-border);
    --vp-line-strong:var(--as-border-strong);
    --vp-text:var(--as-text);
    --vp-muted:var(--as-muted);
    --vp-accent:var(--as-accent);
    --vp-accent-soft:var(--as-accent-soft);
    min-height: calc(100vh - 60px);
    margin: 0;
    padding: 18px 18px 24px;
    background:
        radial-gradient(circle at 76% -12%, rgba(var(--as-accent-rgb), 0.13), transparent 32%),
        linear-gradient(145deg, var(--as-surface) 0%, var(--as-surface) 76%);
    color: var(--vp-text);
}

.voice-profile-editor-page__header,
.voice-profile-editor-alert,
.voice-profile-editor {
    width: min(1280px, 100%);
    max-width: none;
    margin-left: auto;
    margin-right: auto;
}

.voice-profile-editor-page__header {
    margin-bottom: 14px;
}

.voice-profile-editor-page__breadcrumbs {
    margin-bottom: 8px;
    font-size: 12px;
}

.voice-profile-editor-page__heading-row {
    align-items: center;
}

.voice-profile-editor-page__heading-row h1 {
    font-size: clamp(24px, 2vw, 31px);
    line-height: 1.12;
    letter-spacing: -0.018em;
}

.voice-profile-editor-page__heading-row p {
    max-width: 720px;
    margin-top: 6px;
    font-size: 13px;
    line-height: 1.42;
}

.voice-profile-editor-page__meta {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
    margin-top: 9px;
}

.voice-profile-editor-page__mode-badge,
.voice-profile-editor-page__owner {
    display: inline-flex;
    align-items: center;
    min-height: 25px;
    margin: 0;
    padding: 4px 9px;
    border: 1px solid var(--as-accent);
    border-radius: 999px;
    background: rgba(var(--as-accent-rgb), 0.18);
    color: var(--as-accent-text);
    font-size: 11px;
    font-weight: 700;
}

.voice-profile-editor-page__mode-badge {
    color: var(--as-text);
    background: rgba(var(--as-accent-rgb), 0.23);
}

.voice-profile-editor-page__close {
    width: 36px;
    height: 36px;
}

.voice-profile-editor__workspace {
    display: grid;
    grid-template-columns:
        minmax(220px, 270px)
        minmax(430px, 1fr)
        minmax(260px, 300px);
    gap: 12px;
    align-items: start;
}

.voice-profile-editor__left,
.voice-profile-editor__center,
.voice-profile-editor__right {
    display: grid;
    gap: 12px;
    min-width: 0;
    max-width: 100%;
}

.voice-profile-editor__left {
    grid-column: 1;
}

.voice-profile-editor__center {
    grid-column: 2;
}

.voice-profile-editor__right {
    grid-column: 3;
}

.voice-profile-panel,
.voice-profile-test-panel {
    border: 1px solid var(--vp-line);
    border-radius: 12px;
    background: linear-gradient(150deg, var(--as-surface), var(--as-surface));
    box-shadow: 0 13px 32px rgba(var(--as-shadow-rgb), 0.16);
}

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

.voice-profile-panel__title-row {
    margin-bottom: 11px;
}

.voice-profile-panel__title-row h2,
.voice-profile-test-panel h2 {
    font-size: 15px;
    font-weight: 700;
}

.voice-profile-panel__title-row p,
.voice-profile-test-panel__header p {
    margin-top: 3px;
    font-size: 11px;
    line-height: 1.35;
}

.voice-profile-field {
    gap: 5px;
    margin-bottom: 10px;
}

.voice-profile-field > span,
.voice-profile-segmented-field legend {
    font-size: 11px;
    font-weight: 650;
}

.voice-profile-field input[type="text"],
.voice-profile-field input[type="number"],
.voice-profile-field select {
    min-height: 37px;
    padding: 7px 10px;
    border-radius: 8px;
    font-size: 12px;
}

.voice-profile-field textarea {
    min-height: 72px;
    padding: 9px 10px;
    border-radius: 8px;
    font-size: 12px;
    line-height: 1.38;
}

.voice-profile-ai-toolbar {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
    padding: 10px;
    overflow: visible;
}

.voice-profile-ai-toolbar__model,
.voice-profile-ai-toolbar__button {
    width: 100%;
    min-width: 0;
    max-width: 100%;
}

.voice-profile-ai-toolbar__button {
    min-height: 38px;
    padding: 8px 10px;
    font-size: 11.5px;
}

.voice-profile-grid {
    gap: 9px;
}

.voice-profile-grid--two {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.voice-profile-grid--four {
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

.voice-profile-segmented span,
.voice-profile-derived-value,
.voice-profile-model-summary,
.voice-profile-readonly-scope,
.voice-profile-scope-toggle {
    font-size: 11px;
}

.voice-profile-mode-tabs {
    gap: 8px;
}

.voice-profile-mode-tab {
    min-height: 70px;
    padding: 10px;
}

.voice-profile-mode-tab strong {
    font-size: 12px;
}

.voice-profile-mode-tab span {
    font-size: 10.5px;
}

.voice-profile-voice-list {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
    max-height: 295px;
    padding-right: 3px;
}

.voice-profile-voice-card {
    grid-template-columns: auto minmax(0, 1fr) auto;
    gap: 8px;
    min-height: 104px;
    padding: 10px;
    border-radius: 9px;
}

.voice-profile-voice-card__heading strong {
    font-size: 12px;
}

.voice-profile-voice-card__body {
    gap: 6px;
}

.voice-profile-voice-card__badges {
    gap: 4px;
}

.voice-profile-voice-card__badges span {
    min-height: 19px;
    padding: 2px 6px;
    font-size: 9.5px;
}

.voice-profile-voice-card__description {
    font-size: 10px;
    line-height: 1.3;
    -webkit-line-clamp: 2;
}

.voice-profile-voice-card__preview {
    width: 28px;
    height: 28px;
}

.voice-profile-panel--collapsible {
    padding: 0;
}

.voice-profile-panel__toggle {
    min-height: 50px;
    padding: 11px 13px;
}

.voice-profile-panel__toggle strong {
    font-size: 13px;
}

.voice-profile-panel__toggle small {
    font-size: 10.5px;
}

.voice-profile-panel__collapsible-content {
    padding: 0 13px 13px;
}

.voice-profile-test-panel {
    position: sticky;
    top: 12px;
    max-height: calc(100vh - 94px);
    padding: 12px;
    overflow: auto;
}

.voice-profile-test-panel .voice-profile-field textarea {
    min-height: 112px;
}

.voice-profile-test-panel__quick-actions {
    gap: 6px;
}

.voice-profile-test-panel__quick-actions button,
.voice-profile-primary-button,
.voice-profile-secondary-button {
    min-height: 36px;
    padding: 7px 10px;
    border-radius: 8px;
    font-size: 11px;
}

.voice-profile-test-status,
.voice-profile-test-panel__note,
.voice-profile-test-summary {
    font-size: 10.5px;
}

.voice-profile-editor__footer {
    position: static;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-top: 12px;
    padding: 11px 12px;
    border: 1px solid var(--vp-line);
    border-radius: 11px;
    background: var(--as-surface);
    box-shadow: 0 12px 28px rgba(var(--as-shadow-rgb), 0.15);
    backdrop-filter: none;
}

.voice-profile-editor__footer-copy {
    display: grid;
    gap: 2px;
    min-width: 0;
}

.voice-profile-editor__footer-copy strong {
    font-size: 11.5px;
}

.voice-profile-editor__footer-copy span {
    color: var(--vp-muted);
    font-size: 10px;
    line-height: 1.3;
}

.voice-profile-editor__footer-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 7px;
}

@media (max-width: 1180px) {
    .voice-profile-editor__workspace {
        grid-template-columns: minmax(220px, 260px) minmax(420px, 1fr);
    }

    .voice-profile-editor__left {
        grid-column: 1;
    }

    .voice-profile-editor__center {
        grid-column: 2;
    }

    .voice-profile-editor__right {
        grid-column: 1 / -1;
    }

    .voice-profile-test-panel {
        position: static;
        max-height: none;
        display: grid;
        grid-template-columns: minmax(300px, 1fr) minmax(250px, 0.72fr);
        gap: 0 16px;
        overflow: visible;
    }

    .voice-profile-test-summary {
        grid-column: 2;
        grid-row: 1 / span 8;
        margin-top: 0;
        padding: 0 0 0 16px;
        border-top: 0;
        border-left: 1px solid var(--vp-line);
    }
}

@media (max-width: 820px) {
    .voice-profile-editor-page {
        padding: 14px 12px 20px;
    }

    .voice-profile-editor__workspace {
        grid-template-columns: 1fr;
    }

    .voice-profile-editor__left,
    .voice-profile-editor__center,
    .voice-profile-editor__right {
        grid-column: 1;
    }

    .voice-profile-test-panel {
        display: block;
    }

    .voice-profile-test-summary {
        margin-top: 14px;
        padding: 12px 0 0;
        border-top: 1px solid var(--vp-line);
        border-left: 0;
    }

    .voice-profile-grid--four {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .voice-profile-voice-list {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 560px) {
    .voice-profile-grid--two,
    .voice-profile-grid--four,
    .voice-profile-mode-tabs,
    .voice-profile-voice-list {
        grid-template-columns: 1fr;
    }

    .voice-profile-editor__footer {
        align-items: stretch;
        flex-direction: column;
    }

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