.author-source-select {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    opacity: 0 !important;
    pointer-events: none !important;
    overflow: hidden !important;
}

.author-picker-box {
    border: 1px solid var(--border-color, #555);
    border-radius: 10px;
    background: #181818;
    padding: 8px;
}

.selected-authors {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
    margin-bottom: 7px;
}

.selected-authors:empty {
    margin-bottom: 0;
}

.author-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    max-width: 100%;
    padding: 5px 8px;
    border-radius: 999px;
    background: rgba(59, 255, 0, 0.12);
    color: #fff;
    font-size: 0.88rem;
}

.author-chip span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.author-chip button {
    border: 0;
    background: transparent;
    color: #fff;
    cursor: pointer;
    font-size: 1.05rem;
    line-height: 1;
    padding: 0 2px;
}

.author-search {
    width: 100%;
    border: 0;
    outline: none;
    background: transparent;
    color: #fff;
    padding: 8px 4px;
    font: inherit;
}

.author-search::placeholder {
    color: #aaa;
}

.author-results {
    display: grid;
    gap: 4px;
    margin-top: 6px;
    max-height: 290px;
    overflow-y: auto;
    padding: 5px;
    border: 1px solid var(--border-color, #555);
    border-radius: 9px;
    background: #2b2b2b;
}

.author-result {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    width: 100%;
    box-sizing: border-box;
    border: 1px solid transparent;
    border-radius: 8px;
    background: #333;
    color: #fff;
    padding: 9px 10px;
    cursor: pointer;
    text-align: left;
}

.author-result strong {
    color: #fff;
}

.author-result:hover,
.author-result:focus-visible {
    border-color: var(--accent);
    background: #3b3b3b;
    outline: none;
}

.author-result small {
    color: #cfcfcf;
    opacity: 1;
    margin-top: 2px;
}

.author-empty {
    padding: 10px;
    color: #ddd;
    font-size: 0.9rem;
}

.author-picker-actions {
    margin-top: 8px;
}

.author-create-note {
    margin: 8px 0 0;
    color: var(--text-secondary);
    font-size: 0.85rem;
}


.new-author-dialog {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: grid;
    place-items: center;
    padding: 20px;
    background: rgba(0, 0, 0, 0.78);
    backdrop-filter: blur(6px);
}

.new-author-dialog[hidden] {
    display: none !important;
}

.new-author-dialog-card {
    width: min(720px, 100%);
    max-height: min(92vh, 880px);
    overflow-y: auto;
    box-sizing: border-box;
    padding: 0;
    border: 1px solid rgba(59, 255, 0, 0.28);
    border-radius: 16px;
    background: linear-gradient(180deg, #161618 0%, #0e0e10 100%);
    color: #fff;
    box-shadow:
        0 0 0 1px rgba(59, 255, 0, 0.08),
        0 24px 60px rgba(0, 0, 0, 0.65);
}

.new-author-dialog-card h3 {
    margin: 0;
    padding: 20px 24px 8px;
    color: #fff;
    font-size: 1.35rem;
    letter-spacing: 0.02em;
}

.new-author-dialog-card > p {
    margin: 0;
    padding: 0 24px 16px;
    color: #a8a8a8;
    font-size: 0.95rem;
    line-height: 1.45;
}

.author-dialog-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px 16px;
    padding: 0 24px 8px;
}

.author-dialog-full {
    grid-column: 1 / -1;
}

.new-author-dialog-card label {
    display: block;
    margin-top: 0;
    margin-bottom: 6px;
    color: #d0d0d0;
    font-weight: 700;
    font-size: 0.9rem;
}

.new-author-dialog-card input,
.new-author-dialog-card textarea,
.new-author-dialog-card select {
    display: block;
    width: 100%;
    box-sizing: border-box;
    margin-top: 0;
    min-height: 46px;
    border: 1px solid #333;
    border-radius: 10px;
    background: rgba(0, 0, 0, 0.45);
    color: #fff;
    padding: 12px 14px;
    font-size: 1rem;
}

.new-author-dialog-card input:focus,
.new-author-dialog-card textarea:focus,
.new-author-dialog-card select:focus {
    outline: 2px solid rgba(59, 255, 0, 0.55);
    outline-offset: 1px;
    border-color: rgba(59, 255, 0, 0.45);
}

.new-author-dialog-card textarea {
    min-height: 100px;
    resize: vertical;
    line-height: 1.45;
}

.author-links-heading {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    margin: 8px 0 10px;
    padding: 0;
}

.author-links-heading strong {
    color: #fff;
    font-size: 0.95rem;
}

.author-links-list {
    display: grid;
    gap: 10px;
}

.author-link-item {
    display: grid;
    grid-template-columns: minmax(110px, 0.7fr) minmax(100px, 0.8fr) minmax(0, 1.4fr) auto auto;
    gap: 8px;
    align-items: center;
    padding: 10px;
    border: 1px solid #2a2a2a;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.03);
}

.author-link-item input,
.author-link-item select {
    margin-top: 0;
    min-height: 42px;
}

.author-link-check {
    display: flex !important;
    align-items: center;
    gap: 8px;
    white-space: nowrap;
    font-size: 0.88rem;
    font-weight: 600;
    color: #c8c8c8;
    cursor: pointer;
    user-select: none;
}

.author-link-check input[type="checkbox"] {
    appearance: none;
    -webkit-appearance: none;
    width: 18px;
    height: 18px;
    min-width: 18px;
    min-height: 18px;
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    border: 2px solid #6a6a6a;
    border-radius: 4px;
    background: #1a1a1a;
    display: inline-block;
    position: relative;
    cursor: pointer;
    outline: none;
    box-shadow: none;
    flex: 0 0 18px;
}

.author-link-check input[type="checkbox"]:hover {
    border-color: #9a9a9a;
}

.author-link-check input[type="checkbox"]:focus {
    outline: none;
    box-shadow: 0 0 0 2px rgba(59, 255, 0, 0.25);
}

.author-link-check input[type="checkbox"]:checked {
    border-color: #3bff00;
    background: #3bff00;
}

.author-link-check input[type="checkbox"]:checked::after {
    content: "";
    position: absolute;
    left: 4px;
    top: 1px;
    width: 5px;
    height: 9px;
    border: solid #111;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

.author-link-check:has(input:checked) {
    color: #b8ff9a;
}

.author-link-item .remove-button {
    border: 1px solid rgba(255, 92, 92, 0.45);
    background: rgba(255, 60, 60, 0.1);
    color: #ff9a9a;
    border-radius: 9px;
    padding: 9px 12px;
    cursor: pointer;
    font-weight: 700;
}

.author-link-item .remove-button:hover {
    border-color: #ff5c5c;
    background: rgba(255, 60, 60, 0.25);
    color: #fff;
}

.author-create-error {
    min-height: 1.2em;
    margin: 0;
    padding: 8px 24px 0;
    color: #ff8c8c;
    font-size: 0.92rem;
}

.dialog-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 0;
    padding: 18px 24px 22px;
    flex-wrap: wrap;
    border-top: 1px solid #222;
    background: rgba(0, 0, 0, 0.25);
}

.dialog-actions .button,
.dialog-actions button {
    min-height: 44px;
    padding: 10px 18px;
    border-radius: 10px;
    font-weight: 700;
    font-size: 0.95rem;
    cursor: pointer;
}

.dialog-actions #cancel-author {
    border: 1px solid #444;
    background: transparent;
    color: #ddd;
}

.dialog-actions #cancel-author:hover {
    border-color: #888;
    color: #fff;
}

.dialog-actions #download-author {
    border: 1px solid rgba(59, 255, 0, 0.35);
    background: rgba(59, 255, 0, 0.08);
    color: #b8ff9a;
}

.dialog-actions #download-author:hover {
    background: rgba(59, 255, 0, 0.16);
}

.dialog-actions #save-author {
    border: 1px solid var(--accent, #3bff00);
    background: var(--accent, #3bff00);
    color: #0a0a0a;
}

.dialog-actions #save-author:hover {
    filter: brightness(1.08);
}

@media (max-width: 700px) {
    .author-dialog-grid {
        grid-template-columns: 1fr;
    }

    .author-dialog-full {
        grid-column: auto;
    }

    .author-link-item {
        grid-template-columns: 1fr 1fr;
    }

    .author-link-item .author-link-url {
        grid-column: 1 / -1;
    }

    .author-link-item .author-link-check {
        justify-content: flex-start;
    }

    .new-author-dialog-card h3,
    .new-author-dialog-card > p,
    .author-dialog-grid,
    .author-create-error,
    .dialog-actions {
        padding-left: 16px;
        padding-right: 16px;
    }
}
