/* Caption, library and account surfaces keep SlicePost's own fonts and colors.
   Preview pixels and caption preset samples are intentionally excluded. */
.apple-intake :is(h1, h2, h3) { text-wrap: balance; }
.apple-intake :is(.source-intake-message, .source-message, .control-help) {
    font-size: .875rem; line-height: 1.55; color: var(--v2-muted);
}
.apple-intake :is(.source-intake-url-row input, .source-intake-url-row button) {
    font-size: 1rem; min-height: 48px;
}
.apple-intake .source-intake-divider { font-size: .8125rem; letter-spacing: .02em; text-transform: none; }
.apple-intake .source-intake-dropzone { border-width: 1px; background: var(--v2-slate); }
.apple-intake .source-intake-icon { box-shadow: none; }

/* Caption Maker shares a single white canvas with its intake in light mode.
   Media/preset artwork remains independent of the interface surface. */
html[data-theme="light"] body.captions-page-v4.apple-intake {
    --ink: #fff;
    background: #fff;
}
html[data-theme="light"] body.captions-page-v4.apple-intake :is(.caption-source-bar.source-intake-shell,
    .caption-source-bar.source-intake-shell .source-intake-dropzone, .source-path-stack, .source-message) {
    background: #fff;
}
html[data-theme="light"] body.captions-page-v4.apple-intake .source-intake-dropzone:is(:hover, .drag, .is-dragover) {
    background: #fff;
    border-color: var(--v2-blue);
}

/* Styles and options form a single setup column; the preview remains in view. */
body.captions-page-v4.apple-intake .caption-workspace-grid {
    grid-template-columns: minmax(0, 1.35fr) minmax(340px, .85fr);
    grid-template-areas: "style preview" "layout preview"; gap: 20px;
}
body.captions-page-v4.apple-intake .caption-workspace-grid > section { padding: 24px; }
body.captions-page-v4.apple-intake .workflow-card:not(.source-intake-shell) { background: var(--v2-slate); box-shadow: none; }
body.captions-page-v4.apple-intake .caption-source-bar.source-intake-shell {
    width: min(100%, 880px); margin-inline: auto;
    background: transparent; box-shadow: none;
}
body.captions-page-v4.apple-intake .caption-source-bar.source-intake-shell .source-intake-dropzone {
    background: transparent; border-color: var(--v2-border-strong); box-shadow: none;
}
body.captions-page-v4.apple-intake .caption-source-bar.source-intake-shell .source-intake-dropzone:is(.drag, .is-dragover) {
    border-color: var(--v2-blue);
}
.apple-intake .caption-page-intro { margin-bottom: 22px; }
.apple-intake .caption-page-intro > div { grid-column: 2; min-width: 0; }
.apple-intake .caption-intro-copy { margin: 9px 0 0; color: var(--v2-muted); font-size: 1rem; line-height: 1.5; text-align: center; }
.apple-intake .panel-heading h2 { margin: 0; font-size: 1.125rem; font-weight: 750; line-height: 1.3; letter-spacing: -.02em; color: var(--v2-white); }
.apple-intake .panel-heading > p:not(.workflow-step):not(.step-label) { font-size: .9375rem; line-height: 1.55; }
.apple-intake :is(.workflow-step, .step-label) { font: 650 .8125rem/1.4 Manrope, sans-serif; letter-spacing: .01em; text-transform: none; color: var(--v2-muted); }
.apple-intake .caption-layout-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; }
.apple-intake :is(.caption-layout-grid > label, .compact-controls label, .control-field, .caption-position-label) { font-size: .9375rem; font-weight: 650; color: var(--v2-white); }
.apple-intake :is(.caption-layout-grid select, .compact-controls select, .control-field input[type="text"]) { min-height: 46px; font-size: .9375rem; }
.apple-intake .caption-option-grid { border-top: 1px solid var(--v2-border); margin-top: 24px; padding-top: 20px; }
.apple-intake .toggle-row strong { font-size: .9375rem; }
.apple-intake .toggle-row small { font-size: .875rem; line-height: 1.5; }
.apple-intake .history-section { margin-top: 28px; background: var(--v2-slate); box-shadow: none; }
body.captions-page-v4.apple-intake .history-section.sp-project-gallery { background: transparent; }
.apple-intake :is(.history-subtitle, .history-meta, .caption-viewer-meta) { font-size: .875rem; line-height: 1.5; }
.apple-intake .history-meta { font-family: Manrope, sans-serif; color: var(--v2-muted); }
.apple-intake .history-card h3 { font-size: 1rem; line-height: 1.45; white-space: normal; overflow-wrap: anywhere; }
.apple-intake :is(.history-action, .history-head button, .history-select) { min-height: 44px; font: 650 .875rem/1.2 Manrope, sans-serif; letter-spacing: 0; text-transform: none; }
.apple-intake .history-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); margin-top: 14px; gap: 8px; }
.apple-intake .history-actions .history-action { width: 100%; justify-content: center; font-size: .9375rem; }
.apple-intake .history-actions .history-delete { color: var(--v2-red); }
html[data-theme="light"] body.captions-page-v4.apple-intake .history-delete { color: var(--v2-red); }
.apple-intake .history-card[aria-busy="true"] { border-color: var(--v2-border-strong); }
.apple-intake .history-card[aria-busy="true"] .history-thumb { opacity: .65; }
.apple-intake .history-actions .history-delete[aria-busy="true"] { min-width: 100px; }
.apple-intake .history-head { align-items: center; flex-wrap: wrap; }
.apple-intake .history-select { padding-block: 8px; }
.apple-intake .caption-viewer-actions { background: var(--v2-slate); }

