.aps-tool {
    --aps-primary: #1267d8;
    --aps-primary-dark: #0b4e9d;
    --aps-teal: #0f8f82;
    --aps-teal-dark: #0a756b;
    --aps-amber: #c77700;
    --aps-red: #d92d20;
    --aps-green: #138a5b;
    --aps-ink: #172033;
    --aps-muted: #667085;
    --aps-line: #d8e2ee;
    --aps-soft: #f5f8fc;
    --aps-soft-blue: #eef6ff;
    --aps-white: #fff;
    --aps-radius: 8px;
    --aps-shadow: 0 10px 24px rgba(22, 48, 80, .07);
    width: 100%;
    color: var(--aps-ink);
    background: linear-gradient(180deg, #fff 0%, #f7fafc 100%);
    border: 1px solid #dfe8f3;
    border-radius: 8px;
    box-shadow: 0 14px 34px rgba(15, 23, 42, .08);
    overflow: hidden;
}

.aps-tool * {
    box-sizing: border-box;
}

.aps-tool button,
.aps-tool input,
.aps-tool select {
    font: inherit;
}

.aps-alert {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    gap: 10px;
    align-items: start;
    padding: 14px 18px;
    border-bottom: 1px solid #cddbeb;
    background: #f1f7ff;
    color: #1e4a78;
    font-size: 13px;
    line-height: 1.65;
}

.aps-alert i {
    color: var(--aps-primary);
    font-size: 18px;
    margin-top: 1px;
}

.aps-alert strong {
    display: block;
    color: #123b6e;
}

.aps-alert span {
    display: block;
}

.aps-engine-state {
    align-self: center;
    border: 1px solid #b8d6ff;
    border-radius: 999px;
    background: #fff;
    color: var(--aps-primary-dark);
    padding: 5px 10px;
    font-size: 12px;
    font-weight: 900;
    white-space: nowrap;
}

.aps-tabs {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
    padding: 14px 18px;
    background: #edf3f8;
    border-bottom: 1px solid var(--aps-line);
}

.aps-tab {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    align-items: center;
    gap: 10px;
    min-height: 58px;
    padding: 10px 12px;
    border: 1px solid #bfd0e5;
    border-radius: 8px;
    background: #fff;
    color: #0b4e9d;
    text-align: left;
    cursor: pointer;
    transition: background .2s, border-color .2s, box-shadow .2s, transform .2s, color .2s;
}

.aps-tab:hover {
    border-color: var(--aps-teal);
    color: var(--aps-teal);
    transform: translateY(-1px);
}

.aps-tab.active {
    background: linear-gradient(135deg, var(--aps-primary), var(--aps-primary-dark));
    border-color: var(--aps-primary);
    color: #fff;
    box-shadow: 0 10px 22px rgba(18, 103, 216, .18);
}

.aps-tab-index {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 31px;
    height: 31px;
    border-radius: 50%;
    background: #e7f1ff;
    color: var(--aps-primary-dark);
    font-weight: 900;
}

.aps-tab.active .aps-tab-index {
    background: rgba(255, 255, 255, .22);
    color: #fff;
}

.aps-tab b,
.aps-tab small {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.aps-tab b {
    font-size: 15px;
    font-weight: 900;
    color: inherit;
}

.aps-tab small {
    margin-top: 2px;
    color: currentColor;
    font-size: 12px;
    opacity: .78;
}

.aps-tab.is-done:not(.active) {
    border-color: rgba(15, 143, 130, .4);
    color: var(--aps-teal);
}

.aps-body {
    padding: 18px;
}

.aps-panel-tab {
    display: none;
}

.aps-panel-tab.active {
    display: block;
}

.aps-layout {
    display: grid;
    grid-template-columns: minmax(0, 1.02fr) minmax(320px, .98fr);
    gap: 16px;
    align-items: start;
}

.aps-panel {
    border: 1px solid var(--aps-line);
    border-radius: var(--aps-radius);
    background: #fff;
    box-shadow: var(--aps-shadow);
    overflow: hidden;
}

.aps-panel-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 16px;
    border-bottom: 1px solid var(--aps-line);
    background: #f8fbff;
}

.aps-title {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0;
    color: #16233a;
    font-size: 15px;
    font-weight: 900;
}

.aps-title i {
    color: var(--aps-primary);
}

.aps-note {
    margin: 3px 0 0;
    color: var(--aps-muted);
    font-size: 12px;
    line-height: 1.55;
}

.aps-panel-body {
    padding: 16px;
}

.aps-drop {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 224px;
    padding: 24px;
    border: 2px dashed #9ec8ff;
    border-radius: var(--aps-radius);
    background: linear-gradient(135deg, #f7fbff, #f1f8f6);
    cursor: pointer;
    text-align: center;
    transition: border-color .2s, background .2s, transform .2s;
}

.aps-drop:hover,
.aps-drop.dragging {
    border-color: var(--aps-teal);
    background: #f1fbf9;
    transform: translateY(-1px);
}

.aps-drop input {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
}

.aps-drop-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 58px;
    height: 58px;
    margin-bottom: 12px;
    border-radius: 50%;
    background: #fff;
    color: var(--aps-primary);
    font-size: 28px;
    box-shadow: 0 12px 24px rgba(18, 103, 216, .12);
}

.aps-drop-main {
    color: var(--aps-ink);
    font-size: 18px;
    font-weight: 900;
}

.aps-drop-sub {
    margin-top: 6px;
    color: var(--aps-muted);
    font-size: 13px;
}

.aps-actions,
.aps-nav {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
    margin-top: 14px;
}

.aps-nav {
    justify-content: space-between;
    padding-top: 10px;
    border-top: 1px dashed #dce6f1;
}

.aps-inline-tip,
.aps-help {
    color: var(--aps-muted);
    font-size: 12px;
    line-height: 1.55;
}

.aps-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    min-height: 38px;
    padding: 8px 15px;
    border: 1px solid transparent;
    border-radius: 7px;
    background: #fff;
    color: var(--aps-ink);
    font-size: 13px;
    font-weight: 800;
    cursor: pointer;
    text-decoration: none;
    white-space: nowrap;
    transition: transform .16s, box-shadow .16s, border-color .16s, background .16s, color .16s;
}

