:root {
    --swift-bg: #0b1220;
    --swift-surface: rgba(13, 20, 35, 0.82);
    --swift-surface-strong: rgba(19, 28, 46, 0.94);
    --swift-border: rgba(155, 196, 255, 0.18);
    --swift-text: #ecf3ff;
    --swift-muted: #a9b8d0;
    --swift-accent: #5fe0b2;
    --swift-accent-strong: #0ea77f;
    --swift-warm: #ff9f67;
    --swift-danger: #ff6f7d;
}

* {
    box-sizing: border-box;
}

body.swift-shell {
    min-height: 100vh;
    margin: 0;
    color: var(--swift-text);
    font-family: "Source Sans 3", sans-serif;
    background:
        radial-gradient(circle at top left, rgba(95, 224, 178, 0.14), transparent 28%),
        radial-gradient(circle at bottom right, rgba(255, 159, 103, 0.2), transparent 32%),
        linear-gradient(145deg, #09111d 0%, #111d31 52%, #0b1220 100%);
}

.page-glow {
    position: fixed;
    width: 26rem;
    height: 26rem;
    border-radius: 50%;
    filter: blur(48px);
    opacity: 0.24;
    pointer-events: none;
    z-index: 0;
}

.page-glow-left {
    top: -8rem;
    left: -7rem;
    background: #0db287;
}

.page-glow-right {
    right: -7rem;
    bottom: -8rem;
    background: #f78c4a;
}

.container,
.container-fluid {
    position: relative;
    z-index: 1;
}

h1, h2, h3, h4, h5 {
    font-family: "Space Grotesk", sans-serif;
    letter-spacing: -0.03em;
}

.eyebrow {
    margin: 0;
    color: var(--swift-accent);
    font-weight: 700;
    font-size: 0.78rem;
    letter-spacing: 0.18em;
    text-transform: uppercase;
}

.swift-title {
    display: inline-flex;
    align-items: baseline;
    gap: 0.45rem;
}

.swift-header-bar {
    min-width: 0;
}

.swift-title-accent {
    background: linear-gradient(135deg, var(--swift-accent) 0%, #b5ffde 100%);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.swift-header,
.swift-card,
.swift-panel {
    border: 1px solid var(--swift-border);
    background: var(--swift-surface);
    backdrop-filter: blur(22px);
    box-shadow: 0 24px 60px rgba(5, 10, 20, 0.28);
}

.swift-header {
    border-radius: 1.8rem;
}

.swift-card {
    border-radius: 1.5rem;
}

.swift-stage-card {
    display: flex;
    flex-direction: column;
    min-height: 44rem;
}

.swift-summary-stage {
    width: min(100%, 1080px);
    margin-inline: auto;
}

.swift-panel {
    border-radius: 1rem;
}

.swift-config-stack {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    height: 100%;
    flex: 1 1 auto;
    min-height: 0;
}

.swift-input-type-block {
    order: 1;
}

.swift-summary-mode-block {
    order: 2;
}

.swift-prompt-block {
    order: 3;
}

.swift-mobile-config-toggle-row {
    display: none;
}

.swift-prompt-block {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    min-height: 0;
    justify-content: stretch;
    gap: 0.85rem;
}

.swift-mode-actions {
    display: inline-flex;
    align-items: center;
    gap: 0.55rem;
}

.swift-mode-create-row {
    display: flex;
    justify-content: center;
    margin-top: 0.35rem;
    margin-bottom: -0.55rem;
}

.swift-mode-action-button {
    width: 2.3rem;
    height: 2.3rem;
    padding: 0;
    display: inline-grid;
    place-items: center;
    font-size: 1.2rem;
    line-height: 1;
}

.swift-mode-grid-custom {
    grid-column: 1 / -1;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
}

.swift-mode-create-button {
    width: 2.75rem;
    height: 2.75rem;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.35rem;
    line-height: 1;
    text-align: center;
}

.prompt-template-status {
    min-height: 0;
}

.prompt-template-status .alert {
    margin-bottom: 0;
}

.swift-modal-shell {
    border-radius: 1.5rem;
    border: 1px solid var(--swift-border);
    background: #162133;
    color: var(--swift-text);
    box-shadow: 0 28px 80px rgba(5, 10, 20, 0.42);
    overflow: hidden;
}

.swift-modal-shell .modal-header,
.swift-modal-shell .modal-body,
.swift-modal-shell .modal-footer {
    background: #162133;
}

.swift-modal-shell .swift-input,
.swift-modal-shell .swift-input:focus {
    background: #202b3f;
    border-color: rgba(255, 255, 255, 0.14);
}

.swift-template-prompt {
    min-height: 10rem;
    height: 10rem;
    max-height: none;
    resize: vertical;
}

.swift-checkbox {
    display: inline-flex;
    align-items: center;
    gap: 0.7rem;
    color: var(--swift-text);
    cursor: pointer;
}

.swift-checkbox input {
    width: 1rem;
    height: 1rem;
    accent-color: var(--swift-accent-strong);
}

.swift-login-card {
    animation: rise-in 0.7s ease-out;
}

.status-chip {
    display: inline-flex;
    align-items: center;
    padding: 0.55rem 0.95rem;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.08);
    color: var(--swift-text);
    font-size: 0.92rem;
}

.account-cluster {
    display: inline-flex;
    align-items: center;
    gap: 0.55rem;
    padding: 0.45rem;
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(255, 255, 255, 0.04);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.account-name {
    display: inline-flex;
    align-items: center;
    min-height: 2.5rem;
    padding: 0 1rem;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.06);
    color: var(--swift-text);
    font-weight: 600;
}

.account-logout {
    min-height: 2.5rem;
    padding: 0 1rem;
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, 0.7);
    background: transparent;
    color: var(--swift-text);
    font-weight: 600;
    transition: background 0.18s ease, border-color 0.18s ease, color 0.18s ease;
}

.account-logout:hover,
.account-logout:focus {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.95);
    color: var(--swift-text);
}