/* Correction tools share the same reading surface in both themes. */
.apple-intake .caption-transcript-dialog { background: var(--v2-slate); }
.apple-intake .caption-transcript-head { padding: 20px 24px; }
.apple-intake .caption-transcript-head h2 { color: var(--v2-white); font-size: 1.25rem; line-height: 1.3; letter-spacing: -.02em; }
.apple-intake .caption-transcript-head p:not(.step-label) { font-size: .9375rem; line-height: 1.5; }
.apple-intake :is(.caption-transcript-toolbar, .caption-transcript-foot) { background: var(--v2-slate); }
.apple-intake :is(.caption-transcript-tool, .caption-transcript-find-row input) { min-height: 44px; font-size: .875rem; }
.apple-intake .caption-transcript-tool { color: var(--v2-white); background: var(--v2-fill); }
.apple-intake .caption-transcript-tool:hover { color: var(--v2-white); background: var(--v2-fill-hover); }
.apple-intake :is(.caption-transcript-count, .caption-transcript-time, .caption-transcript-foot > span, .caption-transcript-status) { font-size: .8125rem; line-height: 1.5; }
.apple-intake .caption-transcript-card { padding: 12px 8px; grid-template-columns: 100px minmax(0, 1fr); }
.apple-intake .caption-transcript-card-text { color: var(--v2-white); background: var(--v2-fill); font-size: 1rem; line-height: 1.6; }
.apple-intake .caption-transcript-card-text:focus { background: var(--v2-fill-hover); }
.apple-intake .caption-transcript-tools > div { background: var(--v2-slate); transform-origin: top right; border-color: var(--v2-border-strong); }
.apple-intake .caption-transcript-foot { align-items: center; }
.apple-intake .caption-transcript-foot .btn-primary { min-height: 44px; font-size: .9375rem; }

