* { margin: 0; padding: 0; box-sizing: border-box; }
    body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif; background: #0f172a; color: #e2e8f0; min-height: 100vh; }
    .container { max-width: 1400px; margin: 0 auto; padding: 20px; }
    header { text-align: center; padding: 30px 0; }
    header h1 { font-size: 2.5rem; background: linear-gradient(135deg, #3b82f6, #8b5cf6); -webkit-background-clip: text; -webkit-text-fill-color: transparent; }
    .tabs { display: flex; gap: 10px; justify-content: center; margin-bottom: 30px; flex-wrap: wrap; }
    .tab { padding: 12px 24px; background: #1e293b; border: 1px solid #334155; border-radius: 8px; cursor: pointer; transition: all 0.2s; }
    .tab:hover, .tab.active { background: #3b82f6; border-color: #3b82f6; }
    .section { display: none; background: #1e293b; border-radius: 12px; padding: 25px; border: 1px solid #334155; margin-bottom: 20px; }
    .section.active { display: block; }
    .section h2 { margin-bottom: 20px; color: #f1f5f9; }
    .form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 15px; margin-bottom: 20px; }
    input, select, textarea { width: 100%; padding: 10px; background: #0f172a; border: 1px solid #334155; border-radius: 6px; color: #e2e8f0; }
    input:focus, select:focus, textarea:focus { outline: none; border-color: #3b82f6; }
    button { padding: 10px 20px; background: #3b82f6; color: white; border: none; border-radius: 6px; cursor: pointer; transition: background 0.2s; }
    button:hover { background: #2563eb; }
    button.danger { background: #ef4444; }
    button.danger:hover { background: #dc2626; }
    button.secondary { background: #64748b; }
    button.success { background: #16a34a; }
    button.success:hover { background: #15803d; }
    button:disabled { opacity: 0.6; cursor: not-allowed; }
    .card { background: #0f172a; border: 1px solid #334155; border-radius: 8px; padding: 15px; margin-bottom: 15px; }
    .card h3 { margin-bottom: 10px; color: #93c5fd; }
    .card p { color: #94a3b8; font-size: 0.9rem; margin-bottom: 5px; }
    .badge { display: inline-block; padding: 4px 10px; border-radius: 20px; font-size: 0.75rem; margin-right: 5px; }
    .badge-blue { background: #1e40af; color: #bfdbfe; }
    .badge-green { background: #166534; color: #bbf7d0; }
    .badge-orange { background: #9a3412; color: #fed7aa; }
    .options-list { margin: 10px 0; }
    .option-row { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 12px; align-items: center; }
    .option-row input { min-width: 0; }
    .option-row .optSourceUrl { flex: 2 1 280px; }
    .option-row .optLabel { flex: 1 1 120px; }
    .option-row .optQuality { flex: 0 1 100px; }
    .option-row label.nimble-check { display: flex; align-items: center; gap: 6px; white-space: nowrap; font-size: 13px; cursor: pointer; flex: 0 0 auto; }
    .option-row button.danger { flex: 0 0 auto; }
    .hidden { display: none !important; pointer-events: none !important; }
    .login-box.hidden { display: none !important; pointer-events: none !important; }
    .login-box { position: fixed; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; background: rgba(15, 23, 42, 0.98); z-index: 999999; padding: 20px; pointer-events: auto; }
    .login-box > div, .login-inner { position: relative; z-index: 1000000; max-width: 400px; width: 100%; background: #1e293b; padding: 40px; border-radius: 12px; border: 1px solid #334155; }
    .login-inner form { display: block; }
    .login-inner input { display: block; width: 100%; }
    .login-inner button { display: block; width: 100%; position: relative; z-index: 1000001; }
    #app.hidden, .panel-layout.hidden { display: none !important; pointer-events: none !important; }
    .login-box h2 { text-align: center; margin-bottom: 20px; }
    .message { padding: 10px; border-radius: 6px; margin-bottom: 15px; }
    .message.success { background: #166534; color: #bbf7d0; }
    .message.error { background: #7f1d1d; color: #fecaca; }
    .stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 20px; margin-bottom: 30px; }
    .stat-card { background: #1e293b; border-radius: 12px; padding: 20px; text-align: center; border: 1px solid #334155; }
    .stat-card h3 { font-size: 2rem; color: #3b82f6; }
    .stat-card p { color: #94a3b8; }
    .search-box { display: flex; gap: 10px; margin-bottom: 15px; }
    .search-box input { flex: 1; }
    .logo-thumb { width: 40px; height: 40px; object-fit: contain; border-radius: 4px; background: #0f172a; border: 1px solid #334155; }
    .team-result { display: flex; align-items: center; gap: 10px; padding: 8px; border-bottom: 1px solid #334155; cursor: pointer; }
    .team-result:hover { background: #1e293b; }
    .small { font-size: 0.8rem; color: #64748b; }
    .actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
    .hint { color: #94a3b8; font-size: 0.85rem; margin-bottom: 10px; }

    /* Sidebar layout */
    .panel-layout { display: flex; min-height: 100vh; }
    .sidebar { width: 260px; background: #0b1220; border-right: 1px solid #334155; display: flex; flex-direction: column; flex-shrink: 0; }
    .sidebar-header { padding: 24px 20px; text-align: center; border-bottom: 1px solid #1e293b; }
    .sidebar-header h1 { font-size: 1.5rem; background: linear-gradient(135deg, #3b82f6, #8b5cf6); -webkit-background-clip: text; -webkit-text-fill-color: transparent; }
    .sidebar-header p { color: #94a3b8; font-size: 0.8rem; margin-top: 4px; }
    .sidebar-nav { flex: 1; overflow-y: auto; padding: 16px 12px; }
    .nav-group { margin-bottom: 22px; }
    .nav-group-title { color: #64748b; font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.08em; padding: 0 10px; margin-bottom: 6px; font-weight: 600; }
    .nav-item { display: block; padding: 9px 12px; border-radius: 6px; color: #cbd5e1; cursor: pointer; margin-bottom: 2px; font-size: 0.92rem; transition: background 0.15s, color 0.15s; }
    .nav-item:hover { background: #1e293b; }
    .nav-item.active { background: #3b82f6; color: #fff; }
    .panel-main { flex: 1; overflow-y: auto; background: #0f172a; }
    .panel-main header { padding: 24px 20px 10px; }
    .panel-main header h1 { font-size: 2rem; }

    @media (max-width: 768px) {
      .sidebar { width: 100%; position: fixed; bottom: 0; left: 0; top: auto; height: auto; border-right: none; border-top: 1px solid #334155; flex-direction: row; overflow-x: auto; z-index: 100; }
      .sidebar-header, .nav-group-title { display: none; }
      .sidebar-nav { display: flex; gap: 4px; padding: 8px; }
      .nav-group { display: flex; margin-bottom: 0; }
      .nav-item { white-space: nowrap; margin-bottom: 0; }
      .panel-main { padding-bottom: 70px; }
    }
    .modal-overlay { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.8); display: none; align-items: center; justify-content: center; z-index: 1000; padding: 20px; }
    .modal-overlay.active { display: flex; }
    .modal { background: #1e293b; border: 1px solid #334155; border-radius: 12px; width: 100%; max-width: 900px; max-height: 90vh; overflow-y: auto; padding: 25px; }
    .modal-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; }
    .modal-header h2 { margin: 0; }
    .close-btn { background: #64748b; padding: 6px 12px; }
    .season-block { background: #0f172a; border: 1px solid #334155; border-radius: 8px; padding: 15px; margin-bottom: 15px; }
    .season-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; flex-wrap: wrap; gap: 10px; }
    .season-title { font-weight: 600; color: #93c5fd; }
    .episode-row { display: grid; grid-template-columns: 60px 1fr 1fr 80px 40px; gap: 10px; align-items: center; margin-bottom: 8px; padding: 8px; background: #1e293b; border-radius: 6px; }
    .episode-row input { padding: 6px; font-size: 0.85rem; }
    .episode-row .ep-num { text-align: center; font-weight: 600; color: #94a3b8; }
    .empty-msg { color: #64748b; font-size: 0.85rem; padding: 10px; }
    .btn-small { font-size: 12px; padding: 6px 10px; }
    .cdn-channel-item { display: flex; align-items: center; gap: 10px; background: #0f172a; padding: 8px 10px; border-radius: 6px; cursor: pointer; border: 1px solid transparent; transition: background 0.15s, border-color 0.15s; user-select: none; }
    .cdn-channel-item:hover { background: #1e293b; border-color: #334155; }
    .cdn-channel-item:has(input:checked) { background: #1e3a8a; border-color: #3b82f6; }
    .cdn-channel-item input { width: auto; flex-shrink: 0; cursor: pointer; }
    .cdn-channel-item img { width: 28px; height: 28px; object-fit: contain; flex-shrink: 0; }
    .cdn-channel-item span { color: #e2e8f0; font-size: 13px; flex: 1; line-height: 1.2; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
    .cdn-country-filter { width: 100%; max-width: 320px; margin-bottom: 10px; }
    .cdn-selected-count { font-size: 13px; color: #94a3b8; margin-left: auto; }
    @media (max-width: 768px) {
      .episode-row { grid-template-columns: 40px 1fr 1fr 60px 36px; }
    }