/* Customer tool geometry follows the main customer workspace.
   Palette, tool behavior, and content remain owned by the existing styles. */

body.customer-layout :is(.conversation-grid, .voice-change-grid, .isolator-grid, .transcription-grid, .srt-grid) {
    display: grid;
    grid-template-columns: minmax(0, 3fr) minmax(400px, 1.6fr);
    align-items: start;
    gap: 30px;
    width: 100%;
    max-width: 1400px;
    margin-inline: auto;
}

body.customer-layout :is(.conversation-editor-column, .voice-change-column, .isolator-column, .transcription-column, .srt-column) {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

body.customer-layout :is(.conversation-sidebar, .voice-change-history, .isolator-sidebar, .transcription-sidebar, .srt-sidebar) {
    min-width: 0;
    position: sticky;
    top: 20px;
    max-height: calc(100dvh - 140px);
    overflow-y: auto;
    overscroll-behavior: contain;
}

body.customer-layout :is(.conversation-editor, .conversation-sidebar, .voice-change-card, .voice-change-history,
    .isolator-card, .isolator-history, .transcription-card, .transcription-history, .transcription-result,
    .srt-card, .srt-history) {
    border-radius: 24px;
    min-width: 0;
}

body.customer-layout :is(.conversation-sidebar, .voice-change-history, .isolator-history, .transcription-history, .srt-history) {
    padding: 24px;
}

body.customer-layout :is(.isolator-sidebar, .transcription-sidebar, .srt-sidebar) {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

body.customer-layout :is(.isolator-sidebar, .transcription-sidebar, .srt-sidebar) > :is(.isolator-history, .transcription-history, .srt-history) {
    flex: 1;
    min-height: 240px;
}

/* Conversation: guidance and cue chips precede the script; voices stay right. */
body.customer-layout .conversation-editor {
    display: flex;
    flex-direction: column;
    padding: 20px;
    overflow: hidden;
}

body.customer-layout .conversation-editor > .panel-heading { order: 0; }
body.customer-layout .conversation-guide { order: 1; margin-bottom: 0; padding: 16px; border-radius: 12px; }
body.customer-layout .conversation-cues { order: 2; margin: 0 0 16px; padding: 12px 0; border-top: 0; }
body.customer-layout .conversation-editor > textarea { order: 3; }
body.customer-layout .conversation-toolbar { order: 4; flex-wrap: wrap; }
body.customer-layout .conversation-syntax { order: 5; }
body.customer-layout .conversation-footer { order: 6; }
body.customer-layout .conversation-editor > .hidden { order: 3; }

body.customer-layout .conversation-editor textarea {
    min-height: 300px;
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 18px;
    line-height: 1.8;
}

body.customer-layout .conversation-toolbar > span { margin-left: auto; }
body.customer-layout .conversation-footer { margin: 20px -20px -20px; padding: 16px 24px 20px; }
body.customer-layout .conversation-title-row { flex-wrap: wrap; }
body.customer-layout .conversation-title-row input { flex: 1 1 180px; }
body.customer-layout .conversation-generate-row { flex-wrap: nowrap; }
body.customer-layout .conversation-generate-row .button { width: auto; min-height: 42px; padding: 10px 24px; }
body.customer-layout .conversation-tabs { gap: 6px; padding: 6px; border-radius: 16px; margin-bottom: 20px; }
body.customer-layout .conversation-tabs button { min-height: 42px; border-radius: 10px; padding: 10px 16px; }
body.customer-layout .conversation-speakers { display: flex; flex-direction: column; max-height: 360px; gap: 10px; }
body.customer-layout .conversation-speaker { padding: 14px; border-radius: 16px; gap: 10px; }
body.customer-layout .conversation-speaker-label { height: 36px; width: 36px; border-radius: 10px; }
body.customer-layout .conversation-voice { padding: 8px 10px; min-height: 48px; }
body.customer-layout .conversation-add { padding: 12px; border-radius: 10px; }
body.customer-layout .conversation-controls { display: block; margin-top: 24px; padding-top: 12px; }
body.customer-layout .conversation-controls > div + div { margin-top: 22px; }
body.customer-layout .conversation-history { max-height: none; overflow: visible; }

/* Upload tools: a large input card on the left, task history on the right. */
body.customer-layout :is(.voice-change-card, .isolator-card, .transcription-card, .srt-card) {
    padding: 20px;
    overflow: hidden;
    min-height: 400px;
}

body.customer-layout :is(.voice-change-step, .isolator-panel-heading, .transcription-heading) {
    margin-bottom: 20px;
    flex-wrap: wrap;
}

body.customer-layout :is(.voice-change-dropzone, .isolator-dropzone, .transcription-dropzone, .srt-dropzone) {
    min-height: 285px;
    padding: 56px 20px;
    gap: 12px;
    border-width: 2px;
    border-radius: 16px;
}

body.customer-layout :is(.voice-change-dropzone, .isolator-dropzone, .transcription-dropzone) > span:first-child {
    width: 58px;
    height: 58px;
    border-radius: 12px;
    margin-bottom: 8px;
}

body.customer-layout :is(.voice-change-dropzone, .isolator-dropzone, .transcription-dropzone, .srt-dropzone) svg {
    width: 32px;
    height: 32px;
}

body.customer-layout :is(.voice-change-source, .isolator-source, .transcription-source, .srt-file-card) {
    margin-top: 20px;
    padding: 15px 20px;
    border-radius: 12px;
}

body.customer-layout .voice-change-target {
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 20px;
    margin-top: 20px;
}

body.customer-layout .voice-change-voice { min-height: 64px; border-radius: 10px; }
body.customer-layout .voice-change-voice .small-button { flex: none; }
body.customer-layout .voice-change-avatar { border-radius: 10px; }

body.customer-layout :is(.voice-change-footer, .isolator-footer, .transcription-footer) {
    margin: 20px -20px -20px;
    padding: 18px 24px 20px;
}

body.customer-layout :is(.voice-change-generate, .isolator-generate, .transcription-generate) {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: nowrap;
    gap: 15px;
}

body.customer-layout :is(.voice-change-generate, .isolator-generate, .transcription-generate) > div { min-width: 0; }
body.customer-layout :is(.voice-change-generate, .isolator-generate, .transcription-generate) small { overflow-wrap: anywhere; }
body.customer-layout :is(.voice-change-generate, .isolator-generate, .transcription-generate) .button {
    width: auto;
    flex: none;
    min-height: 42px;
    padding: 10px 24px;
}

body.customer-layout :is(.voice-change-history-heading, .isolator-history-heading, .transcription-history-heading, .srt-history-heading) {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
    margin: 0 0 16px;
    padding-bottom: 16px;
}

body.customer-layout :is(.voice-change-history, .isolator-history, .transcription-history, .srt-history) .history-row {
    margin-top: 12px;
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 15px;
}

body.customer-layout :is(.voice-change-history, .isolator-history, .transcription-history, .srt-history) .audio-row-header { align-items: flex-start; }
body.customer-layout :is(.voice-change-history, .isolator-history, .transcription-history, .srt-history) .history-row p { overflow-wrap: anywhere; }
body.customer-layout :is(.isolator-about, .transcription-about) { padding: 20px; border-radius: 16px; }
body.customer-layout :is(.isolator-column, .transcription-column) > :is(.isolator-about, .transcription-about) ul {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}
body.customer-layout .isolator-benefits { margin: 20px 0; }
body.customer-layout .transcription-result { margin-top: 0; padding: 24px; }
body.customer-layout .transcription-result textarea { min-height: 280px; }

/* SRT voice/timing controls belong to the upload card, matching the main tool. */
body.customer-layout .srt-column { gap: 20px; }
body.customer-layout .srt-settings { min-width: 0; border-radius: 16px; padding: 20px; }
body.customer-layout .srt-card > .srt-settings { margin: 20px 0 0; }
body.customer-layout .srt-settings > h3 { margin-bottom: 16px; }
body.customer-layout .srt-voice { min-height: 64px; padding: 12px; border: 1px solid var(--line); border-radius: 10px; }
body.customer-layout .srt-voice > span { border-radius: 10px; }
body.customer-layout .srt-settings > select { min-height: 42px; border-radius: 10px; }
body.customer-layout .srt-mode div { border-radius: 10px; min-height: 42px; }
body.customer-layout .srt-mode span { padding: 12px 8px; }
body.customer-layout .srt-cost { display: grid; grid-template-columns: 1fr auto; gap: 4px 16px; align-items: center; }
body.customer-layout .srt-cost strong { margin: 0; }
body.customer-layout .srt-cost small { grid-column: 1 / -1; }
body.customer-layout .srt-settings > .button { min-height: 44px; margin-top: 16px; }
body.customer-layout .srt-sidebar .srt-history { margin: 0; }

/* Main clone workspace uses a fixed-width, independently scrolling history. */
body.customer-layout .clone-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 520px;
    gap: 20px;
    align-items: start;
    width: 100%;
}

body.customer-layout :is(.clone-main-column, .clone-history-column) { min-width: 0; }
body.customer-layout .clone-main-column { display: flex; flex-direction: column; gap: 16px; }
body.customer-layout .clone-main-column > .clone-credit-badge { width: fit-content; }
body.customer-layout .clone-card { padding: 22px; margin-bottom: 0; border-radius: 8px; }
body.customer-layout .clone-sample-grid { grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr)); gap: 20px; }
body.customer-layout .clone-step-heading { margin-bottom: 20px; gap: 12px; }
body.customer-layout .clone-step { width: 34px; height: 34px; border-radius: 8px; }
body.customer-layout .clone-dropzone { min-height: 180px; padding: 24px 18px; border-radius: 8px; }
body.customer-layout .clone-dropzone > [data-icon] { display: grid; place-items: center; width: 58px; height: 58px; margin-bottom: 10px; }
body.customer-layout .clone-dropzone svg { width: 32px; height: 32px; }
body.customer-layout .clone-saved-panel { border-radius: 8px; padding: 16px; }
body.customer-layout #cloneText { min-height: 260px; padding: 16px; border-radius: 8px; }
body.customer-layout .clone-adjustments { grid-template-columns: 1fr; gap: 18px; }
body.customer-layout .clone-adjustments > div { padding: 16px; border: 1px solid var(--line); border-radius: 8px; }
body.customer-layout .clone-generate-row { flex-direction: column; align-items: stretch; gap: 14px; }
body.customer-layout .clone-generate-row .button { width: 100%; min-height: 50px; justify-content: center; }
body.customer-layout .clone-history-column {
    position: sticky;
    top: 20px;
    max-height: calc(100dvh - 140px);
    overflow-y: auto;
    overscroll-behavior: contain;
}
body.customer-layout .clone-history-column > .clone-card { padding: 16px; min-height: 280px; }
body.customer-layout .clone-history-column .history-row { border: 1px solid var(--line); border-radius: 8px; margin: 12px 0; padding: 14px; }