/* The standalone library reads as source intake, saved sessions, finished clips. */
body.editor-page.apple-intake main { padding: 32px 0 56px; }
body.editor-page.apple-intake .wrap { width: min(1180px, calc(100% - 40px)); }
body.editor-page.apple-intake :is(.recent, .rendered-projects) { max-width: none; margin-top: 28px; }
.apple-intake .editor-library-header { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px; }
body.editor-page.apple-intake :is(.recent h3, .rendered-projects h3) { color: var(--v2-white); font-size: 1.25rem; line-height: 1.35; letter-spacing: -.015em; text-transform: none; margin: 0; }
body.editor-page.apple-intake .recent h3 { margin-bottom: 14px; }
.apple-intake .rendered-copy { max-width: 70ch; font-size: .9375rem; line-height: 1.55; margin-top: 8px; }
.apple-intake .editor-history-message:empty { display: none; }
.apple-intake .recent-item { min-height: 76px; background: var(--v2-slate); }
.apple-intake .recent-item .r-title { font-size: 1rem; white-space: normal; overflow-wrap: anywhere; }
.apple-intake .recent-item .r-meta { font: 500 .875rem/1.4 Manrope, sans-serif; color: var(--v2-muted); white-space: normal; }
.apple-intake .recent-item .r-open { font-size: .9375rem; }
.apple-intake .recent-session {
    display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center;
    border: 1px solid var(--v2-border); border-radius: 12px; background: var(--v2-slate);
}
.apple-intake .recent-session .recent-item { border: 0; background: transparent; }
.apple-intake .recent-session > button { min-height: 44px; margin: 10px 14px 10px 0; font-size: .875rem; }
.apple-intake .recent-more summary { min-height: 44px; display: flex; align-items: center; font-size: .9375rem; }
.apple-intake .recent-more summary::after { content: "⌄"; margin-left: auto; font-size: 1.125rem; }
.apple-intake .recent-more[open] summary::after { transform: rotate(180deg); }
.apple-intake .rendered-project { background: var(--v2-slate); }
.apple-intake .rendered-project-summary { padding: 16px; }
.apple-intake .rendered-project-copy strong { font-size: 1rem; line-height: 1.45; white-space: normal; overflow-wrap: anywhere; }
.apple-intake .rendered-project-copy span { font: 500 .875rem/1.5 Manrope, sans-serif; color: var(--v2-muted); }
.apple-intake .rendered-project-open { font-size: .875rem; }
.apple-intake .rendered-project-clips { padding: 0 16px 16px; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; }
/* A lone portrait export must not stretch across the expanded project row. */
body.editor-page.apple-intake .sp-project-gallery .rendered-project-clips {
    grid-template-columns: repeat(auto-fill, minmax(min(300px, 100%), 1fr));
}
.apple-intake .rendered-card { background: var(--v2-fill); }
.apple-intake .rendered-card-body { gap: 10px; padding: 16px; }
.apple-intake .rendered-title { font-size: 1rem; line-height: 1.4; }
.apple-intake .rendered-meta { font-size: .875rem; color: var(--v2-muted); }
.apple-intake .rendered-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.apple-intake .rendered-actions .btn { min-height: 44px; font-size: .875rem; padding: 8px 10px; }
.apple-intake .history-empty { font-size: .9375rem; line-height: 1.55; padding: 20px; }