.text-secondary,
.form-text,
.form-check-label,
.section-label {
    color: var(--swift-muted) !important;
}

.section-label {
    display: inline-block;
    margin-bottom: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-size: 0.77rem;
}

.swift-input,
.swift-input:focus,
.form-select.swift-input {
    border-radius: 1rem;
    border: 1px solid rgba(255, 255, 255, 0.12);
    background: rgba(255, 255, 255, 0.04);
    color: var(--swift-text);
    box-shadow: none;
}

.swift-select {
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    padding-right: 2.9rem;
    background-image:
        linear-gradient(45deg, transparent 50%, rgba(236, 243, 255, 0.72) 50%),
        linear-gradient(135deg, rgba(236, 243, 255, 0.72) 50%, transparent 50%);
    background-position:
        calc(100% - 1.15rem) calc(50% - 0.16rem),
        calc(100% - 0.8rem) calc(50% - 0.16rem);
    background-size: 0.45rem 0.45rem, 0.45rem 0.45rem;
    background-repeat: no-repeat;
}

.swift-select option {
    color: #0f172a;
    background: #eef4ff;
}

.swift-input::placeholder {
    color: rgba(236, 243, 255, 0.42);
}

.swift-prompt {
    min-height: 0;
    height: 100%;
    flex: 1 1 auto;
    width: 100%;
    max-height: none;
    overflow-y: auto;
    resize: none;
}

.swift-transcript {
    min-height: 0;
}

.swift-source-card {
    display: flex;
    flex-direction: column;
}

.swift-source-card #transcriptPanel,
.swift-source-card #recordingPanel {
    flex: 1 1 auto;
    min-height: 0;
}

.swift-source-card #transcriptPanel > div,
.swift-source-card #recordingPanel > div {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    min-height: 0;
}

.swift-submit-row {
    width: 100%;
    margin-top: 0.25rem;
}

.swift-loading {
    position: fixed;
    inset: 0;
    z-index: 1200;
    display: grid;
    align-content: center;
    justify-items: center;
    gap: 0.7rem;
    padding: 1.5rem;
    background: rgba(5, 10, 20, 0.58);
    backdrop-filter: blur(10px);
}

