/* 消费 / 充值 / 任务记录。只给 records-layout 用。参考 stitch 04 / 05 / 07。 */

.st-records {
    display: flex;
    flex-direction: column;
    gap: 20px;
    width: 100%;
    max-width: 1440px;
}

.st-records-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.st-records-toolbar-end {
    display: flex;
    flex-wrap: nowrap;
    align-items: center;
    justify-content: flex-end;
    flex-shrink: 0;
    gap: 12px;
    min-width: 0;
}

.st-records-search {
    display: flex;
    width: min(256px, 100%);
    height: 32px;
    padding: 0 12px 0 16px;
    border-radius: var(--st-radius-pill);
    background: var(--st-elevated);
}

.st-records-search-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    border: 0;
    background: transparent;
    color: var(--st-text-ghost);
    cursor: pointer;
}

.st-records-search-icon:hover {
    color: var(--st-text);
}

.st-records-search-icon .ui-svg-icon {
    width: 16px;
    height: 16px;
}

.st-records-card {
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: var(--st-surface);
    border: 1px solid var(--st-border);
    border-radius: var(--st-radius-lg);
    box-shadow: var(--st-shadow-card);
}

.st-records-body {
    min-height: 120px;
    overflow-x: auto;
}

.st-records-empty {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 220px;
    padding: 48px 16px;
    color: var(--st-text-muted);
    font-size: 14px;
}

.st-records-table {
    width: 100%;
    min-width: 860px;
    border-collapse: collapse;
    color: var(--st-text);
    font-size: 13px;
}

.st-records-table thead th {
    padding: 14px 24px;
    border-bottom: 1px solid var(--st-border);
    background: color-mix(in srgb, var(--st-text) 3%, var(--st-surface));
    color: var(--st-text-ghost);
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-align: left;
    text-transform: uppercase;
    white-space: nowrap;
}

.st-records-table tbody td {
    padding: 16px 24px;
    border-bottom: 1px solid var(--st-border);
    vertical-align: middle;
}

.st-records-table tbody tr:last-child td {
    border-bottom: 0;
}

.st-records-table .is-end {
    text-align: right;
}

.st-records-row {
    transition: background-color var(--st-duration) ease;
}

.st-records-row:hover {
    background: var(--st-menu-hover-bg);
}

.st-records-row:hover .st-records-primary {
    color: var(--st-accent);
}

.st-records-row.is-debit {
    background: color-mix(in srgb, var(--st-danger) 6%, transparent);
}

.st-records-row.is-debit:hover {
    background: color-mix(in srgb, var(--st-danger) 10%, transparent);
}

.st-records-row.is-debit .st-records-primary {
    color: var(--st-danger);
}

.st-records-row.is-debit:hover .st-records-primary {
    color: var(--st-danger);
}

.st-records-stack {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
}

.st-records-stack.is-end {
    align-items: flex-end;
}

.st-records-primary {
    min-width: 0;
    overflow: hidden;
    color: var(--st-text);
    font-size: 14px;
    font-weight: 600;
    line-height: 1.4;
    text-overflow: ellipsis;
    white-space: nowrap;
    transition: color var(--st-duration) ease;
}

.st-records-service {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
}

.st-records-service .st-records-primary {
    flex: 0 1 auto;
}

