:root {
    --ink: #101828;
    --muted: #667085;
    --line: #e4e7ec;
    --surface: #ffffff;
    --canvas: #f7f8fb;
    --primary: #5b5ce2;
    --primary-dark: #4647c7;
    --soft-purple: #efefff;
    --green: #16805a;
    --soft-green: #eaf8f1;
    --shadow: 0 18px 50px rgba(16, 24, 40, .07);
}

* { box-sizing: border-box; }
html { min-width: 320px; background: var(--canvas); }
body { margin: 0; background: var(--canvas); color: var(--ink); font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; font-size: 15px; line-height: 1.5; }
button, input, select { font: inherit; }
button { cursor: pointer; }
.button:disabled { opacity: .55; cursor: wait; transform: none; }
.d-none { display: none !important; }
.sr-only { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.shell { width: min(1160px, calc(100% - 48px)); margin: 0 auto; }
.site-header { height: 88px; display: flex; align-items: center; justify-content: space-between; }
.brand { display: inline-flex; align-items: center; gap: 11px; color: var(--ink); text-decoration: none; }
.brand-mark { display: block; width: 36px; height: 36px; border-radius: 11px; object-fit: cover; box-shadow: 0 8px 18px rgba(91,92,226,.22); }
.brand strong, .brand small { display: block; }
.brand strong { font-size: 15px; letter-spacing: -.02em; }
.brand small { color: var(--muted); font-size: 11px; margin-top: 1px; }
.card { background: var(--surface); border: 1px solid rgba(228,231,236,.9); border-radius: 18px; box-shadow: var(--shadow); }
.button { border: 0; border-radius: 10px; display: inline-flex; align-items: center; justify-content: center; gap: 9px; min-height: 42px; padding: 0 17px; font-size: 13px; font-weight: 700; transition: .18s ease; }
.button:hover { transform: translateY(-1px); }
.button-primary { color: #fff; background: var(--primary); box-shadow: 0 8px 18px rgba(91,92,226,.2); }
.button-primary:hover { background: var(--primary-dark); }
.button-dark { color: #fff; background: var(--ink); }
.button-dark:hover { background: #263247; }
.button-secondary { color: var(--primary-dark); background: var(--soft-purple); }
.button-secondary:hover { background: #e5e5ff; }
.button-light, .button-quiet { color: #475467; background: #f2f4f7; }
.button-quiet { min-height: 36px; font-size: 12px; }
.button-wide { width: 100%; }
.alert { margin: 0 0 22px; border-radius: 11px; padding: 12px 15px; font-size: 13px; border: 1px solid transparent; }
.alert-success { color: #12633f; background: var(--soft-green); border-color: #b8ead1; }
.alert-warning { color: #8d5e0a; background: #fff8e7; border-color: #f3dfaa; }
.alert-danger { color: #a12d3e; background: #fff0f1; border-color: #f3c7cd; }
.alert-info { color: #3c4a8c; background: var(--soft-purple); border-color: #d9d9ff; }
.section-kicker, .eyebrow { color: #7778d9; font-size: 10px; font-weight: 800; letter-spacing: .13em; }
.auth-layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(420px, 1.02fr); min-height: 570px; align-items: stretch; margin: 42px 0 75px; }
.intro-panel { display: flex; flex-direction: column; justify-content: center; padding: 28px 75px 28px 32px; }
.intro-panel h1 { max-width: 480px; margin: 15px 0 18px; font-size: clamp(36px, 4.5vw, 58px); line-height: 1.03; letter-spacing: -.055em; }
.intro-panel p { max-width: 420px; color: var(--muted); margin: 0; font-size: 16px; }
.feature-list { display: grid; gap: 12px; margin-top: 42px; color: #475467; font-size: 13px; font-weight: 600; }
.feature-list span { display: inline-flex; align-items: center; gap: 10px; }
.feature-list i { display: grid; place-items: center; width: 21px; height: 21px; border-radius: 50%; color: var(--green); background: var(--soft-green); font-size: 12px; font-style: normal; }
.auth-card { align-self: center; padding: 36px 38px; }
.card-heading h2, .connect-card h2, .addon-card h2, .content-card h2 { margin: 6px 0 5px; font-size: 21px; letter-spacing: -.035em; }
.card-heading p, .card-copy { color: var(--muted); margin: 0; font-size: 13px; }
.auth-forms { display: grid; grid-template-columns: 1fr auto 1fr; gap: 20px; margin-top: 30px; }
.form-block { display: grid; gap: 11px; align-content: start; }
.form-block h3 { margin: 0 0 4px; font-size: 13px; }
.form-secondary h3 { color: #475467; }
.form-divider { position: relative; display: flex; align-items: center; justify-content: center; color: #98a2b3; font-size: 11px; }
.form-divider::before { content: ""; height: 100%; border-left: 1px solid var(--line); }
.form-divider span { position: absolute; padding: 7px 0; background: var(--surface); }
label { display: grid; gap: 6px; color: #475467; font-size: 11px; font-weight: 700; }
input, select { width: 100%; height: 42px; border: 1px solid var(--line); border-radius: 9px; outline: 0; padding: 0 12px; color: var(--ink); background: #fff; font-size: 13px; transition: .15s ease; }
input::placeholder { color: #98a2b3; }
input:focus, select:focus { border-color: #9192ef; box-shadow: 0 0 0 3px rgba(91,92,226,.1); }
.page-intro { display: flex; align-items: end; justify-content: space-between; gap: 20px; margin: 35px 0 26px; }
.page-intro h1 { margin: 6px 0 4px; font-size: 30px; letter-spacing: -.05em; }
.page-intro p { margin: 0; color: var(--muted); font-size: 13px; }
.summary-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.summary-card { display: flex; align-items: center; gap: 13px; min-height: 92px; padding: 17px 18px; background: var(--surface); border: 1px solid var(--line); border-radius: 15px; }
.summary-icon, .provider-logo { display: grid; place-items: center; flex: 0 0 auto; font-weight: 800; }
.summary-icon { width: 40px; height: 40px; border-radius: 12px; font-size: 16px; }
.stremio-icon, .stremio-logo { color: #4445b4; background: #eeeeff; }
.nuvio-icon, .nuvio-logo { color: #087e82; background: #e7faf8; }
.jobs-icon { color: #a05f0b; background: #fff4df; }
.summary-label, .summary-number { display: block; }
.summary-label { color: var(--muted); font-size: 11px; font-weight: 700; }
.summary-number { margin-top: 3px; font-size: 20px; letter-spacing: -.04em; }
.summary-arrow { margin-left: auto; color: #98a2b3; }
.status { display: inline-flex; align-items: center; gap: 5px; margin-top: 4px; font-size: 11px; font-weight: 700; }
.status::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.status-muted { color: #98a2b3; }
.status-success { color: var(--green); }
.status-warning { color: #b87510; }
.connect-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px; margin-top: 14px; }
.connect-card { padding: 25px; }
.provider-heading { display: flex; align-items: center; gap: 12px; }
.provider-logo { width: 38px; height: 38px; border-radius: 11px; font-size: 16px; }
.connect-card .card-copy { margin: 15px 0 22px; }
.connection-state { display: grid; gap: 13px; margin: 18px 0 4px; padding: 15px; border: 1px solid var(--line); border-radius: 12px; background: #fafbfc; }
.connection-state.reauth { border-color: #f2d79c; background: #fffaf0; }
.connection-state-title { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.connection-state-title strong { font-size: 13px; }
.connection-state-meta { color: var(--muted); font-size: 11px; }
.connection-state-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.connection-state-actions .button { min-height: 34px; padding: 0 12px; font-size: 11px; }
.select-row { display: flex; gap: 8px; }
.select-row select { flex: 1; }
.select-row .button { flex: 0 0 auto; min-width: 80px; }
.addon-card { display: flex; align-items: center; justify-content: space-between; gap: 25px; margin-top: 14px; padding: 23px 25px; background: linear-gradient(105deg, #f1f1ff 0%, #fff 70%); }
.addon-copy { display: flex; align-items: center; gap: 14px; }
.addon-mark { display: block; flex: 0 0 auto; width: 44px; height: 44px; border-radius: 13px; object-fit: cover; box-shadow: 0 5px 14px rgba(51,42,150,.18); }
.addon-card.is-configuring { outline: 3px solid rgba(91,92,226,.2); box-shadow: 0 13px 34px rgba(91,92,226,.14); }
.addon-card h2 { font-size: 16px; }
.addon-card p { margin: 0; color: var(--muted); font-size: 12px; }
.addon-url { flex-basis: 100%; margin-top: 4px; }
.addon-card:has(.addon-url:not(.d-none)) { flex-wrap: wrap; }
.addon-url .input-group { display: flex; gap: 8px; }
.addon-url .input-group input { flex: 1; }
.addon-url .install-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.addon-url small { display: block; margin-top: 8px; color: var(--muted); }
.content-heading { display: flex; align-items: start; justify-content: space-between; }
.content-dot { width: 7px; height: 7px; margin-top: 5px; border-radius: 50%; background: #c5c6f6; }
.empty-state { display: grid; place-items: center; min-height: 105px; color: #98a2b3; font-size: 13px; }
.media-hub { margin-top: 14px; padding: 27px 25px 30px; overflow: visible; }
.media-hub-heading { display: flex; align-items: end; justify-content: space-between; gap: 24px; }
.media-hub-heading h2, .jobs-card h2 { margin: 6px 0 4px; font-size: 21px; letter-spacing: -.035em; }
.media-hub-heading p { margin: 0; color: var(--muted); font-size: 13px; }
.media-tools { display: flex; gap: 8px; align-items: center; }
.media-tools label { display: block; }
.media-tools select { width: 125px; }
.media-search { position: relative; width: min(240px, 28vw); }
.media-search > span[aria-hidden] { position: absolute; z-index: 1; left: 12px; top: 9px; color: #98a2b3; font-size: 19px; line-height: 1; }
.media-search input { padding-left: 37px; }
.media-tabs { display: flex; gap: 4px; margin-top: 23px; padding: 4px; width: max-content; max-width: 100%; border-radius: 12px; background: #f2f4f7; overflow-x: auto; }
.media-tab { display: inline-flex; align-items: center; gap: 8px; min-height: 36px; padding: 0 13px; border: 0; border-radius: 9px; color: #667085; background: transparent; font-size: 12px; font-weight: 750; white-space: nowrap; }
.media-tab span { display: grid; place-items: center; min-width: 20px; height: 20px; padding: 0 5px; border-radius: 20px; color: #667085; background: #e4e7ec; font-size: 10px; }
.media-tab.is-active { color: var(--ink); background: #fff; box-shadow: 0 2px 7px rgba(16,24,40,.08); }
.media-tab.is-active span { color: #fff; background: var(--primary); }
.sync-scope { display: flex; align-items: center; gap: 8px; margin-top: 15px; color: #667085; font-size: 11px; }
.scope-dot { flex: 0 0 auto; width: 7px; height: 7px; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 3px var(--soft-green); }
.sync-scope.is-local .scope-dot { background: #b87510; box-shadow: 0 0 0 3px #fff4df; }
.section-management { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-top: 12px; padding: 10px 12px; border: 1px solid #e4e7ec; border-radius: 11px; color: #667085; background: #fafbfc; font-size: 10px; }
.section-management-actions { display: flex; align-items: center; justify-content: flex-end; flex-wrap: wrap; gap: 6px; flex: 0 1 auto; }
.section-management-actions > button { min-height: 31px; padding: 0 9px; border: 1px solid #d9dcef; border-radius: 8px; color: #4f46c8; background: #fff; font-size: 9px; font-weight: 800; }
.section-management-actions > button.account-wipe { border-color: #f1c7cc; color: #a12d3e; }
.section-management-actions > button:hover { background: #f5f5ff; }
.section-management-actions > button.account-wipe:hover { background: #fff0f1; }
.choice-dialog { width: min(430px, calc(100vw - 32px)); padding: 0; border: 0; border-radius: 16px; box-shadow: 0 24px 80px rgba(16, 24, 40, .25); }
.choice-dialog::backdrop { background: rgba(16, 24, 40, .54); }
.choice-dialog form { display: grid; gap: 13px; padding: 24px; }
.choice-dialog h2 { margin: 0; font-size: 20px; }
.choice-dialog p { margin: 0; color: #667085; font-size: 13px; }
.choice-dialog-options { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.choice-dialog-options button { min-height: 54px; padding: 9px 12px; border: 1px solid #d9dcef; border-radius: 10px; color: #3530a7; background: #f8f8ff; font-weight: 800; }
.choice-dialog-options button small { display: block; margin-top: 3px; color: #667085; font-size: 10px; font-weight: 600; }
.section-delete-menu { position: relative; flex: 0 0 auto; }
.section-delete-menu > summary { padding: 7px 10px; border: 1px solid #f1c7cc; border-radius: 8px; color: #a12d3e; background: #fff; cursor: pointer; font-size: 10px; font-weight: 800; list-style: none; }
.section-delete-menu > summary::-webkit-details-marker { display: none; }
.section-delete-menu > div { position: absolute; z-index: 12; top: 38px; right: 0; width: 235px; padding: 8px; border: 1px solid var(--line); border-radius: 11px; background: #fff; box-shadow: 0 18px 38px rgba(16,24,40,.18); }
.section-delete-menu strong { display: block; padding: 4px 7px 7px; color: #667085; font-size: 9px; text-transform: uppercase; }
.section-delete-menu button { display: block; width: 100%; min-height: 34px; padding: 0 8px; border: 0; border-radius: 7px; color: #344054; background: transparent; text-align: left; font-size: 11px; font-weight: 650; }
.section-delete-menu button:hover { background: #f2f4f7; }
.section-delete-menu button.danger { color: #a12d3e; }
.section-delete-menu button.danger:hover { background: #fff0f1; }
.section-delete-menu button.restore { margin-top: 6px; border-top: 1px solid #eaecf0; border-radius: 0 0 7px 7px; color: #4f46c8; }
.media-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 15px; min-height: 230px; margin-top: 20px; }
.media-loading { display: contents; }
.media-loading span { display: block; aspect-ratio: 2 / 3.25; border-radius: 14px; background: linear-gradient(100deg, #f2f4f7 30%, #fafafa 45%, #f2f4f7 60%); background-size: 300% 100%; animation: media-shimmer 1.3s infinite; }
@keyframes media-shimmer { to { background-position: -100% 0; } }
.media-empty { grid-column: 1 / -1; display: grid; place-items: center; min-height: 220px; padding: 35px; border: 1px dashed #d9dde5; border-radius: 15px; color: #98a2b3; text-align: center; }
.media-empty strong { display: block; margin-bottom: 5px; color: #475467; font-size: 14px; }
.media-card { position: relative; min-width: 0; }
.media-poster { position: relative; aspect-ratio: 2 / 3; overflow: hidden; border-radius: 13px; color: #fff; background: linear-gradient(145deg, #cfd0f7, #6668c9 60%, #393a84); box-shadow: 0 10px 25px rgba(16,24,40,.13); }
.media-poster::after { content: ""; position: absolute; inset: 45% 0 0; background: linear-gradient(transparent, rgba(10,15,30,.78)); pointer-events: none; }
.media-poster img { display: block; width: 100%; height: 100%; object-fit: cover; }
.poster-fallback { display: grid; place-items: center; width: 100%; height: 100%; padding: 20px; color: rgba(255,255,255,.85); font-size: 40px; font-weight: 800; text-align: center; text-shadow: 0 2px 12px rgba(16,24,40,.2); }
.provider-badges { position: absolute; z-index: 2; left: 9px; top: 9px; display: flex; gap: 5px; }
.provider-badge { display: grid; place-items: center; width: 24px; height: 24px; border: 1px solid rgba(255,255,255,.3); border-radius: 8px; color: #fff; background: rgba(16,24,40,.72); backdrop-filter: blur(7px); font-size: 9px; font-weight: 850; }
.provider-badge.web { background: rgba(91,92,226,.88); }
.provider-badge.stremio { background: rgba(74,75,209,.88); }
.provider-badge.nuvio { background: rgba(8,126,130,.88); }
.media-status { position: absolute; z-index: 2; right: 9px; bottom: 9px; display: inline-flex; align-items: center; gap: 5px; max-width: calc(100% - 18px); padding: 5px 7px; border-radius: 7px; color: #fff; background: rgba(16,24,40,.74); backdrop-filter: blur(7px); font-size: 9px; font-weight: 750; }
.media-episode-badge { position: absolute; z-index: 2; left: 9px; bottom: 20px; max-width: calc(100% - 18px); padding: 5px 7px; overflow: hidden; border: 1px solid rgba(255,255,255,.2); border-radius: 7px; color: #fff; background: rgba(16,24,40,.78); backdrop-filter: blur(7px); font-size: 9px; font-weight: 800; text-overflow: ellipsis; white-space: nowrap; }
.media-progress { position: absolute; z-index: 2; left: 9px; bottom: 9px; width: calc(100% - 18px); height: 4px; border: 0; border-radius: 5px; background: rgba(255,255,255,.4); overflow: hidden; appearance: none; }
.media-progress::-webkit-progress-bar { border-radius: inherit; background: rgba(255,255,255,.4); }
.media-progress::-webkit-progress-value { border-radius: inherit; background: #8b8cff; }
.media-progress::-moz-progress-bar { border-radius: inherit; background: #8b8cff; }
.media-card-body { padding: 11px 2px 0; min-width: 0; }
.media-card h3 { margin: 0; overflow: hidden; color: var(--ink); font-size: 13px; line-height: 1.35; letter-spacing: -.015em; text-overflow: ellipsis; white-space: nowrap; }
.media-card-meta { display: flex; align-items: center; gap: 5px; min-width: 0; margin-top: 4px; color: #98a2b3; font-size: 10px; }
.media-card-meta span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.media-card-meta span + span::before { content: "·"; margin-right: 5px; }
.media-id-row { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 7px; }
.id-chip { display: inline-flex; align-items: center; min-height: 20px; padding: 0 6px; border-radius: 6px; color: #344054; background: #f2f4f7; font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: 8px; font-weight: 750; }
.id-chip.tmdb { color: #08677f; background: #eaf8fb; }
.id-chip.imdb { color: #755800; background: #fff7d6; }
.provider-id-details { margin-top: 5px; color: #667085; font-size: 9px; }
.provider-id-details summary { width: max-content; cursor: pointer; font-weight: 700; }
.provider-id-details > div { display: grid; gap: 3px; margin-top: 5px; padding: 6px; border-radius: 7px; background: #f8f9fb; font-family: ui-monospace, SFMono-Regular, Consolas, monospace; overflow-wrap: anywhere; }
.media-actions { position: absolute; z-index: 5; top: 8px; right: 8px; }
.media-actions summary { display: grid; place-items: center; width: 30px; height: 30px; border: 1px solid rgba(255,255,255,.24); border-radius: 9px; color: #fff; background: rgba(16,24,40,.72); backdrop-filter: blur(7px); cursor: pointer; font-size: 17px; font-weight: 800; list-style: none; }
.media-actions summary::-webkit-details-marker { display: none; }
.media-actions[open] summary { background: var(--ink); }
.media-actions-menu { position: absolute; top: 35px; right: 0; width: 245px; max-height: min(520px, 75vh); padding: 6px; overflow-y: auto; border: 1px solid var(--line); border-radius: 11px; background: #fff; box-shadow: 0 18px 38px rgba(16,24,40,.2); }
.media-actions-menu button { display: flex; align-items: center; gap: 9px; width: 100%; min-height: 35px; padding: 0 9px; border: 0; border-radius: 7px; color: #344054; background: transparent; text-align: left; font-size: 11px; font-weight: 650; }
.media-actions-menu button span { display: inline-grid; place-items: center; flex: 0 0 20px; height: 20px; border-radius: 5px; background: #f2f4f7; font-size: 9px; }
.media-actions-label { margin: 5px 4px 3px; padding: 7px 5px 4px; border-top: 1px solid #eaecf0; color: #98a2b3; font-size: 8px; font-weight: 850; letter-spacing: .05em; text-transform: uppercase; }
.media-actions-menu button:hover { background: #f2f4f7; }
.media-actions-menu button.danger { color: #a12d3e; }
.media-actions-menu button.danger:hover { background: #fff0f1; }
.media-actions-menu button:disabled { opacity: .5; cursor: wait; }
.media-card.is-busy { opacity: .58; pointer-events: none; }
.jobs-card { margin: 14px 0 45px; padding: 24px 25px; }
.queue-status { min-height: 16px; margin: 5px 0 0; color: #667085; font-size: 11px; }
.queue-status.is-warning { color: #b54708; font-weight: 700; }
.queue-status.is-ok { color: #078a63; }
.table-wrap { overflow-x: auto; margin-top: 15px; }
table { width: 100%; border-collapse: collapse; font-size: 12px; }
th { color: #98a2b3; font-size: 10px; font-weight: 800; letter-spacing: .06em; text-align: left; text-transform: uppercase; }
th, td { padding: 10px 8px; border-bottom: 1px solid #f0f1f3; white-space: nowrap; }
td { color: #475467; }
.site-footer { display: flex; justify-content: space-between; padding: 0 0 28px; color: #98a2b3; font-size: 11px; }

@media (max-width: 860px) {
    .auth-layout { grid-template-columns: 1fr; margin-top: 20px; }
    .intro-panel { padding: 25px 5px 38px; }
    .intro-panel h1 { max-width: 600px; font-size: 44px; }
    .auth-card { width: 100%; }
    .auth-forms { grid-template-columns: 1fr; gap: 25px; }
    .form-divider { min-height: 1px; }
    .form-divider::before { width: 100%; height: 1px; border: 0; border-top: 1px solid var(--line); }
    .form-divider span { padding: 0 10px; }
    .media-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
    .section-management { align-items: flex-start; flex-direction: column; }
    .section-management-actions { align-items: stretch; flex-wrap: wrap; width: 100%; }
    .section-management-actions > button { flex: 1; }
    .section-delete-menu { align-self: stretch; }
    .section-delete-menu > summary { text-align: center; }
    .section-delete-menu > div { left: 0; right: auto; width: min(300px, 85vw); }
    .media-hub-heading { align-items: start; flex-direction: column; }
    .media-tools { width: 100%; }
    .media-search { width: auto; flex: 1; }
}
@media (max-width: 620px) {
    .shell { width: min(100% - 28px, 560px); }
    .site-header { height: 72px; }
    .summary-grid, .connect-grid { grid-template-columns: 1fr; }
    .page-intro { align-items: start; flex-direction: column; }
    .page-intro .button { width: 100%; }
    .addon-card { align-items: start; flex-direction: column; }
    .addon-card > .button { width: 100%; }
    .addon-copy { align-items: start; }
    .auth-card, .connect-card, .media-hub, .jobs-card { padding: 21px; }
    .intro-panel h1 { font-size: 38px; }
    .site-footer { flex-direction: column; gap: 5px; }
    .media-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px 12px; }
    .media-tools { align-items: stretch; flex-direction: column; }
    .media-tools select, .media-search { width: 100%; }
    .media-tabs { width: 100%; }
    .media-tab { flex: 1; justify-content: center; }
    .sync-scope { align-items: flex-start; }
}