/* Usage stays prominent; developer controls remain a deliberate deeper step. */
.apple-intake .cloud-account { max-width: 1160px; }
.apple-intake :is(.cloud-account-hero h1, .account-hero h1) { font-size: clamp(2rem, 3.5vw, 2.5rem); letter-spacing: -.025em; line-height: 1.2; }
.apple-intake .cloud-account-grid { margin-top: 20px; }
.apple-intake .cloud-account-card h2 { font-size: clamp(1.5rem, 2.2vw, 1.875rem); line-height: 1.3; }
.apple-intake .cloud-account-advanced { border: 1px solid var(--v2-border-strong); border-radius: 16px; padding: 0; background: var(--v2-slate); }
.apple-intake .cloud-account-advanced > summary { padding: 20px 24px; }
.apple-intake .cloud-account-advanced .cloud-developer { margin-top: 0; padding: 0 24px 24px; }
.apple-intake :is(.cloud-key-form input:not([type]), .cloud-key-form select, .cloud-secret-row input, .developer-token-form input, .developer-token-form select) { font-size: 1rem; min-height: 46px; }
.apple-intake :is(.cloud-key-form label > span, .cloud-key-form legend, .cloud-scope-grid strong, .developer-token-form label, .developer-token-form legend) { font-size: .9375rem; }
.apple-intake :is(.cloud-scope-grid span, .cloud-token-row span, .cloud-token-row small, .cloud-key-count) { font-size: .875rem; line-height: 1.5; }
.apple-intake :is(.cloud-button, .cloud-revoke-button, .cloud-code-card button, .cloud-endpoint-row button) { min-height: 44px; font-size: .875rem; }
.apple-intake .cloud-endpoint-row code { flex: 1 1 200px; }
.apple-intake .account-portal { padding-top: 36px; }
/* A fill with no padding drew a stray gray bar behind one line of text. */
.apple-intake .account-preview-note { margin-top: 8px; color: var(--v2-muted); }
.apple-intake .developer-access { padding: 24px; background: var(--v2-slate); border-color: var(--v2-border-strong); }
.apple-intake .developer-access-heading h2 { font-size: 1.5rem; line-height: 1.35; }
.apple-intake .developer-panel { background: transparent; border-color: var(--v2-border); }
.apple-intake .developer-panel p { font-size: .9375rem; line-height: 1.55; }
.apple-intake .developer-inline-copy { min-height: 44px; }

@media (max-width: 980px) {
    body.captions-page-v4.apple-intake .caption-workspace-grid { grid-template-columns: 1fr; grid-template-areas: "preview" "style" "layout"; }
    .apple-intake .caption-page-intro > div { grid-column: 1; }
}
@media (max-width: 620px) {
    body.captions-page-v4.apple-intake .caption-workspace-grid > section { padding: 18px; }
    .apple-intake .caption-layout-grid { grid-template-columns: 1fr; gap: 16px; }
    .apple-intake .caption-transcript-head { flex-wrap: wrap; padding: 16px; }
    .apple-intake .caption-transcript-head-actions { margin-left: auto; }
    .apple-intake .caption-transcript-card { grid-template-columns: 1fr; }
    .apple-intake .caption-transcript-foot { padding: 16px; }
    .apple-intake .caption-transcript-foot .btn-primary { flex: 1; }
    .apple-intake .history-head-actions { width: 100%; }
    .apple-intake .history-head-actions button { flex: 1; }
    body.editor-page.apple-intake .wrap { width: calc(100% - 24px); }
    .apple-intake .recent-session { grid-template-columns: 1fr; }
    .apple-intake .recent-session > button { justify-self: end; margin: 0 14px 12px; }
    .apple-intake .rendered-project-clips { grid-template-columns: 1fr; }
    .apple-intake .cloud-account-advanced > summary { padding: 18px; }
    .apple-intake .cloud-account-advanced .cloud-developer { padding: 0 12px 18px; }
    .apple-intake .cloud-developer-layout { border: 0; }
    .apple-intake .developer-access { padding: 18px; }
    .apple-intake .developer-panel { padding: 16px; }
}
@media (pointer: coarse), (max-width: 760px) {
    .apple-intake :is(.caption-layout-grid select, .compact-controls select, .control-field input[type="text"], .caption-transcript-find-row input) { font-size: 1rem; }
}
/* Native dialogs use auto margins so they stay centered at every viewport. */
.cloud-secret-dialog {
    inset: 0;
    margin: auto !important;
    width: min(600px, calc(100% - 32px)) !important;
    max-height: calc(100dvh - 32px);
    overflow-y: auto;
    box-sizing: border-box;
}
.cloud-secret-dialog .cloud-secret-card { width: 100%; max-width: none; margin: 0; box-sizing: border-box; }