.st-records-mono,
.st-records-time {
    overflow: hidden;
    max-width: 100%;
    color: var(--st-text-ghost);
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
    font-size: 12px;
    line-height: 1.4;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.st-records-time {
    color: var(--st-text-muted);
}

.st-records-tag {
    display: inline-flex;
    align-items: center;
    flex-shrink: 0;
    height: 20px;
    padding: 0 8px;
    border: 1px solid var(--st-border-strong);
    border-radius: 6px;
    background: color-mix(in srgb, var(--st-text) 4%, var(--st-surface));
    color: var(--st-text-muted);
    font-size: 11px;
    font-weight: 500;
    line-height: 1;
    white-space: nowrap;
}

.st-records-tag--fixed {
    background: color-mix(in srgb, #8b5cf6 10%, var(--st-surface));
    border-color: color-mix(in srgb, #8b5cf6 22%, transparent);
    color: color-mix(in srgb, #8b5cf6 72%, var(--st-text));
}

.st-records-tag--token {
    background: color-mix(in srgb, var(--st-danger) 10%, var(--st-surface));
    border-color: color-mix(in srgb, var(--st-danger) 22%, transparent);
    color: var(--st-danger);
}

.st-records-points {
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
    font-size: 16px;
    font-weight: 700;
    line-height: 1.3;
}

.st-records-points span {
    font-size: 12px;
    font-weight: 600;
}

.st-records-points.is-credit {
    color: var(--st-ok);
}

.st-records-points.is-debit {
    color: var(--st-danger);
}

.st-records-money {
    color: var(--st-text-ghost);
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
    font-size: 12px;
    line-height: 1.4;
}

.st-records-footer {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 24px;
    border-top: 1px solid var(--st-border);
    background: color-mix(in srgb, var(--st-text) 3%, var(--st-surface));
}

.st-records-count {
    color: var(--st-text-muted);
    font-size: 13px;
}

.st-records-count strong {
    color: var(--st-text);
    font-weight: 600;
}

.st-records .ui-svg-icon {
    display: block;
    width: 1em;
    height: 1em;
    flex-shrink: 0;
}

.st-task-preview {
    display: flex;
    align-items: center;
    gap: 14px;
    min-width: 0;
}

.st-task-thumb,
.st-task-thumb-btn {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    padding: 0;
    overflow: hidden;
    flex-shrink: 0;
    border: 1px solid var(--st-border-strong);
    border-radius: 12px;
    background: color-mix(in srgb, var(--st-text) 4%, var(--st-surface));
    color: var(--st-text-muted);
}

.st-task-thumb-btn {
    cursor: pointer;
}

.st-task-thumb img,
.st-task-thumb video,
.st-task-thumb-btn img,
.st-task-thumb-btn video {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.st-task-thumb .ui-svg-icon,
.st-task-thumb-btn .ui-svg-icon {
    width: 18px;
    height: 18px;
}

.st-task-thumb.is-failed,
.st-task-thumb-btn.is-failed {
    background: color-mix(in srgb, var(--st-danger) 10%, var(--st-surface));
    border-color: color-mix(in srgb, var(--st-danger) 25%, transparent);
    color: var(--st-danger);
}

.st-task-play {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
    background: rgba(0, 0, 0, 0.18);
    color: #fff;
}

.st-task-play .ui-svg-icon {
    width: 14px;
    height: 14px;
}

.st-task-more {
    position: absolute;
    right: 0;
    bottom: 0;
    padding: 1px 5px;
    border-radius: 6px 0 10px 0;
    background: rgba(15, 23, 42, 0.72);
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    line-height: 1.3;
}

.st-task-spinner {
    width: 18px;
    height: 18px;
    border: 2px solid color-mix(in srgb, var(--st-accent) 22%, transparent);
    border-top-color: var(--st-accent);
    border-radius: var(--st-radius-pill);
    animation: st-records-spin 0.8s linear infinite;
}

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

.st-task-meta {
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 0;
}

.st-task-uid {
    display: inline-flex;
    max-width: 100%;
    padding: 0;
    overflow: hidden;
    border: 0;
    background: transparent;
    color: var(--st-text);
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
    font-size: 11px;
    font-weight: 500;
    line-height: 1.5;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.st-task-input-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    width: fit-content;
    padding: 0;
    border: 0;
    background: transparent;
    color: var(--st-text-muted);
    font-size: 11px;
    font-weight: 500;
    cursor: pointer;
}

.st-task-input-btn:hover {
    color: var(--st-text);
}

.st-task-input-btn .ui-svg-icon {
    width: 13px;
    height: 13px;
    color: var(--st-accent);
}

.st-task-app {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    max-width: 100%;
    height: 24px;
    padding: 0 10px;
    overflow: hidden;
    border: 1px solid var(--st-border-strong);
    border-radius: var(--st-radius-pill);
    background: color-mix(in srgb, var(--st-text) 4%, var(--st-surface));
    color: var(--st-text-muted);
    font-size: 11px;
    font-weight: 500;
    line-height: 1;
    white-space: nowrap;
}

.st-task-app-dot {
    width: 6px;
    height: 6px;
    flex-shrink: 0;
    border-radius: var(--st-radius-pill);
    background: var(--st-text-ghost);
}

.st-task-app-name {
    overflow: hidden;
    text-overflow: ellipsis;
}

.st-task-result-type {
    color: var(--st-text-muted);
    font-size: 12px;
    font-weight: 500;
    white-space: nowrap;
}

.st-task-error {
    display: block;
    max-width: 220px;
    color: var(--st-danger);
    font-size: 12px;
    font-weight: 500;
    line-height: 1.4;
    overflow-wrap: anywhere;
}

.st-task-duration,
.st-task-time {
    color: var(--st-text-muted);
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
    font-size: 13px;
    white-space: nowrap;
}

.st-task-status {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: 24px;
    padding: 0 10px;
    border: 1px solid var(--st-border-strong);
    border-radius: var(--st-radius-pill);
    background: color-mix(in srgb, var(--st-text) 4%, var(--st-surface));
    color: var(--st-text);
    font-size: 11px;
    font-weight: 600;
    line-height: 1;
    white-space: nowrap;
}

.st-task-status.is-success {
    background: color-mix(in srgb, var(--st-ok) 10%, var(--st-surface));
    border-color: color-mix(in srgb, var(--st-ok) 25%, transparent);
    color: var(--st-ok);
}

.st-task-status.is-failed {
    background: color-mix(in srgb, var(--st-danger) 10%, var(--st-surface));
    border-color: color-mix(in srgb, var(--st-danger) 25%, transparent);
    color: var(--st-danger);
}

.st-task-status .st-task-spinner {
    width: 12px;
    height: 12px;
    border-width: 1.5px;
}

.st-task-status .ui-svg-icon {
    width: 14px;
    height: 14px;
}

@media (max-width: 768px) {
    .st-records-table thead th,
    .st-records-table tbody td {
        padding: 12px 14px;
    }

    .st-records-footer {
        padding: 12px 14px;
    }

    .st-records-toolbar {
        flex-direction: column;
        align-items: stretch;
    }

    .st-records-toolbar .st-tabs {
        display: flex;
        width: 100%;
    }

    .st-records-toolbar .st-tabs-item {
        padding: 0 10px;
    }

    .st-records-toolbar-end {
        width: 100%;
        flex-wrap: nowrap;
    }

    .st-records-search {
        flex: 1 1 auto;
        width: auto;
        min-width: 0;
    }
}
