:root {
    color-scheme: light;
    --ink: #172033;
    --muted: #687386;
    --line: #dfe4ec;
    --soft: #f5f7fa;
    --white: #fff;
    --blue: #2f66e8;
    --blue-dark: #1f4fc7;
    --blue-soft: #edf3ff;
    --green: #16805d;
    --amber: #a96b08;
    --red: #b93838;
    --shadow: 0 16px 45px rgba(23, 32, 51, .08);
    font-family: Inter, "Microsoft YaHei UI", "PingFang SC", system-ui, sans-serif;
}

* {
    box-sizing: border-box;
}

body {
    min-height: 100vh;
    margin: 0;
    color: var(--ink);
    background: radial-gradient(circle at 85% 8%, #eaf1ff 0, transparent 26rem), #f7f8fb;
}

button,
input {
    font: inherit;
}

button {
    cursor: pointer;
}

button:disabled {
    cursor: not-allowed;
    opacity: .5;
}

.hidden {
    display: none !important;
}

.topbar {
    position: sticky;
    top: 0;
    z-index: 20;
    display: flex;
    height: 68px;
    align-items: center;
    justify-content: space-between;
    padding: 0 max(24px, calc((100vw - 1180px) / 2));
    border-bottom: 1px solid rgba(223, 228, 236, .8);
    background: rgba(255, 255, 255, .82);
    backdrop-filter: blur(14px);
}

.brand {
    display: flex;
    align-items: center;
}

.brand-logo {
    display: block;
    width: auto;
    height: 48px;
    object-fit: contain;
}

.topbar-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.privacy-pill {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    border-radius: 99px;
    color: var(--green);
    background: #ecf8f3;
    font-size: 13px;
}

.status-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #20a777;
    box-shadow: 0 0 0 4px rgba(32, 167, 119, .12);
}

.language-button {
    width: 38px;
    height: 38px;
    border: 1px solid var(--line);
    border-radius: 10px;
    color: var(--ink);
    background: var(--white);
    font-weight: 700;
}

.page-shell {
    width: min(1180px, calc(100% - 32px));
    margin: 0 auto;
    padding: 58px 0 90px;
}

.hero {
    display: grid;
    grid-template-columns: 1.1fr .9fr;
    gap: 48px;
    align-items: end;
    margin-bottom: 38px;
}

.eyebrow {
    margin: 0 0 14px;
    color: var(--blue);
    font-size: 12px;
    font-weight: 800;
    letter-spacing: .16em;
}

h1 {
    max-width: 760px;
    margin: 0;
    font-size: clamp(34px, 5vw, 58px);
    line-height: 1.08;
    letter-spacing: -.045em;
}

.hero-copy {
    max-width: 720px;
    margin: 20px 0 0;
    color: var(--muted);
    font-size: 17px;
    line-height: 1.8;
}

.output-preview {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    margin: 0;
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 15px;
    background: var(--white);
    box-shadow: var(--shadow);
}

.output-preview div {
    min-width: 0;
    padding: 17px 14px;
    border-right: 1px solid var(--line);
}

.output-preview div:last-child {
    border-right: 0;
}

.output-preview dt {
    margin-bottom: 7px;
    color: var(--muted);
    font-size: 11px;
    font-weight: 700;
}

.output-preview dd {
    margin: 0;
    overflow: hidden;
    font-size: 13px;
    font-weight: 800;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.steps {
    display: flex;
    align-items: center;
    margin: 0 0 18px;
    padding: 0;
    list-style: none;
}

.steps li {
    display: flex;
    align-items: center;
    gap: 9px;
    color: #98a1b1;
    font-size: 13px;
    font-weight: 700;
}

.steps li:not(:last-child)::after {
    width: 58px;
    height: 1px;
    margin: 0 14px;
    background: var(--line);
    content: "";
}

.steps b {
    display: grid;
    width: 26px;
    height: 26px;
    place-items: center;
    border-radius: 50%;
    background: #e8ebf0;
}

.steps li.active {
    color: var(--blue);
}

.steps li.active b {
    color: var(--white);
    background: var(--blue);
}

.steps li.done b {
    color: var(--white);
    background: var(--green);
}

.card {
    margin-top: 18px;
    overflow: hidden;
    border: 1px solid rgba(223, 228, 236, .9);
    border-radius: 20px;
    background: var(--white);
    box-shadow: var(--shadow);
}

.section-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    padding: 23px 26px;
    border-bottom: 1px solid var(--line);
}