.swift-loader-scene {
    position: relative;
    display: grid;
    place-items: center;
    width: min(100%, 24rem);
    min-height: 12rem;
    padding: 2.2rem 1.75rem 1.2rem;
    margin: 0;
    border-radius: 1.75rem;
    border: 1px solid rgba(155, 196, 255, 0.22);
    background:
        radial-gradient(circle at 50% 14%, rgba(95, 224, 178, 0.18), transparent 36%),
        radial-gradient(circle at 24% 18%, rgba(255, 159, 103, 0.15), transparent 28%),
        linear-gradient(180deg, rgba(18, 29, 48, 0.96), rgba(10, 18, 31, 0.94));
    box-shadow: 0 30px 80px rgba(3, 8, 16, 0.42);
    backdrop-filter: blur(20px);
    overflow: hidden;
}

.swift-loader-scene::before {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: inherit;
    border: 1px solid rgba(255, 255, 255, 0.04);
    pointer-events: none;
}

.swift-loader-glow {
    position: absolute;
    inset: auto 50% 1rem;
    width: 8rem;
    height: 2rem;
    transform: translateX(-50%);
    border-radius: 50%;
    background: radial-gradient(circle, rgba(95, 224, 178, 0.34), rgba(95, 224, 178, 0));
    filter: blur(8px);
    animation: swift-glow-pulse 1.15s ease-in-out infinite;
}

.swift-loader-bird {
    position: relative;
    z-index: 1;
    width: 13.5rem;
    max-width: 100%;
    overflow: visible;
    filter: drop-shadow(0 12px 28px rgba(7, 15, 27, 0.34));
    animation: swift-bird-float 1.15s ease-in-out infinite;
}

.swift-loader-wing,
.swift-loader-body,
.swift-loader-head,
.swift-loader-tail,
.swift-loader-beak {
    transform-box: fill-box;
}

.swift-loader-wing {
    fill: rgba(129, 194, 255, 0.88);
    transform-box: view-box;
}

.swift-loader-wing-left {
    transform-origin: 107px 61px;
    animation: swift-wing-left 1.15s ease-in-out infinite;
}

.swift-loader-wing-right {
    transform-origin: 113px 61px;
    animation: swift-wing-right 1.15s ease-in-out infinite;
}

.swift-loader-body {
    fill: url(#swift-body-gradient);
}

.swift-loader-head {
    fill: #e8f5ff;
}

.swift-loader-tail {
    fill: rgba(95, 224, 178, 0.92);
}

.swift-loader-beak {
    fill: var(--swift-warm);
}

.swift-loader-trails {
    position: absolute;
    inset: 50% auto auto 4rem;
    display: grid;
    gap: 0.5rem;
    transform: translateY(-50%);
}

.swift-loader-trails span {
    display: block;
    width: 3.25rem;
    height: 0.14rem;
    border-radius: 999px;
    background: linear-gradient(90deg, rgba(95, 224, 178, 0), rgba(95, 224, 178, 0.65));
    animation: swift-trail 1.15s linear infinite;
}

.swift-loader-trails span:nth-child(2) {
    width: 2.45rem;
    margin-left: 0.55rem;
    animation-delay: 0.18s;
}

.swift-loader-trails span:nth-child(3) {
    width: 1.75rem;
    margin-left: 1.05rem;
    animation-delay: 0.36s;
}

.swift-loading-text {
    color: #d9f9ed;
    font-family: "Space Grotesk", sans-serif;
    font-size: 1.12rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    text-align: center;
    position: relative;
    z-index: 1;
    margin: 0;
}

.swift-loading-subtext {
    position: relative;
    z-index: 1;
    margin: 0;
    color: var(--swift-muted);
    font-size: 0.96rem;
    text-align: center;
}

body.swift-loading-active {
    overflow: hidden;
}

body.swift-loading-active .swift-submit-row #statusArea,
body.swift-loading-active #summarySection {
    pointer-events: none;
}

.swift-submit-row #statusArea {
    width: min(100%, 720px);
    justify-self: center;
}

.summary-action-status {
    width: min(100%, 720px);
    margin-inline: auto;
}

.summary-action-row {
    width: 100%;
}

.swift-source-card .swift-transcript {
    flex: 1 1 auto;
    height: 100%;
}

.swift-toggle-grid,
.swift-mode-grid {
    display: grid;
    gap: 0.9rem;
}

