/* 管理档案卡片：程序坞角标、状态控件与 Token Field 最终层。 */

#records-tab .record-card,
#authors-tab .author-card {
    position: relative;
}

#records-tab .record-config-badge,
#authors-tab .archive-author-model-badge {
    position: absolute;
    top: 12px;
    right: 12px;
    z-index: 6;
    display: inline-grid;
    place-items: center;
    min-width: 28px;
    height: 28px;
    padding: 0 7px;
    border: 2px solid color-mix(in srgb, #ffffff 76%, transparent);
    border-radius: 999px;
    background: #ff4d4f;
    color: #ffffff;
    box-shadow: 0 6px 14px rgba(118, 19, 35, 0.32);
    font-size: 12px;
    font-weight: 850;
    line-height: 1;
    white-space: nowrap;
    transition: transform 180ms cubic-bezier(.4, 0, .2, 1),
        box-shadow 180ms cubic-bezier(.4, 0, .2, 1),
        background-color 180ms cubic-bezier(.4, 0, .2, 1);
}

#records-tab .record-card:hover .record-config-badge,
#records-tab .record-card:focus-within .record-config-badge,
#authors-tab .author-card:hover .archive-author-model-badge,
#authors-tab .author-card:focus-within .archive-author-model-badge {
    transform: translateY(-1px) scale(1.04);
    background: #ff3b30;
    box-shadow: 0 8px 18px rgba(118, 19, 35, 0.42);
    transition-timing-function: ease-out;
}

#records-tab .record-info {
    min-width: 0;
    padding-top: clamp(42px, 4vw, 58px) !important;
}

#records-tab .record-actions {
    min-width: 0;
    margin-top: auto;
    padding-top: 8px;
}

#authors-tab .author-text {
    min-width: 0;
    padding-right: 52px;
}

#authors-tab .author-crawl-state {
    display: inline-flex;
    align-items: center;
    width: fit-content;
    max-width: 100%;
    min-height: 28px;
    margin-top: 5px;
    padding: 4px 8px;
    overflow: hidden;
    border: 1px solid color-mix(in srgb, var(--ui-accent) 42%, transparent);
    border-radius: 999px;
    background: color-mix(in srgb, var(--ui-accent-soft) 64%, transparent);
    color: var(--ui-accent-strong);
    font: inherit;
    font-size: 11px;
    font-weight: 780;
    text-overflow: ellipsis;
    white-space: nowrap;
    cursor: pointer;
    transition: background-color 180ms cubic-bezier(.4, 0, .2, 1),
        border-color 180ms cubic-bezier(.4, 0, .2, 1),
        transform 180ms cubic-bezier(.4, 0, .2, 1),
        color 180ms cubic-bezier(.4, 0, .2, 1);
}

#authors-tab .author-crawl-state:hover,
#authors-tab .author-crawl-state:focus-visible {
    border-color: var(--ui-accent);
    background: var(--ui-accent-soft);
    color: var(--ui-accent-strong);
    transform: translateY(-1px);
    outline: none;
    transition-timing-function: ease-out;
}

#authors-tab .author-crawl-state:active {
    transform: translateY(0) scale(.98);
    transition-timing-function: ease-out;
}

#authors-tab .author-crawl-state.is-disabled {
    border-color: color-mix(in srgb, var(--ui-muted) 52%, transparent);
    background: color-mix(in srgb, var(--ui-muted) 16%, transparent);
    color: var(--ui-muted);
}

#config-tab .theme-token-field {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
    min-height: 42px;
    max-height: 132px;
    overflow-y: auto;
    padding: 6px 8px;
    border: 1px solid var(--ui-border);
    border-radius: var(--ui-radius-sm);
    background: var(--ui-surface-strong);
    color: var(--ui-text);
    scrollbar-color: color-mix(in srgb, var(--ui-accent) 62%, transparent) transparent;
    transition: border-color 180ms cubic-bezier(.4, 0, .2, 1),
        background-color 180ms cubic-bezier(.4, 0, .2, 1),
        box-shadow 180ms cubic-bezier(.4, 0, .2, 1);
}

#config-tab .theme-token-field:hover {
    border-color: color-mix(in srgb, var(--ui-accent) 66%, var(--ui-border));
    transition-timing-function: ease-out;
}