.section-heading > div:first-child {
    display: flex;
    align-items: center;
    gap: 12px;
}

.section-heading h2 {
    margin: 0;
    font-size: 19px;
    letter-spacing: -.02em;
}

.section-heading p {
    margin: 0;
    color: var(--muted);
    font-size: 13px;
    text-align: right;
}

.section-number {
    color: var(--blue);
    font-size: 11px;
    font-weight: 900;
    letter-spacing: .08em;
}

.dropzone {
    display: flex;
    min-height: 238px;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin: 26px;
    border: 1.5px dashed #b8c3d6;
    border-radius: 16px;
    outline: none;
    background: #fbfcfe;
    transition: border-color .2s ease, background-color .2s ease, transform .2s ease;
}

.dropzone:hover,
.dropzone.dragging {
    border-color: var(--blue);
    background: var(--blue-soft);
    transform: translateY(-1px);
}

.upload-icon {
    display: grid;
    width: 52px;
    height: 52px;
    place-items: center;
    border-radius: 14px;
    color: var(--blue);
    background: var(--blue-soft);
}

.upload-icon svg {
    width: 27px;
    fill: none;
    stroke: currentColor;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 1.8;
}

.dropzone strong {
    font-size: 16px;
}

.dropzone small {
    color: var(--muted);
}

.picker-actions {
    display: flex;
    gap: 10px;
    margin-top: 12px;
}

.primary-button,
.secondary-button,
.text-button {
    min-height: 42px;
    padding: 0 17px;
    border-radius: 10px;
    font-weight: 750;
}

.primary-button {
    border: 1px solid transparent;
    color: var(--white);
    background: var(--blue);
    box-shadow: 0 7px 16px rgba(47, 102, 232, .2);
}

.primary-button:hover:not(:disabled) {
    background: var(--blue-dark);
}

.secondary-button {
    border: 1px solid var(--line);
    color: var(--ink);
    background: var(--white);
}

.secondary-button:hover:not(:disabled) {
    border-color: #b8c3d6;
    background: var(--soft);
}

.text-button {
    min-height: auto;
    padding: 5px;
    border: 0;
    color: var(--blue);
    background: transparent;
}

.settings-grid {
    display: grid;
    grid-template-columns: minmax(280px, 1.5fr) 1fr 1fr;
    gap: 18px;
    padding: 26px;
}

.toggle-setting,
.number-setting {
    display: flex;
    min-height: 78px;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    padding: 15px 17px;
    border: 1px solid var(--line);
    border-radius: 13px;
    background: #fbfcfe;
}

.toggle-setting > span:first-child {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.toggle-setting small {
    color: var(--muted);
    font-size: 12px;
    line-height: 1.4;
}

.toggle {
    position: relative;
    display: block;
    flex: 0 0 42px;
    width: 42px;
    height: 24px;
}

.toggle input {
    position: absolute;
    z-index: 1;
    inset: 0;
    width: 100%;
    height: 100%;
    margin: 0;
    cursor: pointer;
    opacity: 0;
}

.toggle > span {
    position: absolute;
    inset: 0;
    border-radius: 99px;
    background: #cfd6e2;
    transition: background-color .2s ease;
}

.toggle > span::after {
    position: absolute;
    top: 3px;
    left: 3px;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--white);
    box-shadow: 0 1px 3px rgba(23, 32, 51, .2);
    transition: transform .2s ease;
    content: "";
}

