
        :root {
            color-scheme: light dark;
        }
        .availability-toggle {
            display: inline-flex;
            align-items: center;
            gap: 0.25rem;
            font-size: 0.9rem;
        }
        body {
            font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
            margin: 0;
            padding: 0;
            background: #f4f7f9;
            color: #333;
        }
        .wrapper {
            max-width: 1200px;
            margin: 0 auto;
            padding: 2rem 1rem 3rem;
        }
        h1, h2 {
            color: #2c3e50;
            margin-top: 0;
        }
        .card > h2,
        .card > h1 {
            margin-top: 0;
        }
        .card {
            background: white;
            border-radius: 10px;
            padding: 1.5rem;
            margin-bottom: 1.5rem;
            box-shadow: 0 4px 15px rgba(0,0,0,0.08);
        }
        .alert {
            padding: 0.75rem 1rem;
            border-radius: 6px;
            margin-bottom: 1rem;
            background: #e9f7ef;
            color: #1e8449;
        }
        #toast-container {
            position: fixed;
            right: 1.5rem;
            top: 1.5rem;
            display: flex;
            flex-direction: column;
            gap: 0.75rem;
            z-index: 9999;
            pointer-events: none;
        }
        .toast {
            min-width: 220px;
            max-width: 320px;
            padding: 0.75rem 1rem;
            border-radius: 12px;
            background: rgba(255, 255, 255, 0.98);
            color: #1f2933;
            box-shadow: 0 12px 30px rgba(0, 0, 0, 0.15);
            font-size: 0.95rem;
            letter-spacing: 0.01em;
            border: 1px solid rgba(15, 23, 42, 0.08);
        }
        .toast--success {
            border-color: rgba(16, 185, 129, 0.35);
            color: #0f766e;
            background: rgba(240, 253, 250, 0.98);
        }
        .toast--error {
            border-color: rgba(239, 68, 68, 0.35);
            color: #b91c1c;
            background: rgba(254, 242, 242, 0.98);
        }
        table {
            width: 100%;
            border-collapse: collapse;
            margin-top: 1rem;
        }
        th, td {
            border: 1px solid #e0e0e0;
            padding: 0.5rem 0.75rem;
            text-align: left;
            font-size: 0.9rem;
            vertical-align: top !important;
        }
        th {
            background: #f0f4f8;
        }
        table.inner-table th, table.inner-table td {
            border-color: #ddd;
        }
        .form-grid {
            display: grid;
            grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
            gap: 1rem;
        }
        .form-field-end {
            display: flex;
            justify-content: flex-end;
            align-items: flex-end;
        }
        .independent-search-form {
            display: flex;
            flex-direction: column;
            gap: 1rem;
        }
        .search-bar {
            display: grid;
            grid-template-columns: minmax(240px, 1fr) minmax(180px, 260px);
            gap: 1rem;
            align-items: end;
        }
        .search-input-wrap {
            position: relative;
        }
        .search-history {
            display: flex;
            flex-direction: column;
            position: relative;
        }
        .history-toggle-btn {
            display: inline-flex;
            align-items: center;
            justify-content: space-between;
            gap: 0.35rem;
            padding: 0.45rem 0.6rem;
            border-radius: 8px;
            border: 1px solid #dfe6e9;
            background: #ffffff;
            color: #1f2f3f;
            font-weight: 600;
            cursor: pointer;
            text-align: left;
        }
        .history-toggle-btn:hover {
            background: #f3f5f9;
        }
        .history-dropdown {
            position: absolute;
            top: calc(100% + 0.4rem);
            left: 0;
            right: 0;
            border: 1px solid #dfe6e9;
            border-radius: 8px;
            background: #ffffff;
            padding: 0.4rem;
            max-height: 220px;
            overflow-y: auto;
            box-shadow: 0 10px 20px rgba(15, 23, 42, 0.08);
            z-index: 25;
        }
        .history-item {
            display: flex;
            align-items: center;
            justify-content: space-between;
            gap: 0.6rem;
            padding: 0.4rem;
            border-radius: 6px;
        }
        .history-item:hover {
            background: #f3f5f9;
        }
        .history-info {
            min-width: 0;
        }
        .history-title {
            font-weight: 600;
            color: #1f2f3f;
        }
        .history-meta {
            font-size: 0.8rem;
            color: #6c757d;
        }
        .history-actions {
            display: flex;
            gap: 0.35rem;
            flex-shrink: 0;
            margin-left: auto;
        }
        .history-actions .icon-btn {
            margin-top: 0;
            padding: 0.2rem;
            border-radius: 6px;
        }
        .history-actions .icon-btn img {
            width: 16px;
            height: 16px;
        }
        .history-empty {
            padding: 0.2rem;
        }
        .is-disabled {
            opacity: 0.6;
        }
        .is-disabled input,
        .is-disabled select,
        .is-disabled button {
            cursor: not-allowed;
        }
        .tmdb-suggestions {
            position: absolute;
            top: calc(100% + 0.4rem);
            left: 0;
            right: 0;
            background: #ffffff;
            border: 1px solid #dfe6e9;
            border-radius: 10px;
            box-shadow: 0 12px 24px rgba(15, 23, 42, 0.12);
            max-height: 280px;
            overflow-y: auto;
            overflow-x: hidden;
            z-index: 20;
            list-style: none;
            padding: 0;
            margin: 0;
        }
        .tmdb-suggestions.is-hidden {
            display: none;
        }
        .tmdb-suggestion-item {
            width: 100%;
            padding: 0.6rem 0.75rem;
            border: none;
            background: transparent;
            text-align: left;
            cursor: pointer;
            border-bottom: 1px solid #f0f0f0;
            box-sizing: border-box;
        }
        .tmdb-suggestion-item:last-child {
            border-bottom: none;
        }
        .tmdb-suggestion-item:hover {
            background: #f3f5f9;
        }
        .tmdb-suggestion-item .suggestion-title {
            display: flex;
            align-items: center;
            gap: 0.5rem;
            font-weight: 600;
            color: #1f2f3f;
            margin-bottom: 2px;
        }
        .tmdb-suggestion-item .suggestion-title-text {
            flex: 1;
            min-width: 0;
            overflow: hidden;
            text-overflow: ellipsis;
            white-space: nowrap;
        }
        .tmdb-suggestion-item .suggestion-meta {
            font-size: 0.85rem;
            color: #6c757d;
        }
        .emby-availability {
            display: inline-flex;
            gap: 0.25rem;
            margin-left: auto;
            padding-left: 0.5rem;
        }
        .emby-icon {
            display: inline-block;
            font-size: 1rem;
            line-height: 1;
        }
        .tmdb-suggestion {
            width: 100%;
            display: flex;
            align-items: center;
            gap: 0.75rem;
            padding: 0.6rem 0.75rem;
            border: none;
            background: transparent;
            text-align: left;
            cursor: pointer;
        }
        .tmdb-suggestion:hover {
            background: #f3f5f9;
        }
        .tmdb-suggestion-poster {
            width: 36px;
            height: 54px;
            border-radius: 6px;
            background: #e5e7eb;
            background-size: cover;
            background-position: center;
            flex-shrink: 0;
            position: relative;
        }
        .tmdb-suggestion-poster.is-empty::after {
            content: "?";
            position: absolute;
            inset: 0;
            display: flex;
            align-items: center;
            justify-content: center;
            font-weight: 600;
            color: #7f8c8d;
        }
        .tmdb-suggestion-title {
            font-weight: 600;
            color: #1f2f3f;
        }
        .tmdb-suggestion-meta {
            font-size: 0.85rem;
            color: #6c757d;
        }
        .selected-title-card {
            display: flex;
            align-items: flex-start;
            gap: 0.75rem;
            padding: 0.6rem 0.75rem;
            border-radius: 10px;
            border: 1px solid #dfe6e9;
            background: #f8fafc;
            margin-top: 0.5rem;
        }
        .selected-poster {
            width: 54px;
            height: 78px;
            border-radius: 8px;
            background: #e5e7eb;
            background-size: cover;
            background-position: center;
            flex-shrink: 0;
            position: relative;
        }
        .selected-poster[data-empty="true"]::after {
            content: "?";
            position: absolute;
            inset: 0;
            display: flex;
            align-items: center;
            justify-content: center;
            font-weight: 700;
            color: #7f8c8d;
        }
        .selected-meta {
            flex: 1;
            min-width: 0;
            display: flex;
            flex-direction: column;
            gap: 0.15rem;
        }
        .selected-title {
            font-weight: 700;
            color: #1f2f3f;
        }
        .selected-year {
            font-size: 0.9rem;
            color: #4a5867;
        }
        .selected-original {
            font-size: 0.85rem;
            color: #6c757d;
        }
        .selected-emby-availability {
            display: flex;
            flex-wrap: wrap;
            align-items: center;
            gap: 0.45rem;
            margin-top: 0.35rem;
        }
        .selected-emby-availability .tagline {
            margin: 0;
            font-size: 0.78rem;
            color: #5b6773;
        }
        .emby-server-icons {
            display: flex;
            flex-wrap: wrap;
            gap: 0.35rem;
        }
        .emby-server-btn {
            border: 1px solid #d5dde5;
            background: #ffffff;
            border-radius: 999px;
            padding: 0.15rem 0.45rem;
            font-size: 0.9rem;
            line-height: 1;
            cursor: pointer;
        }
        .emby-server-btn.is-active {
            background: #1f2f3f;
            border-color: #1f2f3f;
            color: #ffffff;
        }
        .selected-emby-browser {
            margin-top: 0.5rem;
            padding: 0.55rem;
            border-radius: 8px;
            border: 1px solid #e1e8ef;
            background: #ffffff;
        }
        .emby-browser-header {
            display: flex;
            align-items: center;
            justify-content: space-between;
            gap: 0.5rem;
            margin-bottom: 0.4rem;
        }
        .emby-browser-title {
            font-weight: 600;
            color: #1f2f3f;
        }
        .emby-browser-close {
            border: none;
            background: #e3e7ed;
            color: #2c3e50;
            border-radius: 999px;
            width: 26px;
            height: 26px;
            cursor: pointer;
            font-weight: 700;
            line-height: 1;
        }
        .emby-browser-sections {
            display: grid;
            grid-template-columns: minmax(120px, 1fr) minmax(180px, 2fr);
            gap: 0.6rem;
            align-items: start;
        }
        .emby-browser-sections.is-tv {
            grid-template-columns: minmax(140px, 210px) minmax(260px, 1fr);
        }
        .emby-browser-section {
            min-width: 0;
        }
        .emby-browser-section.emby-details {
            grid-column: 1 / -1;
        }
        .emby-browser-section.is-span {
            grid-column: 1 / -1;
        }
        .emby-section-title {
            font-weight: 600;
            font-size: 0.85rem;
            color: #4a5867;
            margin-bottom: 0.25rem;
        }
        .emby-season-scroll {
            max-height: clamp(180px, 40vh, 320px);
            overflow-y: auto;
            padding-right: 0.15rem;
            min-height: 0;
        }
        .emby-season-grid {
            display: grid;
            grid-template-columns: repeat(2, minmax(0, 1fr));
            gap: 0.35rem;
        }
        .emby-season-btn {
            border: 1px solid #d5dde5;
            background: #f8fafc;
            border-radius: 8px;
            padding: 0.22rem 0.4rem;
            font-size: 0.76rem;
            font-weight: 600;
            text-align: center;
            color: #1f2f3f;
            cursor: pointer;
        }
        .emby-season-btn.is-active {
            background: #1f2f3f;
            border-color: #1f2f3f;
            color: #ffffff;
        }
        .emby-season-btn:focus-visible {
            outline: 2px solid #1f2f3f;
            outline-offset: 2px;
        }
        .emby-episode-grid {
            --emby-episode-tile-width: 92px;
            --emby-episode-card-height: 36px;
            --emby-episode-strip-height: 12px;
            display: grid;
            grid-template-columns: repeat(auto-fill, var(--emby-episode-tile-width));
            gap: 0.45rem;
            align-content: start;
        }
        .emby-episode-tile {
            display: flex;
            flex-direction: column;
            gap: 0;
            width: var(--emby-episode-tile-width);
        }
        .emby-episode-card {
            width: 100%;
            height: var(--emby-episode-card-height);
            border-radius: 10px 10px 0 0;
            border: 1px solid #cbd5e1;
            border-bottom: 0;
            background: #e5e7eb;
            font-weight: 600;
            font-size: 0.85rem;
            color: #1f2f3f;
            display: flex;
            align-items: center;
            justify-content: center;
            cursor: pointer;
            box-sizing: border-box;
        }
        .emby-episode-card.is-active {
            background: #cbd5e1;
            border-color: #1f2f3f;
            color: #0f172a;
        }
        .emby-episode-card:focus-visible {
            outline: 2px solid #1f2f3f;
            outline-offset: 2px;
        }
        .emby-episode-strip {
            width: 100%;
            height: var(--emby-episode-strip-height);
            display: flex;
            gap: 2px;
            flex-wrap: nowrap;
            overflow: hidden;
            padding: 0;
            margin-top: 0;
            border: 1px solid #cbd5e1;
            border-top: 0;
            border-radius: 0 0 10px 10px;
            background: #f8fafc;
            box-sizing: border-box;
        }
        .emby-episode-segment {
            flex: 1 1 0;
            min-width: 0;
            border: none;
            border-radius: 0;
            height: 100%;
            cursor: pointer;
            display: flex;
            align-items: center;
            justify-content: center;
            padding: 0;
            appearance: none;
        }
        .emby-episode-segment.is-active {
            box-shadow: inset 0 0 0 2px #1f2f3f;
        }
        .emby-episode-segment:focus-visible {
            outline: none;
            box-shadow: inset 0 0 0 2px #1f2f3f;
        }
        .emby-episode-segment:first-child {
            border-bottom-left-radius: 8px;
        }
        .emby-episode-segment:last-child {
            border-bottom-right-radius: 8px;
        }
        .emby-episode-segment:only-child {
            border-bottom-left-radius: 8px;
            border-bottom-right-radius: 8px;
        }
        .emby-episode-segment.is-empty {
            background: #e2e8f0;
            width: 100%;
            flex: 1 1 0;
            cursor: default;
        }
        .emby-episode-more {
            background: #e2e8f0;
            color: #1f2f3f;
            font-size: 0.7rem;
            line-height: 1;
            font-weight: 700;
        }
        .emby-version-list {
            display: flex;
            flex-wrap: wrap;
            gap: 0.35rem;
        }
        .emby-resolution-chip {
            border: 1px solid #d5dde5;
            background: #ffffff;
            border-radius: 999px;
            padding: 0.1rem 0.4rem;
            font-size: 0.7rem;
            cursor: pointer;
            color: #1f2f3f;
        }
        .emby-resolution-chip.is-active {
            background: #1f2f3f;
            border-color: #1f2f3f;
            color: #ffffff;
        }
        .emby-resolution-chips {
            display: flex;
            flex-wrap: wrap;
            gap: 0.3rem;
            margin-bottom: 0.35rem;
        }
        .emby-resolution-btn {
            border: 1px solid #d5dde5;
            background: #ffffff;
            border-radius: 999px;
            padding: 0.15rem 0.5rem;
            font-size: 0.72rem;
            cursor: pointer;
            color: #1f2f3f;
        }
        .emby-resolution-btn.is-active {
            background: #1f2f3f;
            border-color: #1f2f3f;
            color: #ffffff;
        }
        .emby-details {
            border-top: 1px dashed #dfe6e9;
            padding-top: 0.4rem;
            display: flex;
            flex-direction: column;
            gap: 0.4rem;
        }
        .emby-streams-grid {
            display: flex;
            flex-wrap: nowrap;
            gap: 0.6rem;
            margin-top: 0.4rem;
            overflow-x: auto;
            padding-bottom: 0.25rem;
        }
        .emby-stream-table {
            border: 1px solid #e1e8ef;
            border-radius: 8px;
            padding: 0.4rem;
            background: #ffffff;
            flex: 0 0 auto;
        }
        .emby-stream-title {
            font-weight: 600;
            font-size: 0.85rem;
            color: #1f2f3f;
            margin-bottom: 0.3rem;
        }
        .emby-stream-grid {
            border-collapse: collapse;
            width: max-content;
        }
        .emby-stream-grid th,
        .emby-stream-grid td {
            border: 1px solid #e6edf4;
            padding: 0.25rem 0.4rem;
            font-size: 0.75rem;
            text-align: left;
            vertical-align: top;
            background: #ffffff;
        }
        .emby-stream-grid thead th {
            background: #f3f6fa;
            font-weight: 600;
            color: #1f2f3f;
        }
        .emby-stream-label {
            font-weight: 600;
            color: #4a5867;
            min-width: 90px;
            position: sticky;
            left: 0;
            background: #ffffff;
            z-index: 1;
        }
        .emby-stream-track {
            min-width: 120px;
            white-space: nowrap;
        }
        .emby-stream-value {
            min-width: 120px;
            white-space: nowrap;
        }
        .emby-details-title {
            font-weight: 600;
            color: #1f2f3f;
        }
        .emby-source-card {
            border: 1px solid #e1e8ef;
            border-radius: 8px;
            padding: 0.4rem 0.55rem;
            background: #f9fbfd;
        }
        .emby-source-title {
            font-weight: 600;
            font-size: 0.85rem;
            margin-bottom: 0.25rem;
            color: #1f2f3f;
        }
        .emby-detail-row {
            display: flex;
            justify-content: space-between;
            gap: 0.5rem;
            font-size: 0.78rem;
            margin-bottom: 0.2rem;
        }
        .emby-detail-label {
            color: #6c757d;
        }
        .emby-detail-value {
            color: #1f2f3f;
            text-align: right;
            word-break: break-word;
        }
        .emby-detail-tracks {
            margin: 0.25rem 0 0;
            padding-left: 1.1rem;
            font-size: 0.75rem;
            color: #4a5867;
        }
        .emby-detail-content {
            display: flex;
            flex-direction: column;
            gap: 0.45rem;
        }
        .emby-detail-popover {
            position: absolute;
            z-index: 1200;
            width: min(420px, 92vw);
            background: #ffffff;
            border: 1px solid #e1e8ef;
            border-radius: 12px;
            box-shadow: 0 12px 30px rgba(15, 23, 42, 0.18);
        }
        .emby-detail-popover.is-hidden {
            display: none;
        }
        .emby-detail-popover-header {
            display: flex;
            align-items: center;
            justify-content: space-between;
            padding: 0.55rem 0.7rem;
            border-bottom: 1px solid #eef2f7;
            background: #f8fafc;
        }
        .emby-detail-popover-title {
            font-weight: 600;
            font-size: 0.85rem;
            color: #1f2f3f;
        }
        .emby-detail-popover-close {
            border: none;
            background: #e3e7ed;
            color: #2c3e50;
            border-radius: 999px;
            width: 26px;
            height: 26px;
            cursor: pointer;
            font-weight: 700;
            line-height: 1;
        }
        .emby-detail-popover-body {
            max-height: 60vh;
            overflow: auto;
            padding: 0.7rem;
        }
        .emby-detail-modal {
            position: fixed;
            inset: 0;
            z-index: 1200;
            display: flex;
            align-items: flex-end;
            justify-content: center;
            background: rgba(15, 23, 42, 0.45);
        }
        .emby-detail-modal.is-hidden {
            display: none;
        }
        .emby-detail-sheet {
            width: min(680px, 100%);
            background: #ffffff;
            border-radius: 16px 16px 0 0;
            max-height: 85vh;
            display: flex;
            flex-direction: column;
            overflow: hidden;
        }
        .emby-detail-sheet-header {
            display: flex;
            align-items: center;
            justify-content: space-between;
            padding: 0.7rem 0.9rem;
            border-bottom: 1px solid #eef2f7;
            background: #f8fafc;
        }
        .emby-detail-sheet-title {
            font-weight: 600;
            font-size: 0.9rem;
            color: #1f2f3f;
        }
        .emby-detail-sheet-close {
            border: none;
            background: #e3e7ed;
            color: #2c3e50;
            border-radius: 999px;
            width: 28px;
            height: 28px;
            cursor: pointer;
            font-weight: 700;
            line-height: 1;
        }
        .emby-detail-sheet-body {
            padding: 0.8rem 0.9rem 1rem;
            overflow: auto;
        }
        .emby-version-menu {
            display: flex;
            flex-direction: column;
            gap: 0.35rem;
        }
        .emby-version-menu-item {
            border: 1px solid #d5dde5;
            background: #f8fafc;
            border-radius: 8px;
            padding: 0.4rem 0.55rem;
            font-size: 0.78rem;
            text-align: left;
            color: #1f2f3f;
            cursor: pointer;
        }
        .emby-version-menu-item:hover {
            background: #eef2f7;
        }
        .emby-version-menu-item:focus-visible {
            outline: 2px solid #1f2f3f;
            outline-offset: 2px;
        }
        @media (max-width: 720px) {
            .emby-browser-sections {
                grid-template-columns: 1fr;
            }
            .emby-browser-section.emby-details {
                grid-column: 1 / -1;
            }
            .emby-episode-grid {
                --emby-episode-tile-width: 84px;
                --emby-episode-card-height: 36px;
                --emby-episode-strip-height: 12px;
            }
        }
        .clear-selection-btn {
            border: none;
            background: #e3e7ed;
            color: #2c3e50;
            border-radius: 999px;
            width: 32px;
            height: 32px;
            cursor: pointer;
            font-weight: 700;
        }
        .clear-selection-btn:hover {
            background: #d3dae4;
        }
        .season-picker {
            margin-top: 0.6rem;
            padding: 0.6rem 0.75rem;
            border-radius: 10px;
            border: 1px solid #e1e6f0;
            background: #ffffff;
        }
        .season-picker .tagline {
            margin-bottom: 0.4rem;
        }
        .checkbox-row {
            display: flex;
            flex-wrap: wrap;
            gap: 0.75rem;
            align-items: center;
        }
        .checkbox-row label {
            font-weight: 400;
        }
        .indexer-group {
            border: 1px solid transparent;
            border-radius: 8px;
            padding: 0.35rem 0.45rem;
        }
        .indexer-group[data-invalid="true"] {
            border-color: #f5b7b1;
            background: #fef5f5;
        }
        .indexer-group[data-invalid="true"] .tagline {
            color: #c0392b;
        }
        .search-actions {
            display: flex;
            align-items: center;
            gap: 0.75rem;
        }
        .search-actions .btn {
            margin-top: 0;
        }
        .advanced-options {
            border: 1px solid #e1e6f0;
            border-radius: 12px;
            padding: 1rem;
            background: #fbfcff;
        }
        .advanced-options h3 {
            margin-top: 0;
            margin-bottom: 0.75rem;
            color: #1f2f3f;
        }
        .advanced-grid {
            display: grid;
            grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
            gap: 0.9rem;
        }
        .results-placeholder {
            min-height: 140px;
            padding: 0.5rem;
            border-radius: 10px;
            border: 1px dashed #d0d7de;
            background: #f9fbfd;
        }
        .results-placeholder.has-results {
            border: none;
            background: transparent;
            padding: 0;
        }
        .manual-results {
            display: flex;
            flex-direction: column;
            gap: 0.75rem;
        }
        .manual-loading {
            align-items: center;
            justify-content: center;
            min-height: 140px;
        }
        .manual-spinner {
            width: 34px;
            height: 34px;
            border-radius: 50%;
            border: 3px solid #dfe6e9;
            border-top-color: #0d62c2;
            animation: spin 0.8s linear infinite;
        }
        @keyframes spin {
            from { transform: rotate(0deg); }
            to { transform: rotate(360deg); }
        }
        .manual-results-header {
            display: flex;
            align-items: center;
            justify-content: space-between;
            flex-wrap: wrap;
            gap: 0.5rem;
        }
        .manual-results-actions {
            display: flex;
            align-items: center;
            gap: 0.5rem;
        }
        .manual-bulk-btn {
            margin-top: 0;
        }
        .manual-warning {
            color: #9a3412;
        }
        .manual-results-table-wrap {
            overflow-x: auto;
        }
        .manual-results-table {
            width: 100%;
            border-collapse: collapse;
            min-width: 720px;
        }
        .manual-results-table th,
        .manual-results-table td {
            border: 1px solid #e0e0e0;
            padding: 0.55rem 0.75rem;
            text-align: left;
            font-size: 0.9rem;
            vertical-align: top;
        }
        .manual-results-table .select-col {
            width: 30px;
            text-align: center;
        }
        .manual-results-table th {
            background: #f0f4f8;
        }
        .manual-title-cell {
            min-width: 220px;
        }
        .manual-title-text {
            font-weight: 600;
            color: #1f2f3f;
        }
        .manual-title-badges {
            display: flex;
            flex-wrap: wrap;
            gap: 0.35rem;
            margin-top: 0.25rem;
        }
        .manual-seeders,
        .manual-leechers-col {
            white-space: nowrap;
        }
        .manual-actions {
            display: flex;
            flex-wrap: wrap;
            gap: 0.4rem;
        }
        .manual-actions .btn {
            margin-top: 0;
        }
        .badge.action {
            border: none;
            cursor: pointer;
            font: inherit;
        }
        .badge.action:hover {
            filter: brightness(0.96);
        }
        .is-hidden {
            display: none !important;
        }
        .modal-backdrop {
            position: fixed;
            inset: 0;
            background: rgba(15, 23, 42, 0.6);
            display: flex;
            align-items: center;
            justify-content: center;
            padding: 1.5rem;
            z-index: 10000;
        }
        .modal {
            width: 100%;
            max-width: 560px;
            background: #ffffff;
            border-radius: 14px;
            box-shadow: 0 20px 50px rgba(15, 23, 42, 0.35);
            overflow: hidden;
        }
        .rss-items-modal {
            max-width: 1100px;
        }
        .modal-header {
            display: flex;
            align-items: center;
            justify-content: space-between;
            padding: 1rem 1.25rem;
            border-bottom: 1px solid #e2e8f0;
        }
        .modal-header h3 {
            margin: 0;
            font-size: 1.1rem;
            color: #1f2f3f;
        }
        .modal-close {
            border: none;
            background: #e3e7ed;
            color: #2c3e50;
            border-radius: 8px;
            width: 32px;
            height: 32px;
            cursor: pointer;
            font-size: 1.1rem;
            line-height: 1;
        }
        .modal-body {
            padding: 1rem 1.25rem 1.25rem;
            display: grid;
            gap: 0.6rem;
            max-height: 70vh;
            overflow-y: auto;
        }
        .rss-view-controls {
            display: flex;
            justify-content: space-between;
            gap: 1rem;
            flex-wrap: wrap;
            align-items: center;
            margin-bottom: 1rem;
        }
        .rss-view-content {
            overflow-x: auto;
        }
        .rss-view-tabs,
        .rss-view-actions {
            display: flex;
            gap: 0.5rem;
            align-items: center;
            flex-wrap: wrap;
        }
        .rss-view-tabs .btn.is-active {
            background: #0f172a;
            color: #ffffff;
        }
        .rss-view-range {
            font-size: 0.9rem;
            color: #5c6b7a;
        }
        .rss-items-table {
            width: 100%;
            border-collapse: collapse;
        }
        .rss-items-table th,
        .rss-items-table td {
            border: 1px solid #e2e8f0;
            padding: 0.5rem 0.6rem;
            font-size: 0.85rem;
            vertical-align: top;
        }
        .rss-items-table th {
            background: #f1f5f9;
            text-align: left;
        }
        .rss-html-list {
            display: flex;
            flex-direction: column;
            gap: 1rem;
        }
        .rss-html-item {
            border: 1px solid #e2e8f0;
            border-radius: 10px;
            padding: 0.75rem 0.9rem;
            background: #f8fafc;
        }
        .rss-html-item h4 {
            margin: 0 0 0.35rem 0;
            font-size: 1rem;
        }
        .rss-html-meta {
            font-size: 0.8rem;
            color: #64748b;
            display: flex;
            flex-wrap: wrap;
            gap: 0.6rem;
            margin-bottom: 0.5rem;
        }
        .rss-html-details {
            display: grid;
            grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
            gap: 0.6rem;
            margin-bottom: 0.75rem;
        }
        .rss-html-field {
            display: flex;
            flex-direction: column;
            gap: 0.15rem;
            font-size: 0.82rem;
            color: #1f2937;
        }
        .rss-html-label {
            font-weight: 600;
            color: #334155;
        }
        .rss-html-value {
            color: #475569;
            word-break: break-word;
        }
        .rss-html-section {
            margin-top: 0.6rem;
        }
        .rss-html-section-title {
            font-size: 0.85rem;
            font-weight: 600;
            color: #1f2f3f;
            margin-bottom: 0.3rem;
        }
        .rss-html-content {
            font-size: 0.9rem;
            color: #1f2937;
            line-height: 1.4;
        }
        .modal-row {
            display: grid;
            grid-template-columns: 140px 1fr;
            gap: 0.75rem;
            align-items: baseline;
            word-break: break-word;
        }
        .modal-label {
            font-weight: 600;
            color: #2c3e50;
        }
        .modal-list {
            margin: 0;
            padding-left: 1rem;
        }
        @media (max-width: 720px) {
            .search-bar {
                grid-template-columns: 1fr;
            }
        }
        .rule-note {
            margin-bottom: 0.4rem;
        }
        .rule-sections {
            display: grid;
            gap: 1rem;
            margin-top: 0.75rem;
        }
        .rule-block {
            border: 1px solid #e4e8f0;
            border-radius: 10px;
            padding: 1rem;
            background: #fbfcfe;
        }
        .rule-block h4 {
            margin: 0 0 0.6rem;
            color: #1f2f3f;
        }
        .rule-grid {
            display: grid;
            grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
            gap: 0.9rem;
        }
        .rule-grid.three-cols {
            grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
        }
        .rule-grid.three-cols .wide-field {
            grid-column: span 2;
        }
        .rule-grid .wide-field {
            grid-column: 1 / -1;
        }
        .sort-grid {
            display: grid;
            grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
            gap: 1rem;
            margin-top: 1rem;
        }
        .sort-column {
            border: 1px solid #e3e8f3;
            border-radius: 12px;
            padding: 1rem;
            background: #fff;
            box-shadow: 0 8px 20px rgba(41, 61, 102, 0.08);
        }
        .sort-column h4 {
            margin: 0 0 0.75rem;
            color: #1d3557;
        }
        .sort-pair {
            display: grid;
            grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
            gap: 0.75rem;
        }
        .sort-field label {
            font-weight: 600;
        }
        .sort-note {
            margin-top: 0.35rem;
        }
        label {
            display: block;
            margin-bottom: 0.35rem;
            font-weight: 600;
        }
        input[type="text"], input[type="number"], input[type="password"], input[type="url"] {
            width: 100%;
            padding: 0.6rem;
            border-radius: 6px;
            border: 1px solid #ccd1d9;
            box-sizing: border-box;
        }
        textarea {
            width: 100%;
            padding: 0.6rem;
            border-radius: 6px;
            border: 1px solid #ccd1d9;
            box-sizing: border-box;
            resize: vertical;
            min-height: 120px;
            font-family: inherit;
        }
        select {
            width: 100%;
            padding: 0.6rem;
            border-radius: 6px;
            border: 1px solid #ccd1d9;
            box-sizing: border-box;
            background: #fff;
            color: #333;
        }
        @media (prefers-color-scheme: dark) {
            body[data-tab-page="config"] input[type="text"],
            body[data-tab-page="config"] input[type="number"],
            body[data-tab-page="config"] input[type="password"],
            body[data-tab-page="config"] input[type="url"],
            body[data-tab-page="config"] textarea,
            body[data-tab-page="config"] select {
                background: #111827;
                color: #e5e7eb;
                border-color: #334155;
            }
            body[data-tab-page="config"] input::placeholder,
            body[data-tab-page="config"] textarea::placeholder {
                color: #94a3b8;
            }
        }
        .checkbox-group {
            display: flex;
            flex-direction: column;
            gap: 0.35rem;
            margin-top: 0.5rem;
        }
        .checkbox-group label {
            font-weight: 400;
        }
        .btn {
            margin-top: 1rem;
            padding: 0.8rem 1.2rem;
            background: #007bff;
            color: white;
            border: none;
            border-radius: 6px;
            cursor: pointer;
            font-size: 1rem;
        }
        .btn.is-loading {
            opacity: 0.7;
            cursor: wait;
        }
        .btn:hover {
            background: #0062cc;
        }
        .btn.secondary {
            background: #6c757d;
        }
        .btn.secondary:hover {
            background: #565e64;
        }
        .btn.light {
            background: #dfe4ea;
            color: #1f2f3f;
        }
        .btn.light:hover {
            background: #cfd8da;
        }
        .btn.ghost {
            background: #f4f6fb;
            color: #1f2f3f;
            border: 1px solid #cfd8e3;
        }
        .btn.ghost:hover {
            background: #e6ebf5;
        }
        .btn.small {
            padding: 0.4rem 0.7rem;
            font-size: 0.85rem;
        }
        .help-popover {
            position: relative;
            display: inline-block;
            margin-bottom: 1rem;
        }
        .help-trigger {
            width: 28px;
            height: 28px;
            border-radius: 50%;
            border: 1px solid #d1d9e6;
            background: #f8fafc;
            color: #1f2f3f;
            font-weight: 700;
            cursor: pointer;
        }
        .help-content {
            display: none;
            position: absolute;
            z-index: 10;
            top: 36px;
            left: 0;
            width: 300px;
            background: #ffffff;
            border: 1px solid #dbe3ef;
            border-radius: 10px;
            padding: 0.75rem 0.9rem;
            box-shadow: 0 10px 30px rgba(15, 23, 42, 0.15);
            color: #1f2f3f;
        }
        .help-content code {
            font-family: inherit;
            font-weight: 600;
        }
        .help-content code.breakable {
            overflow-wrap: anywhere;
            word-break: break-word;
        }
        .help-popover:hover .help-content,
        .help-popover:focus-within .help-content {
            display: block;
        }
        .primary-nav {
            display: flex;
            gap: 0.5rem;
            margin-bottom: 1rem;
            flex-wrap: wrap;
        }
        .primary-nav .nav-link {
            display: inline-flex;
            align-items: center;
            gap: 0.5rem;
            padding: 0.4rem 0.9rem;
            border-radius: 999px;
            background: #edf2f7;
            color: #2c3e50;
            text-decoration: none;
            font-weight: 600;
            border: 1px solid transparent;
        }
        .primary-nav .nav-link:hover {
            background: #d6e4f0;
        }
        .primary-nav .nav-link.active {
            background: #1f618d;
            color: #fff;
            border-color: #154360;
        }
        .notification-badge {
            display: inline-flex;
            align-items: center;
            justify-content: center;
            min-width: 20px;
            height: 20px;
            padding: 0 6px;
            background: #dc2626;
            color: white;
            border-radius: 10px;
            font-size: 0.7rem;
            font-weight: 700;
            line-height: 1;
        }
        .notification-badge.warning {
            background: #f59e0b;
        }
        .notification-badge + .notification-badge {
            margin-left: 4px;
        }
        .primary-nav .nav-link.active .notification-badge {
            background: #fff;
            color: #dc2626;
        }
        .primary-nav .nav-link.active .notification-badge.warning {
            color: #f59e0b;
        }
        .status-pill {
            display: inline-flex;
            align-items: center;
            padding: 0.1rem 0.5rem;
            border-radius: 999px;
            font-size: 0.8rem;
        }
        .status-ok {
            background: #e9f7ef;
            color: #1e8449;
        }
        .status-fail {
            background: #fdecea;
            color: #c0392b;
        }
        .status-skip {
            background: #f4f6f7;
            color: #5f6a6a;
        }
        .connection-status {
            margin-top: 0.75rem;
            display: grid;
            grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
            gap: 0.5rem;
        }
        .connection-card {
            border: 1px solid #e1e6f0;
            border-radius: 10px;
            padding: 0.6rem 0.8rem;
            background: #fbfcff;
        }
        .connection-row {
            display: flex;
            align-items: center;
            justify-content: space-between;
            gap: 0.75rem;
        }
        .connection-card .tagline {
            margin-top: 0.25rem;
        }
        .config-grid {
            display: grid;
            grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
            gap: 1rem;
            margin-top: 0.5rem;
        }
        .config-box {
            border: 1px solid #e1e6f0;
            border-radius: 12px;
            padding: 1rem;
            background: #fbfcff;
        }
        .config-box fieldset {
            border: none;
            padding: 0;
            margin: 0;
            min-inline-size: 0;
        }
        .config-box h4 {
            margin-top: 0;
        }
        .checklist-grid {
            display: grid;
            grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
            gap: 0.75rem;
            margin-top: 0.75rem;
        }
        .checklist {
            display: grid;
            gap: 0.4rem;
            padding: 0.45rem 0.6rem;
            border: 1px solid #e1e6f0;
            border-radius: 8px;
            background: #fff;
            max-height: 180px;
            overflow: auto;
        }
        .check-item {
            display: flex;
            align-items: center;
            gap: 0.45rem;
            font-size: 0.9rem;
            color: #1f2f3f;
        }
        .telegram-section fieldset {
            border: none;
            padding: 0;
            margin: 0;
            min-inline-size: 0;
        }
        .telegram-section .checklist {
            border: none;
            background: transparent;
            padding: 0;
            max-height: 220px;
        }
        .telegram-section .check-item {
            flex-direction: row;
            align-items: center;
            gap: 0.5rem;
        }
        .telegram-section .check-item input {
            margin: 0;
        }
        .telegram-alerts {
            margin-top: 0.35rem;
        }
        .telegram-alert {
            font-size: 0.78rem;
            line-height: 1.2;
            margin-top: 0.15rem;
        }
        .telegram-alert.ok {
            color: #1c7c3c;
        }
        .telegram-alert.warn {
            color: #9a6b00;
        }
        .telegram-alert.fail {
            color: #b42318;
        }
        .telegram-section {
            display: flex;
            flex-direction: column;
            gap: 0.75rem;
        }
        .telegram-section-header {
            display: flex;
            justify-content: space-between;
            align-items: flex-start;
            gap: 1rem;
        }
        .telegram-presets {
            margin-top: 1.25rem;
        }
        .telegram-preset-list {
            display: flex;
            flex-direction: column;
            gap: 0.75rem;
            border: 1px solid #e1e6f0;
            border-radius: 12px;
            overflow: hidden;
            background: #fff;
        }
        .telegram-preset-card {
            border: none;
            border-bottom: 1px solid #e5e7eb;
            border-radius: 0;
            padding: 1rem;
            background: transparent;
        }
        .telegram-preset-card:last-child {
            border-bottom: none;
        }
        .telegram-preset-grid {
            display: grid;
            grid-template-columns: minmax(140px, 1.2fr) minmax(120px, 1fr) minmax(160px, 1.3fr) minmax(160px, 1.3fr) auto;
            gap: 1rem;
            align-items: start;
        }
        .telegram-preset-name {
            font-weight: 700;
            font-size: 0.95rem;
            color: #111827;
        }
        .telegram-meta-label {
            font-size: 0.7rem;
            text-transform: uppercase;
            letter-spacing: 0.04em;
            color: #6b7280;
            margin-top: 0.35rem;
        }
        .telegram-meta-value {
            font-size: 0.88rem;
            color: #1f2f3f;
        }
        .telegram-meta-empty {
            font-size: 0.85rem;
            color: #9ca3af;
        }
        .telegram-meta-stack {
            display: flex;
            flex-direction: column;
            gap: 0.2rem;
        }
        .telegram-meta-line {
            display: flex;
            align-items: center;
            gap: 0.35rem;
            font-size: 0.85rem;
            color: #1f2f3f;
        }
        .telegram-status {
            font-weight: 700;
            font-size: 0.85rem;
        }
        .telegram-status.ok {
            color: #16a34a;
        }
        .telegram-status.fail {
            color: #dc2626;
        }
        .telegram-preset-actions {
            display: flex;
            gap: 0.4rem;
            justify-content: flex-end;
            align-self: flex-start;
            margin-top: 0.15rem;
        }
        .telegram-empty {
            margin-top: 1rem;
        }
        .telegram-resource-form {
            margin-bottom: 1rem;
        }
        .telegram-form-end {
            align-self: end;
        }
        .telegram-resource-row {
            display: flex;
            justify-content: space-between;
            align-items: center;
            gap: 0.75rem;
            padding: 0.7rem 0;
            border-bottom: 1px solid #e5e7eb;
        }
        .telegram-resource-info {
            flex: 1;
            min-width: 0;
        }
        .telegram-resource-title {
            font-size: 0.9rem;
            font-weight: 600;
            color: #111827;
            display: flex;
            align-items: center;
            gap: 0.4rem;
        }
        .telegram-resource-sub {
            color: #6b7280;
            font-size: 0.78rem;
            margin-top: 2px;
        }
        .telegram-verify {
            font-size: 0.85rem;
            font-weight: 700;
        }
        .telegram-verify.ok {
            color: #16a34a;
        }
        .telegram-verify.pending {
            color: #9ca3af;
        }
        .telegram-resource-actions {
            display: flex;
            gap: 0.4rem;
            align-items: center;
            flex-wrap: wrap;
            align-self: center;
        }
        .telegram-icon-btn {
            padding: 4px 8px;
            font-size: 14px;
            line-height: 1;
            min-width: 32px;
        }
        .telegram-icon-btn.danger {
            color: #dc2626;
        }
        .telegram-inline-form {
            margin: 0;
            display: inline;
        }
        .telegram-alias-form {
            margin: 0;
            display: none;
            gap: 0.4rem;
            align-items: center;
        }
        .telegram-alias-input {
            width: 120px;
            padding: 4px 8px;
            font-size: 0.8rem;
            border: 1px solid #e5e7eb;
            border-radius: 6px;
        }
        @media (max-width: 980px) {
            .telegram-preset-grid {
                grid-template-columns: repeat(2, minmax(0, 1fr));
            }
            .telegram-preset-actions {
                justify-content: flex-start;
            }
        }
        @media (max-width: 640px) {
            .telegram-preset-grid {
                grid-template-columns: 1fr;
            }
            .telegram-resource-row {
                flex-direction: column;
                align-items: flex-start;
            }
        }
        .rss-inspect-result {
            margin-top: 0.75rem;
            border: 1px solid #e1e6f0;
            border-radius: 10px;
            padding: 0.75rem;
            background: #f8fafc;
            min-height: 48px;
        }
        .rss-inspect-meta {
            display: flex;
            flex-wrap: wrap;
            gap: 0.6rem;
            font-size: 0.9rem;
            color: #52606d;
            margin-bottom: 0.5rem;
        }
        .rss-inspect-list {
            display: flex;
            flex-wrap: wrap;
            gap: 0.4rem;
        }
        .rss-inspect-chip {
            padding: 0.2rem 0.45rem;
            border-radius: 999px;
            background: #e8eef7;
            font-size: 0.8rem;
            color: #1f2f3f;
        }
        .rss-inspect-table {
            width: 100%;
            border-collapse: collapse;
        }
        .rss-inspect-table th,
        .rss-inspect-table td {
            border: 1px solid #dfe6ee;
            padding: 0.35rem 0.5rem;
            font-size: 0.85rem;
            vertical-align: top;
        }
        .tagline {
            font-size: 0.9rem;
            color: #6c757d;
        }
        .result-title {
            display: flex;
            justify-content: space-between;
            align-items: flex-start;
            gap: 0.5rem;
        }
        .title-text {
            word-break: break-word;
            overflow-wrap: anywhere;
        }
        .title-text mark {
            background: #ffeaa7;
            color: #333;
            padding: 0 0.1rem;
            border-radius: 3px;
        }
        .result-actions {
            display: flex;
            gap: 0.25rem;
        }
        .icon-btn, .icon-link {
            display: inline-flex;
            align-items: center;
            justify-content: center;
            padding: 0.3rem;
            border-radius: 4px;
            border: 1px solid #ccc;
            background: #fff;
            text-decoration: none;
            cursor: pointer;
        }
        .icon-btn:hover, .icon-link:hover {
            background: #e8ecef;
            border-color: #999;
        }
        .action-icon-small {
            width: 16px;
            height: 16px;
            display: block;
        }
        .action-icon {
            width: 20px;
            height: 20px;
            display: block;
        }
        .batch-icon-btn {
            display: inline-flex;
            align-items: center;
            justify-content: center;
            padding: 0.3rem;
            border-radius: 4px;
            border: 1px solid #ccc;
            background: #fff;
            cursor: pointer;
        }
        .batch-icon-btn:hover:not(:disabled) {
            background: #e8ecef;
            border-color: #999;
        }
        .batch-icon-btn:disabled {
            opacity: 0.4;
            cursor: not-allowed;
        }
        .action-icon-batch {
            width: 16px;
            height: 16px;
            display: block;
        }
        .batch-actions-icons {
            display: flex;
            gap: 0.25rem;
        }
        .progress-container {
            background: #e0e0e0;
            border-radius: 8px;
            overflow: hidden;
            height: 18px;
            margin-top: 0.5rem;
        }
        .progress-bar {
            background: #28a745;
            height: 100%;
            width: 0;
            transition: width 0.3s ease;
        }
        @media (max-width: 600px) {
            table {
                display: block;
                overflow-x: auto;
            }
        }
        .results-table, .inner-table {
            table-layout: fixed;
            width: 100%;
        }
        .results-table th,
        .results-table td,
        .inner-table th,
        .inner-table td {
            overflow-wrap: break-word;
            word-break: break-word;
        }
        details summary {
            cursor: pointer;
            font-weight: 600;
        }
        details.accordion-block {
            margin-top: 0.5rem;
            margin-bottom: 0.75rem;
        }
        .duplicates-panel {
            margin-top: 0.5rem;
        }
        .duplicates-panel summary {
            cursor: pointer;
            font-weight: 500;
            color: #2c3e50;
        }
        .duplicates-panel table {
            margin-top: 0.4rem;
        }
        .options-sections {
            display: grid;
            grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
            gap: 1rem;
            margin-top: 1rem;
        }
        .options-column h4 {
            margin: 0 0 0.5rem;
            color: #2c3e50;
        }
        .inline-field {
            display: flex;
            align-items: center;
            gap: 0.5rem;
            flex-wrap: wrap;
        }
        .options-column label {
            font-weight: 400;
        }
        .nested-option {
            margin-left: 1.2rem;
        }
        .variant-note {
            margin-top: 0.75rem;
            font-size: 0.9rem;
            color: #5d6d7e;
        }
        .requests-table {
            width: 100%;
            border-collapse: collapse;
            margin-top: 0.75rem;
        }
        .requests-table th, .requests-table td {
            border: 1px solid #dfe6e9;
            padding: 0.45rem;
            font-size: 0.85rem;
            vertical-align: top;
        }
        .requests-table th {
            background: #f5f8fb;
        }
        .requests-table input {
            width: 100%;
            box-sizing: border-box;
        }
        .badge {
            display: inline-flex;
            align-items: center;
            padding: 0.1rem 0.4rem;
            border-radius: 999px;
            font-size: 0.75rem;
            margin-right: 0.25rem;
        }
        .badge.info {
            background: #eaf2fd;
            color: #1f618d;
        }
        .badge.warn {
            background: #fef5e7;
            color: #af601a;
        }
        .badge.skip {
            background: #f9ebea;
            color: #922b21;
        }
        .badge.success {
            background: #e8f6f3;
            color: #117a65;
        }
        .badge.resolution {
            background: #eaf2fd;
            color: #1f618d;
        }
        .season-status-line {
            margin-top: 0.35rem;
            display: flex;
            flex-wrap: wrap;
            gap: 0.35rem;
        }
        .season-tab {
            border: none;
            cursor: pointer;
            transition: transform 0.2s ease, box-shadow 0.2s ease;
        }
        .season-tab.active {
            box-shadow: 0 6px 18px rgba(38, 55, 89, 0.15);
            transform: translateY(-1px);
        }
        .season-panels {
            margin-top: 0.4rem;
        }
        .season-detail-panel {
            display: none;
            padding: 0.3rem 0;
            text-align: left;
        }
        .season-detail-panel.active {
            display: block;
        }
        .episode-chips {
            display: flex;
            flex-wrap: wrap;
            gap: 0.2rem;
            margin-top: 0.25rem;
        }
        .episode-chip {
            font-size: 0.75rem;
            padding: 0.15rem 0.45rem;
            border-radius: 999px;
            background: #ecf0f1;
            color: #2c3e50;
        }
        .episode-chip.status-available {
            background: #e9f7ef;
            color: #1e8449;
        }
        .episode-chip.status-pending {
            background: #fdecea;
            color: #c0392b;
        }
        .episode-chip.status-pending.justwatch-checked {
            background: #fef3c7;
            color: #92400e;
        }
        .episode-chip.justwatch-checked,
        .justwatch-pill.justwatch-checked {
            position: relative;
        }
        .justwatch-checked.is-open::after {
            content: attr(data-jw-label);
            position: absolute;
            left: 0;
            top: calc(100% + 6px);
            z-index: 10;
            padding: 0.35rem 0.55rem;
            border-radius: 8px;
            background: #111827;
            color: #f9fafb;
            font-size: 0.7rem;
            line-height: 1.2;
            max-width: 240px;
            white-space: normal;
            box-shadow: 0 8px 18px rgba(15, 23, 42, 0.2);
        }
        .justwatch-checked.is-open::before {
            content: "";
            position: absolute;
            left: 0.6rem;
            top: calc(100% + 2px);
            width: 8px;
            height: 8px;
            background: #111827;
            transform: rotate(45deg);
            border-radius: 2px;
            z-index: 9;
        }
        .justwatch-pill {
            display: inline-flex;
            align-items: center;
            padding: 0.2rem 0.55rem;
            border-radius: 999px;
            border: 1px solid #f59e0b;
            background: #fef3c7;
            color: #92400e;
            font-size: 0.75rem;
            font-weight: 600;
            cursor: pointer;
        }
        .justwatch-pill:focus {
            outline: 2px solid rgba(245, 158, 11, 0.5);
            outline-offset: 2px;
        }
        .episode-chip.status-unreleased {
            background: #f4f6f7;
            color: #5d6d7e;
        }
        .episode-chip[title] {
            cursor: help;
        }
        .episode-chip .justwatch-badge {
            display: inline-flex;
            align-items: center;
            margin-left: 0.25rem;
            padding: 0.05rem 0.3rem;
            border-radius: 999px;
            background: #dbeafe;
            color: #1e40af;
            font-size: 0.6rem;
            font-weight: 600;
        }
        .list-actions {
            display: flex;
            flex-wrap: wrap;
            gap: 0.4rem;
            margin: 0.5rem 0 0.4rem;
            align-items: center;
        }
        .btn.small {
            padding: 0.45rem 0.75rem;
            font-size: 0.85rem;
        }
        .btn.ghost {
            background: transparent;
            color: #2c3e50;
            border: 1px solid #ccd1d9;
        }
        .btn.ghost:hover {
            background: #e9ecef;
        }
        .title-year {
            font-weight: 400;
            margin-left: 0.3rem;
            color: #34495e;
        }
        .request-list {
            display: flex;
            flex-direction: column;
            gap: 0.9rem;
            margin-top: 0.75rem;
        }
        .request-list.collapsed {
            display: none;
        }
        .group-header {
            margin-top: 1rem;
        }
        .group-toggle {
            border: none;
            background: none;
            font-size: 1.05rem;
            font-weight: 600;
            display: inline-flex;
            align-items: center;
            gap: 0.45rem;
            cursor: pointer;
            color: #1f2f3f;
        }
        .group-toggle .group-count {
            font-size: 0.85rem;
            color: #6c7a89;
        }
        .group-toggle .toggle-icon {
            font-size: 0.9rem;
            transition: transform 0.2s ease;
        }
        .group-toggle[aria-expanded="false"] .toggle-icon {
            transform: rotate(-90deg);
        }
        .request-row {
            display: flex;
            gap: 0.6rem;
            align-items: flex-start;
            width: 100%;
            max-width: 100%;
        }
        .request-card {
            border: 1px solid #dfe6e9;
            border-radius: 12px;
            padding: 0.9rem 1.1rem;
            background: #fff;
            box-shadow: 0 8px 20px rgba(44, 62, 80, 0.05);
            flex: 1 1 100%;
            width: 100%;
            min-width: 0;
        }
        .request-header {
            display: flex;
            flex-wrap: wrap;
            align-items: flex-start;
            gap: 0.85rem;
            justify-content: space-between;
        }
        .request-checkbox {
            padding-top: 0.35rem;
        }
        .request-checkbox input {
            margin: 0;
        }
        .request-main {
            width: 100%;
            display: grid;
            grid-template-columns: minmax(0, 0.38fr) minmax(0, 0.62fr);
            column-gap: 1rem;
            align-items: flex-start;
        }
        .request-info-block {
            display: flex;
            flex-direction: column;
            gap: 0.55rem;
            min-width: 0;
        }
        .request-title-block {
            display: flex;
            flex-direction: column;
            gap: 0.35rem;
            min-width: 0;
        }
        .request-right-block {
            display: flex;
            flex-direction: column;
            gap: 0.7rem;
            min-width: 0;
        }
        .request-fields {
            width: 100%;
            display: grid;
            grid-template-columns: repeat(3, minmax(120px, 1fr));
            gap: 0.65rem;
            min-width: 0;
        }
        .request-fields label {
            font-weight: 600;
            color: #2c3e50;
            font-size: 0.85rem;
            display: flex;
            flex-direction: column;
            gap: 0.25rem;
        }
        .request-fields input {
            margin-top: 0;
        }
        .request-options-panel {
            display: flex;
            flex-direction: column;
            gap: 0.45rem;
        }
        .request-option-inline {
            display: flex;
            flex-wrap: nowrap;
            align-items: center;
            gap: 0.5rem;
            overflow-x: auto;
        }
        .request-option-inline span,
        .request-option-inline label {
            margin: 0;
            display: inline-flex;
            align-items: center;
            gap: 0.25rem;
            font-weight: 500;
            white-space: nowrap;
        }
        .option-small-text {
            font-size: 0.75rem;
            color: #42505f;
        }
        .option-label {
            font-weight: 600;
            color: #2c3e50;
        }
        .req-alt-select {
            width: 4.5rem;
            height: 1.85rem;
            font-size: 0.8rem;
            padding: 0 0.35rem;
        }
        .req-year-variance {
            width: 3.2rem;
            height: 1.85rem;
            font-size: 0.8rem;
            padding: 0 0.35rem;
        }
        .request-option-inline input[type="checkbox"] {
            transform: scale(0.9);
        }
        @media (max-width: 800px) {
            .request-main {
                grid-template-columns: 1fr;
            }
            .request-fields {
                grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
            }
            .request-option-inline {
                flex-wrap: wrap;
            }
        }
        .request-meta {
            display: grid;
            grid-template-columns: repeat(4, minmax(0, 1fr));
            gap: 0.32rem;
            margin-top: 0.12rem;
            min-width: 0;
        }
        .request-meta .meta-item {
            white-space: nowrap;
            overflow: hidden;
            text-overflow: ellipsis;
        }
        .meta-label,
        .meta-value {
            font-size: 0.72rem;
        }
        .meta-label {
            color: #7f8c8d;
            text-transform: uppercase;
            letter-spacing: 0.05em;
            display: block;
        }
        .meta-value {
            font-weight: 400;
            color: #4a5867;
        }
        .results-table {
            border-collapse: separate;
            border-spacing: 0;
            border: none;
            overflow: hidden;
            border-radius: 12px;
            box-shadow: 0 15px 35px rgba(0,0,0,0.08);
        }
        .results-table th, .results-table td {
            border: none;
        }
        .results-table .actions-col {
            text-align: center;
            vertical-align: top !important;
        }
        .results-table td.actions-col {
            text-align: center;
            vertical-align: top !important;
            padding-top: 0.5rem;
        }
        .results-table td.actions-col .btn {
            margin-top: 0;
        }
        .scan-toolbar {
            display: flex;
            flex-wrap: wrap;
            align-items: center;
            gap: 0.6rem;
            margin: 0.6rem 0 1rem;
        }
        .scan-toolbar .tagline {
            margin: 0;
        }
        .resolution-header {
            display: flex;
            flex-direction: column;
            gap: 0.75rem;
            margin-bottom: 0.75rem;
        }
        .resolution-header-row {
            display: flex;
            flex-wrap: wrap;
            justify-content: space-between;
            gap: 0.75rem;
            align-items: center;
        }
        .resolution-header h4 {
            margin: 0;
            flex: 1;
        }
        .block-filter {
            padding: 0.35rem 0.5rem;
            border-radius: 6px;
            border: 1px solid #cfd8e3;
            font-size: 0.85rem;
            max-width: 33%;
            min-width: 150px;
            flex-shrink: 0;
        }
        .batch-actions {
            display: inline-flex;
            gap: 0.35rem;
            align-items: center;
        }
        .batch-btn {
            border: 1px solid #cfd8e3;
            background: #f1f4f9;
            color: #1f2f3f;
            padding: 0.35rem 0.6rem;
            border-radius: 6px;
            cursor: pointer;
            font-size: 0.85rem;
        }
        .batch-btn:disabled {
            opacity: 0.4;
            cursor: default;
        }
        .auto-grid {
            display: grid;
            grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
            gap: 1rem;
            margin-top: 1rem;
        }
        .auto-section {
            border: 1px solid #e1e6f0;
            border-radius: 10px;
            padding: 1rem;
            background: #fbfcff;
            display: flex;
            flex-direction: column;
            gap: 0.6rem;
        }
        .auto-section.auto-disabled {
            opacity: 0.5;
        }
        .auto-header {
            display: flex;
            align-items: center;
            justify-content: space-between;
            gap: 0.5rem;
        }
        .auto-header h3 {
            margin: 0;
            font-size: 1.05rem;
        }
        .auto-inline {
            display: inline-flex;
            align-items: center;
            gap: 0.4rem;
            font-size: 0.9rem;
        }
        .auto-mode {
            display: grid;
            grid-template-columns: auto auto 1fr;
            gap: 0.4rem;
            align-items: center;
        }
        .auto-mode input[type="number"] {
            width: 80px;
        }
        .auto-mode input[type="text"] {
            width: 100%;
        }
        .auto-mode label {
            margin: 0;
            font-weight: 500;
        }
        .auto-note {
            font-size: 0.8rem;
            color: #7f8c8d;
            margin: 0;
        }
        .inline-actions {
            display: flex;
            flex-wrap: wrap;
            align-items: center;
            gap: 0.6rem;
        }
        .stacked-actions {
            display: grid;
            gap: 0.4rem;
        }
        .inline-input {
            min-width: 160px;
            padding: 0.35rem 0.55rem;
            border-radius: 8px;
            border: 1px solid #d0d7e2;
            background: #fff;
            color: #1f2f3f;
        }
        .tagline.small {
            font-size: 0.78rem;
            color: #8a95a3;
        }
        .trakt-header {
            display: flex;
            align-items: center;
            justify-content: space-between;
            gap: 0.75rem;
        }
        .trakt-subtitle {
            margin-bottom: 0.4rem;
        }
        .trakt-hint {
            margin-bottom: 0.75rem;
        }
        .trakt-actions {
            display: flex;
            flex-direction: column;
            gap: 0.5rem;
        }
        .trakt-device {
            display: inline-flex;
            flex-wrap: wrap;
            align-items: center;
            gap: 0.5rem;
            font-size: 0.9rem;
            color: #2c3e50;
        }
        .trakt-link {
            color: #1f618d;
            text-decoration: underline;
            font-weight: 600;
        }
        .trakt-code {
            display: inline-flex;
            align-items: center;
            padding: 0.15rem 0.5rem;
            border-radius: 999px;
            background: #edf2f7;
            color: #2c3e50;
            font-weight: 700;
            letter-spacing: 0.08em;
        }
        input.read-only {
            background: #f4f6f7;
            color: #5f6a6a;
        }
        .bucket-select-all {
            display: inline-flex;
            align-items: center;
            gap: 0.25rem;
            font-size: 0.8rem;
        }
        .result-select {
            width: 1rem;
            height: 1rem;
        }
        .filter-hidden {
            display: none !important;
        }
        .manual-filter-hidden {
            display: none !important;
        }
        .result-select-cell {
            width: 30px;
        }
        .inner-table .col-select {
            width: 25px;
        }
        .inner-table .col-episode {
            width: 60px;
        }
        .inner-table .col-size {
            width: 65px;
        }
        .inner-table .col-seed {
            width: 50px;
        }
        .inner-table .col-source {
            width: 90px;
        }
        .inner-table .col-episode,
        .inner-table .col-size,
        .inner-table .col-seed {
            text-align: center;
            white-space: nowrap;
        }
        .inner-table .col-source {
            white-space: nowrap;
            overflow: hidden;
            text-overflow: ellipsis;
        }
        .results-table .col-select {
            width: 25px;
        }
        .results-table .col-id {
            width: 50px;
        }
        .results-table .col-actions {
            width: 110px;
        }
        .results-table .col-results {
            width: 100px;
        }
        .results-table .col-id,
        .results-table .col-actions,
        .results-table .col-results {
            text-align: center;
            white-space: nowrap;
        }
        .context-menu {
            position: absolute;
            z-index: 999;
            background: #ffffff;
            border: 1px solid #cbd5f5;
            border-radius: 6px;
            box-shadow: 0 10px 25px rgba(15,23,42,0.18);
            padding: 0.25rem 0;
            display: none;
            min-width: 210px;
            color: #0f172a;
        }
        .context-menu.visible {
            display: block;
        }
        .context-menu button {
            width: 100%;
            padding: 0.45rem 0.9rem;
            border: none;
            background: transparent;
            text-align: left;
            cursor: pointer;
            font-size: 0.9rem;
            color: #0f172a;
        }
        .context-menu button:hover {
            background: #eef2f9;
        }
        .inner-table {
            border-radius: 8px;
            overflow: hidden;
        }
        .inner-table th, .inner-table td {
            border: none;
            vertical-align: middle;
        }
        .tab-shell {
            margin-top: 1.5rem;
        }
        .tabs {
            display: flex;
            flex-wrap: wrap;
            gap: 0.5rem;
            border-bottom: 1px solid #dfe6e9;
            margin-bottom: 1rem;
        }
        .tab-btn {
            border: none;
            background: #e3e7ed;
            color: #2c3e50;
            padding: 0.6rem 1rem;
            border-radius: 6px 6px 0 0;
            cursor: pointer;
            font-size: 0.95rem;
            font-weight: 600;
        }
        .tab-btn.active {
            background: #ffffff;
            color: #0d62c2;
            box-shadow: 0 -2px 10px rgba(0,0,0,0.05);
        }
        .tab-panel {
            display: none;
            animation: fadeIn 0.25s ease;
            padding-top: 0.2rem;
        }
        .tab-panel.active {
            display: block;
        }
        @keyframes fadeIn {
            from { opacity: 0; transform: translateY(8px); }
            to { opacity: 1; transform: translateY(0); }
        }
        .results-table tr.stale {
            background: #f4f5f7;
        }
        .results-table tr.stale details summary {
            color: #5d6d7e;
        }
        .result-updated {
            font-size: 0.8rem;
            color: #7f8c8d;
            margin-top: 0.2rem;
        }
        .results-row {
            cursor: pointer;
            background: #ffffff;
        }
        .results-row:hover {
            background: #f8f9fa;
        }
        .results-row .select-col {
            cursor: default;
        }
        .details-row {
            display: none;
        }
        .details-row.expanded {
            display: table-row;
        }
        .details-content {
            padding: 1rem;
            background: #e8ecef;
            border-top: 2px solid #cbd5e0;
        }
        .results-count {
            font-size: 0.9rem;
            color: #2c3e50;
            font-weight: 600;
            margin-top: 0.3rem;
        }
        .resolution-block {
            background: #f9fbfd;
            padding: 0.25rem 0.75rem 0.75rem 0.75rem;
            border-radius: 10px;
            border: 1px solid #e3ebf3;
            margin-bottom: 0.9rem;
        }
        .inner-table {
            background: #ffffff;
        }
        .inner-table tbody tr {
            background: #ffffff;
        }
        .inner-table tbody tr:hover {
            background: #f8f9fa;
        }
        .result-select-cell input[type="checkbox"],
        .bucket-select-all-checkbox,
        .duplicates-select-all-checkbox,
        .result-scan-checkbox,
        .scan-select-all-group {
            transform: scale(1.0);
            width: 16px;
            height: 16px;
        }
        th.sortable {
            user-select: none;
        }
        th.sortable:hover {
            background: #e8ecef;
        }
        .sort-indicator {
            color: #3498db;
            font-size: 0.8em;
        }