.swift-toggle-grid {
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

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

.swift-choice {
    position: relative;
    display: block;
    cursor: pointer;
}

.swift-choice input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.swift-choice span {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    min-height: 100%;
    padding: 1rem 1.1rem;
    border-radius: 1rem;
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(255, 255, 255, 0.035);
    transition: transform 0.18s ease, border-color 0.18s ease, background 0.18s ease;
}

.swift-choice strong {
    font-family: "Space Grotesk", sans-serif;
    font-size: 1rem;
}

.swift-choice small {
    color: var(--swift-muted);
    font-size: 0.92rem;
}

.swift-choice input:checked + span {
    transform: translateY(-2px);
    border-color: rgba(95, 224, 178, 0.72);
    background: linear-gradient(180deg, rgba(95, 224, 178, 0.12), rgba(255, 255, 255, 0.04));
}

.swift-choice.disabled {
    opacity: 0.92;
}

.btn-swift {
    border: none;
    border-radius: 999px;
    padding-inline: 1.35rem;
    color: #072018;
    font-weight: 700;
    background: linear-gradient(135deg, var(--swift-accent) 0%, #b5ffde 100%);
    box-shadow: 0 12px 24px rgba(95, 224, 178, 0.22);
}

.btn-swift:hover,
.btn-swift:focus {
    color: #072018;
    background: linear-gradient(135deg, #73ebc0 0%, #ceffe9 100%);
}

.btn-outline-light {
    border-radius: 999px;
}

.swift-mode-actions .btn-outline-light,
.swift-modal-shell .btn-outline-light {
    border-color: rgba(255, 255, 255, 0.16);
    background: rgba(255, 255, 255, 0.035);
}

.swift-mode-actions .btn-outline-light:hover,
.swift-mode-actions .btn-outline-light:focus,
.swift-modal-shell .btn-outline-light:hover,
.swift-modal-shell .btn-outline-light:focus {
    background: rgba(255, 255, 255, 0.08);
}

.swift-summary-shell {
    min-height: 28rem;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 1.2rem;
    background: rgba(255, 255, 255, 0.035);
    overflow: hidden;
}

.summary-placeholder,
.summary-editor {
    min-height: 28rem;
    padding: 1.25rem;
}

.summary-placeholder {
    color: var(--swift-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
}

.summary-editor {
    outline: none;
    overflow-y: auto;
}

.summary-editor p:last-child,
.summary-editor ul:last-child,
.summary-editor ol:last-child {
    margin-bottom: 0;
}

.summary-editor h2,
.summary-editor h3,
.summary-editor h4 {
    margin: 1.25rem 0 0.65rem;
    color: #f6fbff;
    font-family: "Space Grotesk", sans-serif;
    letter-spacing: -0.02em;
}

.summary-editor h2:first-child,
.summary-editor h3:first-child,
.summary-editor h4:first-child {
    margin-top: 0;
}

.summary-editor p {
    margin-bottom: 0.85rem;
    line-height: 1.6;
    color: #dfe9f8;
}

.summary-editor ul,
.summary-editor ol {
    padding-left: 1.35rem;
    margin-bottom: 1rem;
}

.summary-editor li {
    margin-bottom: 0.4rem;
    line-height: 1.55;
    color: #dfe9f8;
}

.summary-editor strong {
    color: #ffffff;
}

.alert {
    border-radius: 1rem;
    border: none;
}

.alert-success {
    background: rgba(95, 224, 178, 0.14);
    color: #dffff3;
}

.alert-info {
    background: rgba(129, 194, 255, 0.14);
    color: #deefff;
}

.alert-danger {
    background: rgba(255, 111, 125, 0.14);
    color: #ffe3e7;
}

@keyframes swift-bird-float {
    0%,
    100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-5px);
    }
}

@keyframes swift-wing-left {
    0%,
    100% {
        transform: rotate(16deg) scaleY(1);
    }
    50% {
        transform: rotate(-22deg) translateY(-3px) scaleY(0.92);
    }
}

@keyframes swift-wing-right {
    0%,
    100% {
        transform: rotate(-16deg) scaleY(1);
    }
    50% {
        transform: rotate(22deg) translateY(-3px) scaleY(0.92);
    }
}

@keyframes swift-trail {
    0% {
        opacity: 0;
        transform: translateX(0.6rem) scaleX(0.6);
    }
    30% {
        opacity: 1;
    }
    100% {
        opacity: 0;
        transform: translateX(-1rem) scaleX(1);
    }
}

@keyframes swift-glow-pulse {
    0%,
    100% {
        opacity: 0.45;
        transform: translateX(-50%) scale(0.9);
    }
    50% {
        opacity: 0.85;
        transform: translateX(-50%) scale(1.08);
    }
}

@keyframes rise-in {
    from {
        opacity: 0;
        transform: translateY(18px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@media (max-width: 991px) {
    .swift-stage-card {
        min-height: auto;
    }

    .swift-mobile-config-toggle-row {
        display: block;
        order: 1;
    }

    .swift-input-type-block {
        order: 2;
    }

    .swift-summary-mode-block {
        order: 3;
    }

    .swift-prompt-block {
        order: 4;
    }

    .swift-mobile-config-summary {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 1rem;
        width: 100%;
        padding: 0.95rem 1rem;
        border-radius: 1rem;
        border: 1px solid rgba(255, 255, 255, 0.08);
        background: rgba(255, 255, 255, 0.035);
        color: var(--swift-text);
        font-family: "Space Grotesk", sans-serif;
        font-size: 0.96rem;
        font-weight: 600;
        list-style: none;
        cursor: pointer;
        text-align: left;
    }

    .swift-mobile-config-copy {
        display: grid;
        gap: 0.2rem;
        min-width: 0;
    }

    .swift-mobile-config-title {
        color: var(--swift-text);
        font-size: 0.98rem;
        line-height: 1.2;
    }

    .swift-mobile-config-switch {
        position: relative;
        width: 3.35rem;
        height: 1.95rem;
        border-radius: 999px;
        background: rgba(255, 255, 255, 0.12);
        border: 1px solid rgba(255, 255, 255, 0.12);
        flex: 0 0 auto;
        transition: background 0.18s ease, border-color 0.18s ease;
    }

    .swift-mobile-config-switch-thumb {
        position: absolute;
        top: 0.14rem;
        left: 0.16rem;
        width: 1.45rem;
        height: 1.45rem;
        border-radius: 50%;
        background: #f7fbff;
        box-shadow: 0 6px 16px rgba(0, 0, 0, 0.2);
        transition: transform 0.18s ease;
    }

    .swift-mobile-config-summary[aria-expanded="true"] .swift-mobile-config-switch {
        background: rgba(62, 233, 178, 0.22);
        border-color: rgba(62, 233, 178, 0.4);
    }

    .swift-mobile-config-summary[aria-expanded="true"] .swift-mobile-config-switch-thumb {
        transform: translateX(1.36rem);
    }

    .swift-input-type-block,
    .swift-prompt-block {
        display: none;
    }

    .swift-config-stack.mobile-config-open .swift-input-type-block {
        display: block;
    }

    .swift-config-stack.mobile-config-open .swift-prompt-block {
        display: flex;
    }

    .account-name {
        display: none;
    }

    .account-cluster {
        padding: 0;
        border: none;
        background: transparent;
        box-shadow: none;
    }

    .account-logout {
        min-height: 2.2rem;
        padding: 0 0.9rem;
    }

    .swift-transcript,
    .swift-summary-shell,
    .summary-placeholder,
    .summary-editor {
        min-height: 20rem;
    }

    .swift-source-card .swift-transcript {
        min-height: 20rem;
    }
}

@media (max-width: 640px) {
    body.swift-login-screen {
        height: 100dvh;
        overflow: hidden;
    }

    .swift-login-page {
        height: 100dvh;
        overflow: hidden;
        padding-top: 1rem !important;
        padding-bottom: 1rem !important;
    }

    .swift-login-page .row {
        min-height: calc(100dvh - 2rem);
        margin: 0;
    }

    .swift-mode-grid,
    .swift-mode-grid-custom {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 0.7rem;
    }

    .swift-choice span {
        padding: 0.85rem 0.9rem;
    }

    .swift-choice strong {
        font-size: 0.95rem;
    }

    .swift-choice small {
        font-size: 0.84rem;
    }
}