.toggle input:focus-visible + span {
    box-shadow: 0 0 0 3px rgba(47, 102, 232, .16);
}

.toggle input:checked + span {
    background: var(--blue);
}

.toggle input:checked + span::after {
    transform: translateX(18px);
}

.number-setting {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
    color: var(--muted);
    font-size: 12px;
    font-weight: 700;
}

.number-field {
    display: flex;
    align-items: center;
    gap: 8px;
}

.number-field input {
    width: 100%;
    min-height: 42px;
    padding: 0 11px;
    border: 1px solid #cfd6e2;
    border-radius: 10px;
    color: var(--ink);
    outline: none;
    background: var(--white);
    font-weight: 700;
}

.number-field input:focus {
    border-color: var(--blue);
    box-shadow: 0 0 0 3px rgba(47, 102, 232, .12);
}

.number-field input:disabled {
    color: #98a1b1;
    background: var(--soft);
}

.inline-alert {
    margin: 0 26px 24px;
    padding: 12px 14px;
    border-radius: 10px;
    color: #8e2c2c;
    background: #fff0f0;
    font-size: 13px;
}

.summary {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    border-bottom: 1px solid var(--line);
}

.summary div {
    display: flex;
    min-width: 0;
    flex-direction: column;
    gap: 5px;
    padding: 18px 26px;
    border-right: 1px solid var(--line);
}

.summary div:last-child {
    border-right: 0;
}

.summary strong {
    font-size: 23px;
}

.summary span {
    color: var(--muted);
    font-size: 11px;
    font-weight: 700;
}

.destination-alert {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    margin: 22px 26px 0;
    padding: 14px 16px;
    border: 1px solid #ead39d;
    border-radius: 12px;
    color: #754d08;
    background: #fff8e8;
}

.destination-alert > div {
    display: flex;
    min-width: 0;
    flex-direction: column;
    gap: 4px;
}

.destination-alert span,
.destination-alert small {
    font-size: 12px;
    line-height: 1.5;
}

.destination-alert small {
    color: var(--green);
    font-weight: 700;
}

.table-scroll {
    position: relative;
    min-height: 118px;
    max-height: 460px;
    margin: 22px 26px 0;
    overflow: auto;
    border: 1px solid var(--line);
    border-radius: 12px;
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
}

th {
    position: sticky;
    top: 0;
    z-index: 1;
    color: #526075;
    background: #f2f5fa;
    font-size: 11px;
    letter-spacing: .04em;
    text-align: left;
}

th,
td {
    max-width: 380px;
    padding: 11px 13px;
    overflow: hidden;
    border-right: 1px solid var(--line);
    border-bottom: 1px solid var(--line);
    text-overflow: ellipsis;
    white-space: nowrap;
}

th:last-child,
td:last-child {
    border-right: 0;
}

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

.file-cell {
    font-weight: 700;
}

.path-cell {
    color: var(--muted);
}

.state {
    color: var(--muted);
}

.state.processing {
    color: var(--blue);
}

.state.success {
    color: var(--green);
    font-weight: 700;
}

.state.error {
    color: var(--red);
    font-weight: 700;
}

.empty-preview {
    display: grid;
    min-height: 116px;
    place-items: center;
    color: var(--muted);
    font-size: 13px;
}

.queue-limit {
    margin: 10px 26px 0;
    color: var(--muted);
    font-size: 11px;
}

.export-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    padding: 22px 26px 26px;
}

.status-copy {
    display: flex;
    min-width: 0;
    flex-direction: column;
    gap: 5px;
}

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

.export-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.run-button {
    min-height: 48px;
    padding: 0 22px;
}

.run-button > span:last-child {
    margin-left: 14px;
    font-size: 16px;
}

.busy-overlay {
    position: fixed;
    inset: 0;
    z-index: 100;
    display: grid;
    place-items: center;
    background: rgba(19, 28, 45, .36);
    backdrop-filter: blur(3px);
}

