.novel-tag-beta-entry {
    display: none;
    min-height: 36px;
    padding: 7px 12px;
    border: 1px solid #17845b;
    border-radius: 6px;
    background: #fff;
    color: #126747;
    font: inherit;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
}

.novel-tag-beta-entry.is-visible {
    display: inline-flex;
    align-items: center;
}

.novel-file-tag-summary {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
    min-height: 34px;
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px dashed #d9dedb;
    font-size: 12px;
}

.novel-file-tag-prefix {
    color: #52605a;
    font-weight: 600;
}

.novel-file-tag-chips {
    display: flex;
    flex: 1 1 180px;
    flex-wrap: wrap;
    gap: 5px;
    min-width: 0;
}

.novel-file-tag-chip,
.novel-file-tag-more {
    display: inline-flex;
    align-items: center;
    min-height: 24px;
    padding: 3px 7px;
    border: 1px solid #c9d2ce;
    border-radius: 5px;
    background: #f7f9f8;
    color: #41504a;
    line-height: 1.35;
}

.novel-file-tag-chip.is-effective {
    border-color: #8bc7ae;
    background: #ecf8f2;
    color: #11633f;
}

.novel-file-tag-chip.is-disputed {
    border-color: #e0b96c;
    background: #fff8e8;
    color: #785513;
}

.novel-file-tag-empty {
    color: #89928e;
}

.novel-file-tag-add,
.novel-tag-vote,
.novel-tag-appeal {
    min-height: 30px;
    padding: 5px 10px;
    border: 1px solid #208863;
    border-radius: 6px;
    background: #fff;
    color: #126747;
    font: inherit;
    font-size: 12px;
    cursor: pointer;
}

.novel-tag-appeal {
    min-height: 30px;
    padding: 5px 10px;
    border: 1px solid #7d8883;
    border-radius: 6px;
    background: #fff;
    color: #52605a;
    font: inherit;
    font-size: 12px;
    cursor: pointer;
}

.novel-tag-appeal:disabled {
    cursor: default;
    opacity: 0.55;
}

.novel-tag-beta-overlay {
    position: fixed;
    inset: 0;
    z-index: 10080;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 18px;
    background: rgba(20, 27, 24, 0.58);
}

.novel-tag-beta-overlay.is-open {
    display: flex;
}

body.novel-tag-modal-open {
    overflow: hidden;
}

.novel-tag-beta-tool {
    display: flex;
    width: min(920px, 100%);
    max-height: min(88vh, 900px);
    flex-direction: column;
    overflow: hidden;
    border: 1px solid #cbd4d0;
    border-radius: 8px;
    background: #fff;
    box-shadow: 0 18px 55px rgba(0, 0, 0, 0.25);
    color: #26332d;
}

.novel-tag-beta-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 16px 18px;
    border-bottom: 1px solid #e1e6e3;
    background: #f7f9f8;
}

.novel-tag-beta-title {
    font-size: 18px;
    font-weight: 700;
}

.novel-tag-beta-subtitle {
    margin-top: 3px;
    color: #6d7973;
    font-size: 12px;
}

.novel-tag-icon-btn {
    width: 36px;
    height: 36px;
    flex: 0 0 36px;
    border: 1px solid #c8d0cc;
    border-radius: 6px;
    background: #fff;
    color: #46524c;
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
}

.novel-tag-beta-body {
    overflow: auto;
    padding: 18px;
}

.novel-tag-message {
    min-height: 20px;
    margin-bottom: 8px;
    color: #52605a;
    font-size: 13px;
}

.novel-tag-message.is-error {
    color: #b42318;
}

.novel-file-tag-file-head {
    margin-bottom: 16px;
    padding-bottom: 14px;
    border-bottom: 1px solid #e2e7e4;
}

.novel-file-tag-file-name {
    overflow-wrap: anywhere;
    font-size: 17px;
    font-weight: 700;
}

.novel-file-tag-file-meta,
.novel-tag-search-meta {
    margin-top: 5px;
    color: #6f7c76;
    font-size: 12px;
    line-height: 1.6;
}

.novel-tag-section-title {
    margin: 18px 0 10px;
    color: #26332d;
    font-size: 14px;
    font-weight: 700;
}

.novel-file-tag-relations {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
}

.novel-file-tag-relation,
.novel-tag-search-item {
    min-width: 0;
    padding: 12px;
    border: 1px solid #d8dfdc;
    border-radius: 7px;
    background: #fff;
}

.novel-file-tag-relation.is-effective {
    border-left: 4px solid #18845b;
}

.novel-file-tag-relation.is-disputed {
    border-left: 4px solid #c78a15;
}

.novel-file-tag-relation.is-hidden {
    border-left: 4px solid #b42318;
    background: #fff8f7;
}

.novel-file-tag-relation-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.novel-file-tag-status {
    flex: 0 0 auto;
    color: #68756f;
    font-size: 12px;
}

.novel-file-tag-counts {
    margin: 8px 0;
    color: #66736d;
    font-size: 12px;
    line-height: 1.5;
}

.novel-file-tag-vote-actions,
.novel-tag-actions,
.novel-tag-search-actions {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
}

.novel-tag-vote.confirm.is-selected {
    border-color: #177653;
    background: #177653;
    color: #fff;
}

.novel-tag-vote.reject {
    border-color: #ba4a40;
    color: #9f2f26;
}

.novel-tag-vote.reject.is-selected {
    background: #a63b31;
    color: #fff;
}

.novel-tag-input,
.novel-tag-select,
.novel-tag-note {
    width: 100%;
    min-height: 40px;
    padding: 9px 10px;
    border: 1px solid #c7d0cc;
    border-radius: 6px;
    background: #fff;
    color: #24322c;
    font: inherit;
    font-size: 14px;
}