.aps-btn:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 10px 18px rgba(31, 41, 51, .09);
}

.aps-btn:disabled {
    cursor: not-allowed;
    opacity: .58;
}

.aps-btn-primary {
    background: linear-gradient(135deg, var(--aps-primary), var(--aps-primary-dark));
    color: #fff;
}

.aps-btn-teal {
    background: linear-gradient(135deg, var(--aps-teal), var(--aps-teal-dark));
    color: #fff;
}

.aps-btn-secondary,
.aps-btn-outline {
    border-color: var(--aps-line);
    color: #31545c;
}

.aps-btn-outline:hover:not(:disabled),
.aps-btn-secondary:hover:not(:disabled) {
    border-color: var(--aps-primary);
    color: var(--aps-primary-dark);
}

.aps-btn-danger {
    border-color: #ffd0c9;
    color: var(--aps-red);
}

.aps-stat-grid,
.aps-summary {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 10px;
}

.aps-stat,
.aps-summary > div {
    padding: 12px;
    border: 1px solid #dfe9f4;
    border-radius: var(--aps-radius);
    background: var(--aps-soft);
    min-width: 0;
}

.aps-stat-value,
.aps-summary strong {
    display: block;
    color: var(--aps-ink);
    font-size: 18px;
    font-weight: 900;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.aps-stat-label,
.aps-summary span {
    display: block;
    margin-top: 4px;
    color: var(--aps-muted);
    font-size: 12px;
}

.aps-file-list,
.aps-result-list,
.aps-error-list {
    display: grid;
    gap: 10px;
    margin-top: 14px;
}

.aps-file-row,
.aps-result-card {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(210px, .4fr);
    gap: 12px;
    align-items: center;
    padding: 12px;
    border: 1px solid #e3ebf5;
    border-radius: var(--aps-radius);
    background: #fff;
}

.aps-file-name,
.aps-result-name {
    overflow: hidden;
    color: var(--aps-ink);
    font-weight: 900;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.aps-file-meta,
.aps-result-meta {
    margin-top: 4px;
    color: var(--aps-muted);
    font-size: 12px;
    line-height: 1.5;
}

.aps-file-row audio,
.aps-result-card audio {
    width: 100%;
    max-width: 260px;
}

.aps-empty,
.aps-more-note,
.aps-error-item {
    padding: 12px;
    border-radius: var(--aps-radius);
    background: #f8fbff;
    color: var(--aps-muted);
    font-size: 13px;
    line-height: 1.6;
}

.aps-more-note {
    background: #fff7e6;
    color: #8a4b06;
}

.aps-error-item {
    background: #fff3f0;
    color: #b42318;
}

.aps-readout {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    margin-bottom: 15px;
}

.aps-readout > div {
    padding: 15px;
    border-radius: var(--aps-radius);
    background: linear-gradient(135deg, #1267d8, #0f8f82);
    color: #fff;
}

.aps-readout span,
.aps-readout small {
    display: block;
    opacity: .88;
    font-size: 12px;
}

.aps-readout strong {
    display: block;
    margin: 5px 0;
    font-size: 27px;
    line-height: 1.15;
}

.aps-form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
}

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

.aps-field {
    display: flex;
    flex-direction: column;
    gap: 7px;
    min-width: 0;
}

.aps-field label {
    color: #344054;
    font-size: 13px;
    font-weight: 900;
}

.aps-field input[type="number"],
.aps-field input[type="text"],
.aps-field select {
    width: 100%;
    min-height: 40px;
    border: 1px solid #cfd9e1;
    border-radius: 7px;
    background: #fff;
    color: var(--aps-ink);
    padding: 8px 10px;
    outline: none;
    transition: border-color .16s, box-shadow .16s;
}

.aps-field input:focus,
.aps-field select:focus {
    border-color: var(--aps-primary);
    box-shadow: 0 0 0 3px rgba(18, 103, 216, .14);
}

.aps-range-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 88px;
    gap: 10px;
    align-items: center;
}

.aps-range-row input[type="range"] {
    width: 100%;
    accent-color: var(--aps-primary);
}

.aps-range-value {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 34px;
    border: 1px solid #cfd9e1;
    border-radius: 7px;
    background: #fff;
    color: var(--aps-primary-dark);
    font-size: 13px;
    font-weight: 900;
}

.aps-check-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    margin-top: 15px;
}