.busy-card {
    display: flex;
    width: min(380px, calc(100% - 32px));
    flex-direction: column;
    align-items: center;
    padding: 28px;
    border-radius: 17px;
    background: var(--white);
    text-align: center;
    box-shadow: 0 28px 70px rgba(0, 0, 0, .2);
}

.busy-card > span:not(.spinner) {
    max-width: 100%;
    margin-top: 7px;
    overflow: hidden;
    color: var(--muted);
    font-size: 12px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.spinner {
    display: block;
    width: 34px;
    height: 34px;
    margin: 0 auto 15px;
    border: 3px solid #dce6ff;
    border-top-color: var(--blue);
    border-radius: 50%;
    animation: spin .8s linear infinite;
}

.progress {
    width: 100%;
    height: 4px;
    margin-top: 18px;
    overflow: hidden;
    border-radius: 99px;
    background: #e9edf4;
}

.progress span {
    display: block;
    width: 0;
    height: 100%;
    background: var(--blue);
    transition: width .2s ease;
}

.toast-region {
    position: fixed;
    right: 22px;
    bottom: 22px;
    z-index: 110;
    display: grid;
    gap: 9px;
}

.toast {
    max-width: 380px;
    padding: 13px 16px;
    border-radius: 11px;
    color: var(--white);
    background: #26344d;
    box-shadow: 0 12px 35px rgba(0, 0, 0, .2);
    font-size: 13px;
    animation: toast-in .25s ease;
}

.toast.error {
    background: #9f3434;
}

.toast.success {
    background: #126c50;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

@keyframes toast-in {
    from {
        opacity: 0;
        transform: translateY(8px);
    }
}

@media (max-width: 850px) {
    .hero {
        grid-template-columns: 1fr;
        gap: 25px;
    }

    .output-preview {
        max-width: 600px;
    }

    .section-heading {
        align-items: flex-start;
        flex-wrap: wrap;
    }

    .section-heading p {
        display: none;
    }

    .settings-grid {
        grid-template-columns: 1fr 1fr;
    }

    .toggle-setting {
        grid-column: 1 / -1;
    }
}

@media (max-width: 560px) {
    .privacy-pill {
        display: none;
    }

    .page-shell {
        width: min(100% - 20px, 1180px);
        padding-top: 34px;
    }

    h1 {
        font-size: 37px;
    }

    .output-preview {
        grid-template-columns: 1fr;
    }

    .output-preview div {
        display: flex;
        justify-content: space-between;
        border-right: 0;
        border-bottom: 1px solid var(--line);
    }

    .output-preview div:last-child {
        border-bottom: 0;
    }

    .steps li:not(:last-child)::after {
        width: 18px;
        margin: 0 8px;
    }

    .steps li span {
        display: none;
    }

    .section-heading,
    .settings-grid,
    .export-footer {
        padding-right: 17px;
        padding-left: 17px;
    }

    .dropzone,
    .table-scroll,
    .destination-alert {
        margin-right: 17px;
        margin-left: 17px;
    }

    .dropzone {
        padding: 36px 16px;
        text-align: center;
    }

    .picker-actions {
        width: 100%;
        flex-direction: column;
    }

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

    .settings-grid {
        grid-template-columns: 1fr;
    }

    .toggle-setting {
        grid-column: auto;
    }

    .summary {
        grid-template-columns: 1fr 1fr;
    }

    .summary div:nth-child(2) {
        border-right: 0;
    }

    .summary div:nth-child(-n + 2) {
        border-bottom: 1px solid var(--line);
    }

    .destination-alert,
    .export-footer {
        align-items: stretch;
        flex-direction: column;
    }

    .destination-alert button,
    .export-actions,
    .export-actions button {
        width: 100%;
    }

    .export-actions {
        flex-direction: column-reverse;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        scroll-behavior: auto !important;
        transition-duration: .01ms !important;
        animation-duration: .01ms !important;
        animation-iteration-count: 1 !important;
    }
}