.novel-tag-note {
    min-height: 92px;
    resize: vertical;
}

.novel-tag-catalog-count {
    min-height: 20px;
    margin-top: 7px;
    color: #66736d;
    font-size: 12px;
    line-height: 20px;
}

.novel-tag-catalog {
    max-height: min(48vh, 460px);
    margin-top: 4px;
    overflow: auto;
    border: 1px solid #dde3e0;
    border-radius: 7px;
}

.novel-tag-catalog-group {
    padding: 10px 12px;
    border-bottom: 1px solid #e5e9e7;
}

.novel-tag-catalog-group:last-child {
    border-bottom: 0;
}

.novel-tag-group-title {
    margin-bottom: 8px;
    color: #596761;
    font-size: 12px;
    font-weight: 700;
}

.novel-tag-options {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
}

.novel-tag-option {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    min-height: 32px;
    padding: 5px 8px;
    border: 1px solid #d1d9d5;
    border-radius: 6px;
    background: #f9faf9;
    cursor: pointer;
}

.novel-tag-option:has(input:checked) {
    border-color: #1b8060;
    background: #eaf7f1;
    color: #125f43;
}

.novel-tag-command {
    min-height: 38px;
    padding: 8px 14px;
    border: 1px solid #177653;
    border-radius: 6px;
    background: #177653;
    color: #fff;
    font: inherit;
    font-size: 13px;
    cursor: pointer;
}

.novel-tag-command.danger {
    border-color: #a63b31;
    background: #a63b31;
}

.novel-tag-command:disabled {
    cursor: wait;
    opacity: 0.6;
}

.novel-tag-actions {
    margin-top: 12px;
}

.novel-tag-officer-panel {
    margin-top: 20px;
    padding-top: 2px;
    border-top: 1px solid #dfe5e2;
}

.novel-tag-officer-panel > * + * {
    margin-top: 9px;
}

.novel-tag-search-controls {
    display: grid;
    grid-template-columns: minmax(180px, 1fr) minmax(150px, auto) minmax(180px, auto);
    gap: 8px;
    margin-bottom: 10px;
}

.novel-tag-results {
    display: grid;
    gap: 10px;
    margin-top: 16px;
}

.novel-tag-selected,
.novel-tag-pagination {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    padding: 8px 0;
    font-size: 13px;
}

.novel-tag-selected-chip {
    display: inline-flex;
    align-items: center;
    min-height: 32px;
    max-width: 100%;
    padding: 5px 8px;
    border: 1px solid #8bc7ae;
    border-radius: 5px;
    background: #ecf8f2;
    color: #11633f;
    font: inherit;
    overflow-wrap: anywhere;
    text-align: left;
    cursor: pointer;
}

.novel-tag-selection-count {
    flex: 0 0 auto;
}

.novel-tag-coverage {
    margin-bottom: 12px;
    font-size: 13px;
    line-height: 1.6;
}

.novel-tag-download-status {
    display: none;
    font-size: 12px;
    overflow-wrap: anywhere;
}

.novel-tag-empty-state .novel-tag-actions {
    justify-content: center;
}

.novel-tag-search-actions button:disabled {
    opacity: 0.6;
    cursor: wait;
}

.novel-tag-search-name {
    overflow-wrap: anywhere;
    font-weight: 700;
}

.novel-tag-search-actions {
    margin-top: 9px;
}

.novel-tag-search-actions a {
    color: #126747;
    font-size: 13px;
}

.novel-tag-empty-state {
    padding: 16px;
    color: #79847f;
    font-size: 13px;
    text-align: center;
}

body.night-mode .novel-tag-beta-tool,
body.night-mode .novel-tag-input,
body.night-mode .novel-tag-select,
body.night-mode .novel-tag-note,
body.night-mode .novel-file-tag-relation,
body.night-mode .novel-tag-search-item,
body.night-mode .novel-tag-icon-btn,
body.night-mode .novel-file-tag-add,
body.night-mode .novel-tag-vote,
body.night-mode .novel-tag-appeal {
    border-color: #4a5751;
    background: #202723;
    color: #e7ece9;
}

body.night-mode .novel-tag-beta-head,
body.night-mode .novel-tag-option {
    border-color: #46524c;
    background: #29312d;
    color: #e1e7e4;
}

body.night-mode .novel-tag-beta-subtitle,
body.night-mode .novel-file-tag-file-meta,
body.night-mode .novel-file-tag-counts,
body.night-mode .novel-tag-catalog-count,
body.night-mode .novel-tag-search-meta {
    color: #aeb8b3;
}

body.night-mode .novel-tag-section-title,
body.night-mode .novel-tag-group-title,
body.night-mode .novel-tag-selection-count,
body.night-mode .novel-tag-empty-state {
    color: #b9c6bf;
}

body.night-mode .novel-tag-selected-chip {
    background: #234b3b;
    color: #e2f5ea;
    border-color: #6db58f;
}

@media (max-width: 700px) {
    .novel-tag-beta-overlay {
        align-items: flex-end;
        padding: 0;
    }

    .novel-tag-beta-tool {
        width: 100%;
        max-height: 94vh;
        border-radius: 8px 8px 0 0;
    }

    .novel-tag-beta-body {
        padding: 14px;
    }

    .novel-file-tag-relations,
    .novel-tag-search-controls {
        grid-template-columns: 1fr;
    }

    .novel-file-tag-summary {
        align-items: flex-start;
    }

    .novel-file-tag-add {
        flex: 0 0 auto;
    }
}