@media (min-width: 1181px) {
    body.customer-layout .srt-card > .srt-settings {
        display: grid;
        grid-template-columns: minmax(0, 1.1fr) minmax(0, .9fr);
        column-gap: 16px;
        align-items: start;
    }
    body.customer-layout .srt-card > .srt-settings > :is(h3, .srt-voice, button, .srt-help, .srt-cost) { grid-column: 1 / -1; }
    body.customer-layout .srt-card > .srt-settings > label { grid-column: 1; margin-top: 20px; }
    body.customer-layout .srt-card > .srt-settings > select { grid-column: 1; }
    body.customer-layout .srt-card > .srt-settings > .srt-mode { grid-column: 2; grid-row: 4 / 6; }
}

@media (max-width: 1360px) and (min-width: 1181px) {
    body.customer-layout .clone-sample-grid { grid-template-columns: 1fr; }
    body.customer-layout :is(.conversation-generate-row, .voice-change-generate, .isolator-generate, .transcription-generate) { flex-wrap: wrap; }
    body.customer-layout :is(.conversation-generate-row, .voice-change-generate, .isolator-generate, .transcription-generate) .button { width: 100%; }
}

@media (max-width: 1180px) {
    body.customer-layout :is(.conversation-grid, .voice-change-grid, .isolator-grid, .transcription-grid, .srt-grid, .clone-layout) {
        grid-template-columns: minmax(0, 1fr);
        gap: 20px;
    }
    body.customer-layout :is(.conversation-sidebar, .voice-change-history, .isolator-sidebar, .transcription-sidebar, .srt-sidebar, .clone-history-column) {
        position: static;
        max-height: none;
        overflow: visible;
    }
    body.customer-layout .conversation-speakers { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
    body.customer-layout .conversation-controls { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; }
    body.customer-layout .conversation-controls > div + div { margin-top: 0; }
    body.customer-layout .clone-sample-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    body.customer-layout .clone-adjustments { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 640px) {
    body.customer-layout :is(.conversation-editor, .conversation-sidebar, .voice-change-card, .voice-change-history,
        .isolator-card, .isolator-history, .transcription-card, .transcription-history, .transcription-result, .srt-card, .srt-history) {
        padding: 16px;
        border-radius: 16px;
    }
    body.customer-layout :is(.voice-change-dropzone, .isolator-dropzone, .transcription-dropzone, .srt-dropzone) {
        min-height: 220px;
        padding: 32px 16px;
        border-radius: 12px;
    }
    body.customer-layout :is(.conversation-footer, .voice-change-footer, .isolator-footer, .transcription-footer) {
        margin: 16px -16px -16px;
        padding: 16px;
    }
    body.customer-layout :is(.conversation-generate-row, .voice-change-generate, .isolator-generate, .transcription-generate) { flex-wrap: wrap; }
    body.customer-layout :is(.conversation-generate-row, .voice-change-generate, .isolator-generate, .transcription-generate) .button { width: 100%; }
    body.customer-layout :is(.conversation-speakers, .conversation-controls, .clone-sample-grid, .clone-adjustments) { grid-template-columns: 1fr; }
    body.customer-layout :is(.isolator-column, .transcription-column) > :is(.isolator-about, .transcription-about) ul { grid-template-columns: 1fr; }
    body.customer-layout .voice-change-target { padding: 16px; }
    body.customer-layout .voice-change-voice { flex-wrap: wrap; }
    body.customer-layout .voice-change-voice .small-button { width: 100%; }
    body.customer-layout .conversation-toolbar > span { margin-left: 0; }
    body.customer-layout .clone-card { padding: 16px; }
    body.customer-layout .clone-step-heading { flex-wrap: wrap; }
    body.customer-layout .srt-settings { padding: 16px; }
}