#config-tab .theme-token-field:focus-within {
    border-color: var(--ui-accent);
    background: color-mix(in srgb, var(--ui-accent-soft) 18%, var(--ui-surface-strong));
    box-shadow: 0 0 0 3px var(--ui-accent-soft);
    transition-timing-function: ease-out;
}

#config-tab .theme-token-field[aria-disabled="true"],
#config-tab .theme-token-field:has(.theme-token-input:disabled) {
    opacity: .58;
    cursor: not-allowed;
}

#config-tab .theme-token-list {
    display: contents;
}

#config-tab .theme-token {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    max-width: min(100%, 220px);
    min-height: 28px;
    padding: 3px 5px 3px 9px;
    border: 1px solid color-mix(in srgb, var(--ui-accent) 40%, transparent);
    border-radius: 8px;
    background: var(--ui-accent);
    color: var(--ui-on-accent);
    font-size: 13px;
    font-weight: 700;
    transition: background-color 180ms cubic-bezier(.4, 0, .2, 1),
        border-color 180ms cubic-bezier(.4, 0, .2, 1),
        transform 180ms ease-out;
}

#config-tab .theme-token:hover {
    border-color: var(--ui-accent-strong);
    background: var(--ui-accent-strong);
    transform: translateY(-1px);
    transition-timing-function: ease-out;
}

#config-tab .theme-token-label {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

#config-tab .theme-token-remove {
    display: inline-grid;
    place-items: center;
    width: 20px;
    height: 20px;
    flex: 0 0 auto;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: transparent;
    color: currentColor;
    font: inherit;
    font-size: 17px;
    line-height: 1;
    cursor: pointer;
    transition: background-color 150ms ease-out, transform 150ms ease-out;
}

#config-tab .theme-token-remove:hover,
#config-tab .theme-token-remove:focus-visible {
    background: color-mix(in srgb, var(--ui-on-accent) 22%, transparent);
    outline: none;
    transform: scale(1.08);
}

#config-tab .theme-token-input {
    min-width: 9rem;
    min-height: 30px;
    flex: 1 1 10rem;
    padding: 4px 2px;
    border: 0 !important;
    outline: none !important;
    background: transparent !important;
    box-shadow: none !important;
    color: var(--ui-text) !important;
    font: inherit;
    font-size: 13px;
}

#config-tab .theme-token-input::placeholder {
    color: var(--ui-muted);
}

@media (max-width: 560px) {
    #config-tab .theme-token-field {
        max-height: 148px;
    }

    #config-tab .theme-token {
        max-width: min(100%, 180px);
    }

    #config-tab .theme-token-input {
        min-width: 7rem;
        flex-basis: 7rem;
    }
}

@media (prefers-reduced-motion: reduce) {
    #config-tab .theme-token-field,
    #config-tab .theme-token,
    #config-tab .theme-token-remove {
        transition-duration: 120ms;
        transition-timing-function: ease-out;
    }

    #config-tab .theme-token:hover,
    #config-tab .theme-token-remove:hover,
    #config-tab .theme-token-remove:focus-visible {
        transform: none;
    }
}

@media (max-width: 560px) {
    #records-tab .record-config-badge,
    #authors-tab .archive-author-model-badge {
        top: 8px;
        right: 8px;
        min-width: 26px;
        height: 26px;
        padding-inline: 6px;
        font-size: 11px;
    }

    #records-tab .record-info {
        padding-top: 40px !important;
    }

    #authors-tab .author-text {
        padding-right: 42px;
    }
}

@media (prefers-reduced-motion: reduce) {
    #records-tab .record-config-badge,
    #authors-tab .archive-author-model-badge,
    #authors-tab .author-crawl-state {
        transition-duration: 120ms;
        transition-timing-function: ease-out;
    }

    #records-tab .record-card:hover .record-config-badge,
    #records-tab .record-card:focus-within .record-config-badge,
    #authors-tab .author-card:hover .archive-author-model-badge,
    #authors-tab .author-card:focus-within .archive-author-model-badge,
    #authors-tab .author-crawl-state:hover,
    #authors-tab .author-crawl-state:focus-visible {
        transform: none;
    }
}