.aps-check {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 13px;
    border: 1px solid #dce8ed;
    border-radius: var(--aps-radius);
    background: #fff;
    cursor: pointer;
}

.aps-check input {
    margin-top: 3px;
    accent-color: var(--aps-primary);
}

.aps-check b {
    display: block;
    margin-bottom: 4px;
    color: var(--aps-ink);
    font-size: 13px;
}

.aps-check small {
    color: var(--aps-muted);
    font-size: 12px;
    line-height: 1.5;
}

.aps-summary {
    margin-top: 15px;
}

.aps-process-card {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    gap: 12px;
    align-items: center;
    min-height: 112px;
    padding: 16px;
    border: 1px solid #dfe9f4;
    border-radius: var(--aps-radius);
    background: linear-gradient(135deg, #f8fbff, #f2fbf9);
}

.aps-process-mark {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: var(--aps-amber);
    box-shadow: 0 0 0 6px rgba(199, 119, 0, .15);
}

.aps-process-mark.ready {
    background: var(--aps-green);
    box-shadow: 0 0 0 6px rgba(19, 138, 91, .15);
}

.aps-process-mark.error {
    background: var(--aps-red);
    box-shadow: 0 0 0 6px rgba(217, 45, 32, .14);
}

.aps-process-card strong {
    display: block;
    color: var(--aps-ink);
    font-size: 16px;
}

.aps-process-card span {
    display: block;
    margin-top: 5px;
    color: var(--aps-muted);
    font-size: 13px;
    line-height: 1.6;
    word-break: break-word;
}

.aps-progress {
    height: 18px;
    margin-top: 14px;
    overflow: hidden;
    border-radius: 999px;
    background: #dce8ed;
}

.aps-progress-bar {
    width: 0%;
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, var(--aps-primary), var(--aps-teal), var(--aps-amber));
    color: #fff;
    font-size: 11px;
    font-weight: 900;
    line-height: 18px;
    text-align: center;
    transition: width .18s;
}

.aps-result-card {
    grid-template-columns: minmax(0, 1fr) minmax(180px, .32fr);
}

.aps-result-actions {
    display: grid;
    justify-items: end;
    gap: 8px;
}

.aps-result-status {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 4px 8px;
    border-radius: 999px;
    background: #e8f7f0;
    color: #08745f;
    font-size: 12px;
    font-weight: 900;
}

.aps-hidden {
    display: none !important;
}

@media (max-width: 992px) {
    .aps-layout,
    .aps-form-grid,
    .aps-form-grid-two,
    .aps-check-grid,
    .aps-readout {
        grid-template-columns: 1fr;
    }

    .aps-stat-grid,
    .aps-summary {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 640px) {
    .aps-alert {
        grid-template-columns: auto minmax(0, 1fr);
    }

    .aps-engine-state {
        grid-column: 1 / -1;
        justify-self: start;
    }

    .aps-tabs,
    .aps-stat-grid,
    .aps-summary {
        grid-template-columns: 1fr;
    }

    .aps-body,
    .aps-panel-body {
        padding: 14px;
    }

    .aps-panel-head,
    .aps-nav,
    .aps-file-row,
    .aps-result-card {
        display: grid;
    }

    .aps-file-row audio,
    .aps-result-card audio {
        max-width: 100%;
    }

    .aps-range-row {
        grid-template-columns: 1fr;
    }
}
